If/elseif/else implemented!

This commit is contained in:
Ryan Ward 2020-11-28 15:11:16 -05:00
parent 378e5ec0ec
commit a2f1995b1d
11 changed files with 365 additions and 147 deletions

View File

@ -125,8 +125,6 @@
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<LanguageStandard_C>Default</LanguageStandard_C>
<SupportJustMyCode>false</SupportJustMyCode>
<Optimization>Full</Optimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>

View File

@ -18,6 +18,8 @@
namespace dms {
struct tokenstream {
tokenstream();
tokenstream(std::vector<tokens::token>*);
std::vector<tokens::token> tokens;
size_t pos = 0;
std::stack<size_t> spos;
@ -30,7 +32,6 @@ namespace dms {
tokens::token peek();
tokens::token last();
std::vector<tokens::token> next(tokens::tokentype tk);
bool match(codes::op t1 = codes::NOOP);
bool match(tokens::tokentype t1 = tokens::none, tokens::tokentype t2 = tokens::none, tokens::tokentype t3 = tokens::none, tokens::tokentype t4 = tokens::none, tokens::tokentype t5 = tokens::none, tokens::tokentype t6 = tokens::none, tokens::tokentype t7 = tokens::none, tokens::tokentype t8 = tokens::none, tokens::tokentype t9 = tokens::none, tokens::tokentype t10 = tokens::none, tokens::tokentype t11 = tokens::none, tokens::tokentype t12 = tokens::none);
bool match(tokens::tokentype* t1 = nullptr, tokens::tokentype* t2 = nullptr, tokens::tokentype* t3 = nullptr, tokens::tokentype* t4 = nullptr, tokens::tokentype* t5 = nullptr, tokens::tokentype* t6 = nullptr, tokens::tokentype* t7 = nullptr, tokens::tokentype* t8 = nullptr, tokens::tokentype* t9 = nullptr, tokens::tokentype* t10 = nullptr, tokens::tokentype* t11 = nullptr, tokens::tokentype* t12 = nullptr);
bool hasScope(size_t tabs);
@ -49,6 +50,7 @@ namespace dms {
};
class LineParser
{
bool stop = false;
std::string fn;
chunk* current_chunk = nullptr;
std::string chunk_name;
@ -61,6 +63,7 @@ namespace dms {
dms_state* state = nullptr;
void doCheck(passer* stream, std::vector<tokens::token>* t_vec, size_t line, bool& isNum, bool& hasDec, std::vector<uint8_t>* buffer);
void _Parse(tokenstream* stream);
void ParseLoop(tokenstream* stream);
std::stack<std::string> lastCall;
// Match Process Code
bool match_process_debug(tokenstream* stream);
@ -72,6 +75,8 @@ namespace dms {
bool match_process_exit(tokenstream* stream);
bool match_process_expression(tokenstream* stream, value& v);
bool match_process_IFFF(tokenstream* stream);
bool match_process_ELIF(tokenstream* stream,std::string);
bool match_process_ELSE(tokenstream* stream,std::string);
bool match_process_assignment(tokenstream* stream);
bool match_process_list(tokenstream* stream, value& v);
bool match_process_wait(tokenstream* stream);
@ -80,7 +85,6 @@ namespace dms {
bool match_process_return(tokenstream* stream);
bool match_process_condition(tokenstream* stream, value& v);
bool match_process_andor(tokenstream* stream,value& v);
bool match_process_if(tokenstream* stream);
// Build
void buildGoto(std::string g, bool v = false);
@ -91,6 +95,8 @@ namespace dms {
void buildWait(double w);
// Utils
std::string random_string(std::size_t length);
void badSymbol(errors::errortype err, tokenstream* stream);
void badSymbol(tokenstream* stream);
void badSymbol();

View File

@ -33,6 +33,7 @@ namespace dms {
c->args.push(value(l));
current_chunk->addCmd(c);
current_chunk->addLabel(l);
utils::debug("Building Label: ",l);
}
void LineParser::buildSpeed(double s) {
cmd* c = new cmd;

View File

@ -4,12 +4,15 @@ using namespace dms::utils;
// TODO: process if elseif else statements, for loops and while loops
namespace dms {
bool LineParser::match_process_standard(tokenstream* stream, value& v) {
//utils::debug(stream->peek());
if (stream->peek().type == tokens::none) {
return false;
}
if (stream->match(tokens::parao)) {
std::vector<tokens::token> toks = stream->next(tokens::parao, tokens::parac);
//toks.pop_back(); // Remove the ')'
toks.pop_back(); // Remove the ')'
toks.push_back(tokens::token{tokens::newline,codes::NOOP,"",stream->peek().line_num});
tokenstream tempstream;
tempstream.init(&toks);
tokenstream tempstream(&toks);
value var(datatypes::variable);
if (match_process_standard(&tempstream, var)) {
v.set(var.s);
@ -22,7 +25,8 @@ namespace dms {
}
return true;
}
else if (match_process_andor(stream, v)) {
if (match_process_andor(stream, v)) {
match_process_condition(stream, v);
return true;
}
if (match_process_expression(stream, v)) {
@ -85,6 +89,7 @@ namespace dms {
return true;
}
else if (stream->match(tokens::newline)) {
stream->next();
return match_process_standard(stream,v);
}
return false;
@ -192,8 +197,7 @@ namespace dms {
token start = stream->peek();
token ancor = start;
std::vector<token> t = stream->next(tokens::cbracketo, tokens::cbracketc);
tokenstream tempstream;
tempstream.init(&t);
tokenstream tempstream(&t);
value ref = value(datatypes::variable);
value length = value();
value dict = value();
@ -631,9 +635,10 @@ namespace dms {
}
// Already we have built: FUNC name val
// Next we add arguments this is where things get interesting
tokenstream tempstream;
// This is a balanced consuming method (()(()))
std::vector<token> t = stream->next(tokens::parao, tokens::parac); // Consume and get tokens
//t.pop_back();
tokenstream tempstream(&t);
if (t.size() == 1) { // No arg function!
current_chunk->addCmd(c);
return true;
@ -702,6 +707,7 @@ namespace dms {
badSymbol(&tempstream);
}
}
}
else if (stream->match(tokens::name,tokens::dot,tokens::name,tokens::parao)) {
cmd* c = new cmd;
@ -719,9 +725,10 @@ namespace dms {
}
// Already we have built: FUNC name val
// Next we add arguments this is where things get interesting
tokenstream tempstream;
// This is a balanced consuming method (()(()))
std::vector<token> t = stream->next(tokens::parao, tokens::parac); // Consume and get tokens
t.pop_back();
tokenstream tempstream(&t);
if (t.size() == 1) { // No arg function!
current_chunk->addCmd(c);
return true;
@ -750,16 +757,14 @@ namespace dms {
else if (tempstream.match(tokens::newline)) {
tempstream.next();
}
else if (tempstream.match(tokens::parac)) {
tempstream.next();
current_chunk->addCmd(c); // We push this onto the chunk after all dependants if any have been handled
//lastCall.pop();
return true;
}
else {
badSymbol(&tempstream);
}
}
tempstream.next();
current_chunk->addCmd(c); // We push this onto the chunk after all dependants if any have been handled
//lastCall.pop();
return true;
}
return false;
}
@ -779,11 +784,10 @@ namespace dms {
bool LineParser::match_process_index(tokenstream* stream, value& v, bool leftside) {
if (stream->match(tokens::name,tokens::bracketo)) {
std::string name = stream->next().name;
std::vector<token> tok = stream->next(tokens::bracketo, tokens::bracketc);
tok.pop_back(); // Remove the last element since its a ']'
tok.push_back(token{ tokens::newline,codes::NOOP,"",tok[0].line_num });
tokenstream tempstream; // As usual the tokens are balanced match to [...] where the contents of tok = ...
tempstream.init(&tok);
std::vector<token> toks = stream->next(tokens::bracketo, tokens::bracketc);
toks.pop_back(); // Remove the last element since its a ']'
toks.push_back(token{ tokens::newline,codes::NOOP,"",toks[0].line_num });
tokenstream tempstream(&toks); // As usual the tokens are balanced match to [...] where the contents of tok = ...
value tempval = value(datatypes::variable);
cmd* c = new cmd;
if (leftside) {
@ -867,11 +871,93 @@ namespace dms {
// We match a condition, or anything that is non nil/false
// God controls are from a time past... I could refactor, but I'm lazy and would have to change a lot of old code... So we will deal with controls
if (stream->match(tokens::name) && stream->peek().name == "if") {
utils::debug("Let's process an if");
if (stream->match(tokens::name,tokens::parao) && stream->peek().name == "if") {
stream->next();
std::vector<token> ts = stream->next(tokens::parao, tokens::parac);
ts.pop_back();
tokenstream tmpstream(&ts);
value cmp(datatypes::variable);
if (match_process_standard(&tmpstream,cmp)) {
std::string ifend = std::string("IFE_") + random_string(4);
std::string next = std::string("IFF_") + random_string(4);
if (stream->match(tokens::cbracketo)) {
std::vector<token> toks = stream->next(tokens::cbracketo, tokens::cbracketc);
toks.pop_back();
tokenstream tempstream(&toks);
cmd* c = new cmd;
c->opcode = codes::IFFF;
c->args.push(cmp);
c->args.push(value(next));
current_chunk->addCmd(c);
ParseLoop(&tempstream);
buildGoto(ifend);
buildLabel(next);
if (match_process_ELIF(stream,ifend)) {
utils::debug("here");
}
else if (match_process_ELSE(stream,ifend)) {
utils::debug("here");
}
buildLabel(ifend);
// We keep trying to match else if/else until nothing is left
return true;
}
}
else {
badSymbol(stream);
}
}
return false; // TODO finish this
}
bool LineParser::match_process_ELSE(tokenstream* stream, std::string ifend) {
if (stream->match(tokens::name, tokens::cbracketo) && stream->peek().name == "else") {
stream->next();
std::vector<token> ts = stream->next(tokens::cbracketo, tokens::cbracketc);
ts.pop_back();
tokenstream tempstream(&ts);
ParseLoop(&tempstream);
return true;
}
return false;
}
bool LineParser::match_process_ELIF(tokenstream* stream, std::string ifend) {
if (stream->match(tokens::name, tokens::parao) && stream->peek().name == "elseif") {
stream->next();
std::vector<token> ts = stream->next(tokens::parao, tokens::parac);
ts.pop_back();
tokenstream tmpstream(&ts);
value cmp(datatypes::variable);
//buildLabel(iff);
if (match_process_standard(&tmpstream, cmp)) {
std::string next = std::string("IFF_") + random_string(4);
if (stream->match(tokens::cbracketo)) {
std::vector<token> toks = stream->next(tokens::cbracketo, tokens::cbracketc);
toks.pop_back();
tokenstream tempstream(&toks);
cmd* c = new cmd;
c->opcode = codes::IFFF;
c->args.push(cmp);
c->args.push(value(next));
current_chunk->addCmd(c);
ParseLoop(&tempstream);
buildGoto(ifend);
buildLabel(next);
if (match_process_ELIF(stream, ifend)) {
utils::debug("here");
}
else if (match_process_ELSE(stream, ifend)) {
utils::debug("here");
}
// We keep trying to match else if/else until nothing is left
return true;
}
}
else {
badSymbol(stream);
}
}
return false;
}
bool LineParser::match_process_wait(tokenstream* stream) {
if (stream->match(tokens::name, tokens::number)) {
@ -910,9 +996,8 @@ namespace dms {
while (stream->peek().type != tokens::none) {
debugInvoker(stream);
if (stream->match(tokens::parao)) {
tokenstream temp;
auto ts = stream->next(tokens::parao, tokens::parac);
temp.init(&ts); // Balanced match!
tokenstream temp(&ts);
value tmpvalue = value(datatypes::variable);
if (match_process_expression(&temp, tmpvalue)) {
if (left.isNil())
@ -1050,6 +1135,7 @@ namespace dms {
left = wv;
}
}
return stream->restore(lastcmd, current_chunk); // Always return false and restores the position in stream!
}
else {
return stream->restore(lastcmd, current_chunk); // Always return false and restores the position in stream!

View File

@ -246,7 +246,6 @@ namespace dms {
if ((data == ' ' || data == '(') && !isStr) { // tokens end with a space
std::string str = stream.processBuffer(buffer);
utils::debug("> ",str);
tolower(str);
if (str == "enable") {
t_vec.push_back(token{ tokens::flag,codes::ENAB,"",line });
@ -317,6 +316,9 @@ namespace dms {
tokenDump(&t_vec);
// Tokens build let's parse
tokenizer(state, t_vec);
if (stop) {
state->stop = true;
}
if (isFirst) {
state->init();
}
@ -340,19 +342,15 @@ namespace dms {
outputFile.close();
}
}
void LineParser::_Parse(tokenstream* stream) {
void LineParser::ParseLoop(tokenstream* stream) {
if (stop) return;
token current = stream->next();
createBlock("$INIT", blocktype::bt_block);
cmd* flagcmd = new cmd;
if (state->isEnabled("debugging")) {
cmd* c = new cmd;
c->opcode = codes::FILE;
c->args.push(value(fn));
current_chunk->addCmd(c);
}
while (stream->peek().type != tokens::eof) {
value nil;
while (stream->peek().type != tokens::none) {
if (stop) return;
debugInvoker(stream);
//utils::print(current);
//utils::debug(current);
//utils::print("[flags]");
if (current.type == tokens::flag) {
temp = stream->next(tokens::newline);
@ -413,7 +411,7 @@ namespace dms {
}
}
// Default block
if (stream->match(tokens::newline,tokens::bracketo, tokens::name, tokens::bracketc,tokens::newline)) {
if (stream->match(tokens::newline, tokens::bracketo, tokens::name, tokens::bracketc, tokens::newline)) {
stream->next();
stream->next();
std::string name = stream->next().name;
@ -492,12 +490,11 @@ namespace dms {
//utils::print("[disp]");
match_process_disp(stream); // Match and process dialogue
//utils::print("[label]");
if (stream->match(tokens::newline,tokens::label)) { // Match and process labels
if (stream->match(tokens::newline, tokens::label)) { // Match and process labels
stream->next();
buildLabel(stream->next().name);
}
//utils::print("[func]");
value nil;
match_process_function(stream, nil); // Naked Function
//utils::print("[assn]");
match_process_assignment(stream);
@ -513,6 +510,18 @@ namespace dms {
match_process_jump(stream);
current = stream->next();
}
}
void LineParser::_Parse(tokenstream* stream) {
if (stop) return;
createBlock("$INIT", blocktype::bt_block);
if (state->isEnabled("debugging")) {
cmd* c = new cmd;
c->opcode = codes::FILE;
c->args.push(value(fn));
current_chunk->addCmd(c);
}
ParseLoop(stream);
if (stop) return;
createBlock("$END", blocktype::bt_block);// Runs code that ensures that last user block is processed into the chunks array. Yes, I could have simply added in the lines of code at the end, but I didn't want to rewrite code again!
}
}

View File

@ -1,4 +1,5 @@
#include "LineParser.h"
#include <random>
using namespace dms::tokens;
using namespace dms::utils;
namespace dms {
@ -70,6 +71,10 @@ namespace dms {
return token{ tokentype::none,codes::NOOP,"EOS",0 };
return this->tokens[pos];
}
tokenstream::tokenstream() {}
tokenstream::tokenstream(std::vector<tokens::token>* stream) {
this->tokens = *stream;
}
bool tokenstream::hasScope(size_t tabs) {
return false;
}
@ -111,6 +116,24 @@ namespace dms {
return std::string(buf.begin(), buf.end());
}
std::string LineParser::random_string(std::size_t length)
{
const std::string CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
std::random_device random_device;
std::mt19937 generator(random_device());
std::uniform_int_distribution<> distribution(0, CHARACTERS.size() - 1);
std::string random_string;
for (std::size_t i = 0; i < length; ++i)
{
random_string += CHARACTERS[distribution(generator)];
}
return random_string;
}
bool LineParser::isBlock() {
return isBlock(bt_block); // Default block type
}
@ -123,6 +146,9 @@ namespace dms {
bool tokenstream::match(tokens::tokentype t1, tokens::tokentype t2, tokens::tokentype t3, tokens::tokentype t4, tokens::tokentype t5, tokens::tokentype t6, tokens::tokentype t7, tokens::tokentype t8, tokens::tokentype t9, tokens::tokentype t10, tokens::tokentype t11, tokens::tokentype t12) {
tokens::tokentype types[12] = { t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12 };
for (size_t i = 0; i < 12; i++) {
//std::cout << this->tokens.size() << " " << pos + i << std::endl;
if (this->tokens.size() == pos + i && types[i] != tokens::none)
return false;
if (types[i] == tokens::none)
return true;
if (this->tokens[pos+i].type != types[i])
@ -196,12 +222,15 @@ namespace dms {
}
void LineParser::badSymbol(errors::errortype err,tokenstream* stream) {
state->push_error(errors::error{ err,concat("Unexpected symbol '",stream->next().toString(),"'"),true,stream->peek().line_num,current_chunk });
stop = true;
}
void LineParser::badSymbol(tokenstream* stream) {
state->push_error(errors::error{ errors::unknown,concat("Unexpected symbol '",stream->peek().toString(),"'"),true,stream->next().line_num,current_chunk });
stop = true;
}
void LineParser::badSymbol() {
state->push_error(errors::error{ errors::unknown,concat("Unexpected symbol '",_stream->peek().toString(),"'"),true,_stream->next().line_num,current_chunk });
stop = true;
}
void LineParser::debugInvoker(tokenstream* stream) {
if (state->isEnabled("debugging") && stream->peek().type != tokens::newline) {
@ -267,8 +296,7 @@ namespace dms {
return true;
}
void LineParser::tokenizer(dms_state* state,std::vector<token> &toks) {
tokenstream stream;
stream.init(&toks);
tokenstream stream(&toks);
_stream = &stream;
this->state = state; // Grab the pointer to the state and store it within the parser object
_Parse(&stream);

View File

@ -143,7 +143,7 @@ namespace dms {
while (!stop || !halt) {
c = cmds[pos++];
code = c->opcode;
//print("(",pos,")> ",*c);
//debug("(",pos,")> ",*c);
//wait();
switch (code)
{
@ -184,6 +184,18 @@ namespace dms {
}
return true;
break;
case IFFF:
{
value cmp = c->args.args[0].resolve(this);
value gt = c->args.args[1].resolve(this);
if (cmp.type == datatypes::boolean || cmp.isNil()) {
if (!cmp.b || cmp.isNil()) {
pos = seek(gt.getPrintable(), cmds, LABL, pos);
debug("> set pos: ", pos);
}
}
break;
}
case GOTO:
{
value labl = c->args.args[0];

Binary file not shown.

View File

@ -39,153 +39,228 @@ Line <12> name main
Line <12> bracketc ]
Line <12> newline
Line <12> newline
Line <13> name a
Line <13> name a1
Line <13> equal =
Line <13> number 10
Line <13> newline
Line <13> newline
Line <14> name b
Line <14> name a2
Line <14> equal =
Line <14> number 15
Line <14> number 10
Line <14> newline
Line <14> newline
Line <15> name print
Line <15> parao (
Line <15> name a
Line <15> name a3
Line <15> equal =
Line <15> equal =
Line <15> name b
Line <15> or
Line <15> parao (
Line <15> name a
Line <15> not !
Line <15> equal =
Line <15> name b
Line <15> and
Line <15> name a
Line <15> equal =
Line <15> equal =
Line <15> name a
Line <15> parac )
Line <15> or
Line <15> name a
Line <15> anglebracketC >
Line <15> name b
Line <15> parac )
Line <15> number 10
Line <15> newline
Line <15> newline
Line <16> name if
Line <16> parao (
Line <16> name a
Line <16> name b1
Line <16> equal =
Line <16> equal =
Line <16> name b
Line <16> parac )
Line <16> cbracketo {
Line <16> number 15
Line <16> newline
Line <16> newline
Line <17> name b2
Line <17> equal =
Line <17> number 15
Line <17> newline
Line <17> newline
Line <18> cbracketc }
Line <18> name b3
Line <18> equal =
Line <18> number 15
Line <18> newline
Line <18> newline
Line <19> newline
Line <19> newline
Line <20> name print
Line <20> parao (
Line <20> name a1
Line <20> equal =
Line <20> equal =
Line <20> name b1
Line <20> or
Line <20> parao (
Line <20> name a2
Line <20> not !
Line <20> equal =
Line <20> name b2
Line <20> and
Line <20> name a3
Line <20> equal =
Line <20> equal =
Line <20> name a3
Line <20> parac )
Line <20> or
Line <20> name a3
Line <20> anglebracketC >
Line <20> name b3
Line <20> parac )
Line <20> newline
Line <20> newline
Line <21> newline
Line <21> newline
Line <22> name if
Line <22> parao (
Line <22> name a
Line <22> not !
Line <22> equal =
Line <22> name b
Line <22> parac )
Line <22> cbracketo {
Line <22> newline
Line <22> newline
Line <23> name print
Line <23> parao (
Line <23> string Doing a test!
Line <23> parac )
Line <23> newline
Line <23> newline
Line <24> name if
Line <24> parao (
Line <24> name a
Line <24> equal =
Line <24> equal =
Line <24> name b
Line <24> parac )
Line <24> cbracketo {
Line <24> newline
Line <24> newline
Line <25> name print
Line <25> parao (
Line <25> string Doing more tests!
Line <25> parac )
Line <25> newline
Line <25> newline
Line <26> cbracketc }
Line <26> newline
Line <26> newline
Line <27> cbracketc }
Line <27> name elseif
Line <27> parao (
Line <27> name a1
Line <27> not !
Line <27> equal =
Line <27> number 10
Line <27> parac )
Line <27> cbracketo {
Line <27> newline
Line <27> newline
Line <28> name print
Line <28> parao (
Line <28> string Does this work?
Line <28> parac )
Line <28> newline
Line <28> newline
Line <29> cbracketc }
Line <29> name else
Line <29> cbracketo {
Line <29> newline
Line <29> newline
Line <30> name print
Line <30> parao (
Line <30> string This is an else!
Line <30> parac )
Line <30> newline
Line <30> newline
Line <31> cbracketc }
Line <31> newline
Line <31> newline
Line <32> bracketo [
Line <32> name Bob
Line <32> colon :
Line <32> name char
Line <32> bracketc ]
Line <32> newline
Line <32> newline
Line <33> newline
Line <33> newline
Line <34> newline
Line <35> newline
Line <36> name unknown
Line <36> equal =
Line <36> string Some Random Guy
Line <35> newline
Line <36> newline
Line <36> newline
Line <37> name age
Line <37> equal =
Line <37> number 0.24
Line <37> newline
Line <37> newline
Line <38> name money
Line <38> equal =
Line <38> number 100
Line <38> newline
Line <38> newline
Line <39> name excited
Line <39> colon :
Line <39> string path/to/file
Line <39> newline
Line <39> newline
Line <40> newline
Line <40> newline
Line <41> bracketo [
Line <41> name test1
Line <41> colon :
Line <41> name function
Line <41> parao (
Line <41> parac )
Line <41> bracketc ]
Line <41> newline
Line <41> newline
Line <42> string Inside a function!
Line <42> newline
Line <42> newline
Line <43> newline
Line <44> newline
Line <44> newline
Line <45> bracketo [
Line <45> name Bob
Line <45> colon :
Line <45> name char
Line <45> bracketc ]
Line <45> newline
Line <45> newline
Line <46> bracketo [
Line <46> name newblock
Line <46> colon :
Line <46> name function
Line <46> parao (
Line <46> name a
Line <46> seperator ,
Line <46> name b
Line <46> seperator ,
Line <46> name c
Line <46> parac )
Line <46> bracketc ]
Line <46> newline
Line <46> newline
Line <47> string Func Arguments: a = `a`, b = `b`, c = `c`
Line <47> newline
Line <47> newline
Line <48> string Time to return
Line <48> newline
Line <48> newline
Line <49> ret
Line <49> name a
Line <49> plus +
Line <49> name b
Line <49> plus +
Line <49> name c
Line <49> name unknown
Line <49> equal =
Line <49> string Some Random Guy
Line <49> newline
Line <49> newline
Line <49> eof
Line <50> name age
Line <50> equal =
Line <50> number 0.24
Line <50> newline
Line <50> newline
Line <51> name money
Line <51> equal =
Line <51> number 100
Line <51> newline
Line <51> newline
Line <52> name excited
Line <52> colon :
Line <52> string path/to/file
Line <52> newline
Line <52> newline
Line <53> newline
Line <53> newline
Line <54> bracketo [
Line <54> name test1
Line <54> colon :
Line <54> name function
Line <54> parao (
Line <54> parac )
Line <54> bracketc ]
Line <54> newline
Line <54> newline
Line <55> string Inside a function!
Line <55> newline
Line <55> newline
Line <56> newline
Line <57> newline
Line <58> newline
Line <58> newline
Line <59> bracketo [
Line <59> name newblock
Line <59> colon :
Line <59> name function
Line <59> parao (
Line <59> name a
Line <59> seperator ,
Line <59> name b
Line <59> seperator ,
Line <59> name c
Line <59> parac )
Line <59> bracketc ]
Line <59> newline
Line <59> newline
Line <60> string Func Arguments: a = `a`, b = `b`, c = `c`
Line <60> newline
Line <60> newline
Line <61> string Time to return
Line <61> newline
Line <61> newline
Line <62> ret
Line <62> name a
Line <62> plus +
Line <62> name b
Line <62> plus +
Line <62> name c
Line <62> newline
Line <62> newline
Line <62> eof
Line <1> newline
Line <1> newline
Line <1> bracketo [
@ -264,16 +339,6 @@ Line <15> newline
Line <15> newline
Line <16> string Testing...
Line <16> newline
Line <17> name d
Line <17> equal =
Line <17> parao (
Line <17> number 100
Line <17> plus +
Line <17> name b
Line <17> parac )
Line <17> divide /
Line <17> name c
Line <17> newline
Line <17> newline
Line <18> name e
Line <18> equal =

View File

@ -14,7 +14,7 @@
[step:function(a,b,c)]
"Testing..." // testing
d = (100 + b) / c
//d = (100 + b) / c
e = "somestring"
e = nil
g = false

View File

@ -10,11 +10,24 @@ loadfile "loadtest.dms"
version 0.2
using extendedDefine
[main]
a = 10
b = 15
print(a==b or (a!=b and a==a) or a>b)
if(a==b){
a1 = 10
a2 = 10
a3 = 10
b1 = 15
b2 = 15
b3 = 15
print(a1==b1 or (a2!=b2 and a3==a3) or a3>b3)
if(a==b){
print("Doing a test!")
if(a!=b){
print("Doing more tests!")
}
} elseif (a1==10) {
print("Does this work?")
} else {
print("This is an else!")
}
// 0 + (1 * 0) + 0