Reworking language features
This commit is contained in:
parent
fbe246fa3f
commit
88485de617
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -146,7 +146,23 @@ namespace dms {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// This function is broken
|
|
||||||
|
// Handling functions are important. This method is a helper function that allows you to
|
||||||
|
bool LineParser::processFunc(tokenstream stream, chunk c) {
|
||||||
|
//
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool processFunc(tokenstream stream, chunk c, std::string gotoo) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool LineParser::processExpr(tokenstream stream, chunk c) {
|
||||||
|
//
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool LineParser::processLogic(tokenstream stream, chunk c) {
|
||||||
|
//
|
||||||
|
return false;
|
||||||
|
}
|
||||||
std::map<std::string, chunk*> LineParser::tokenizer(dms_state* state,std::vector<token> &toks) {
|
std::map<std::string, chunk*> LineParser::tokenizer(dms_state* state,std::vector<token> &toks) {
|
||||||
std::map<std::string,chunk*> chunks;
|
std::map<std::string,chunk*> chunks;
|
||||||
chunk* current_chunk = nullptr;
|
chunk* current_chunk = nullptr;
|
||||||
@ -311,11 +327,17 @@ namespace dms {
|
|||||||
bool good = true;
|
bool good = true;
|
||||||
size_t c = 0;
|
size_t c = 0;
|
||||||
while (good) {
|
while (good) {
|
||||||
if (match(stream, tokens::tab,tokens::string,tokens::name)) {
|
// We need to template the matches
|
||||||
|
if (match(stream, tokens::tab,tokens::string,tokens::name,tokens::parao)) {
|
||||||
stream.next();
|
stream.next();
|
||||||
std::string choice = stream.next().name;
|
std::string prompt = stream.next().name;
|
||||||
|
|
||||||
|
// To handle the function stuff we need to consume and process that data
|
||||||
|
// We have a method to process function data since this will be used a lot in many different places
|
||||||
|
// We just grabbed the prompt, we don't yet know how many choices we have. So we have to figure out how we can
|
||||||
|
// Process and write the bytecode for this.
|
||||||
std::string func = stream.next().name;
|
std::string func = stream.next().name;
|
||||||
print("Choice: <",c,"> ",choice," Funcname: ",func);
|
print("Choice: <",c,"> ",prompt," Funcname: ",func);
|
||||||
std::vector funcstuff = stream.next(tokens::newline);
|
std::vector funcstuff = stream.next(tokens::newline);
|
||||||
|
|
||||||
//We need to process the function data and finish creating
|
//We need to process the function data and finish creating
|
||||||
@ -600,6 +622,9 @@ namespace dms {
|
|||||||
else if (str == "goto") {
|
else if (str == "goto") {
|
||||||
t_vec.push_back(token{ tokens::gotoo,codes::NOOP,"",line });
|
t_vec.push_back(token{ tokens::gotoo,codes::NOOP,"",line });
|
||||||
}
|
}
|
||||||
|
else if (str == "jump") {
|
||||||
|
t_vec.push_back(token{ tokens::jump,codes::NOOP,"",line });
|
||||||
|
}
|
||||||
else if (utils::isalphanum(str) && str.size()>0) {
|
else if (utils::isalphanum(str) && str.size()>0) {
|
||||||
t_vec.push_back(token{ tokens::name,codes::NOOP,stream.processBuffer(buffer),line });
|
t_vec.push_back(token{ tokens::name,codes::NOOP,stream.processBuffer(buffer),line });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,14 @@ namespace dms {
|
|||||||
//Matches tokens from the stream, if the tokens match it will return true and YOU should call next on the stream. This method does not change the current position
|
//Matches tokens from the stream, if the tokens match it will return true and YOU should call next on the stream. This method does not change the current position
|
||||||
bool match(tokenstream stream, 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(tokenstream stream, 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(tokenstream stream, 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 match(tokenstream stream, 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 buildLabel(chunk c, std::string label);
|
||||||
|
|
||||||
|
bool processFunc(tokenstream stream, chunk c);
|
||||||
|
bool processFunc(tokenstream stream, chunk c, std::string gotoo);
|
||||||
|
bool processExpr(tokenstream stream, chunk c);
|
||||||
|
bool processLogic(tokenstream stream, chunk c);
|
||||||
|
|
||||||
void tolower(std::string &str);
|
void tolower(std::string &str);
|
||||||
tokens::tokentype* expr();
|
tokens::tokentype* expr();
|
||||||
tokens::tokentype* variable();
|
tokens::tokentype* variable();
|
||||||
|
|||||||
295
DMS/dump.txt
295
DMS/dump.txt
@ -297,31 +297,17 @@ Line <48>NOOP name func
|
|||||||
Line <48>NOOP parao
|
Line <48>NOOP parao
|
||||||
Line <48>NOOP parac
|
Line <48>NOOP parac
|
||||||
Line <48>NOOP newline
|
Line <48>NOOP newline
|
||||||
|
Line <49>NOOP tab
|
||||||
|
Line <49>NOOP tab
|
||||||
Line <49>NOOP newline
|
Line <49>NOOP newline
|
||||||
Line <50>NOOP tab
|
Line <50>NOOP tab
|
||||||
Line <50>NOOP for
|
Line <50>NOOP tab
|
||||||
Line <50>NOOP name x
|
Line <50>NOOP gotoo
|
||||||
Line <50>NOOP equal
|
|
||||||
Line <50>NOOP number 1
|
|
||||||
Line <50>NOOP seperator
|
|
||||||
Line <50>NOOP number 10
|
|
||||||
Line <50>NOOP newline
|
Line <50>NOOP newline
|
||||||
Line <51>NOOP tab
|
|
||||||
Line <51>NOOP tab
|
|
||||||
Line <51>NOOP for
|
|
||||||
Line <51>NOOP name y
|
|
||||||
Line <51>NOOP equal
|
|
||||||
Line <51>NOOP number 1
|
|
||||||
Line <51>NOOP seperator
|
|
||||||
Line <51>NOOP number 10
|
|
||||||
Line <51>NOOP seperator
|
|
||||||
Line <51>NOOP number 1
|
|
||||||
Line <51>NOOP newline
|
Line <51>NOOP newline
|
||||||
Line <52>NOOP tab
|
Line <52>NOOP tab
|
||||||
Line <52>NOOP tab
|
|
||||||
Line <52>NOOP tab
|
|
||||||
Line <52>NOOP for
|
Line <52>NOOP for
|
||||||
Line <52>NOOP name z
|
Line <52>NOOP name x
|
||||||
Line <52>NOOP equal
|
Line <52>NOOP equal
|
||||||
Line <52>NOOP number 1
|
Line <52>NOOP number 1
|
||||||
Line <52>NOOP seperator
|
Line <52>NOOP seperator
|
||||||
@ -329,204 +315,225 @@ Line <52>NOOP number 10
|
|||||||
Line <52>NOOP newline
|
Line <52>NOOP newline
|
||||||
Line <53>NOOP tab
|
Line <53>NOOP tab
|
||||||
Line <53>NOOP tab
|
Line <53>NOOP tab
|
||||||
Line <53>NOOP tab
|
Line <53>NOOP for
|
||||||
Line <53>NOOP tab
|
Line <53>NOOP name y
|
||||||
Line <53>NOOP string test
|
Line <53>NOOP equal
|
||||||
|
Line <53>NOOP number 1
|
||||||
|
Line <53>NOOP seperator
|
||||||
|
Line <53>NOOP number 10
|
||||||
|
Line <53>NOOP seperator
|
||||||
|
Line <53>NOOP number 1
|
||||||
Line <53>NOOP newline
|
Line <53>NOOP newline
|
||||||
Line <54>NOOP tab
|
Line <54>NOOP tab
|
||||||
Line <54>NOOP tab
|
Line <54>NOOP tab
|
||||||
Line <54>NOOP tab
|
Line <54>NOOP tab
|
||||||
Line <54>NOOP tab
|
Line <54>NOOP for
|
||||||
Line <54>NOOP string $x$ $y$ $z$
|
Line <54>NOOP name z
|
||||||
|
Line <54>NOOP equal
|
||||||
|
Line <54>NOOP number 1
|
||||||
|
Line <54>NOOP seperator
|
||||||
|
Line <54>NOOP number 10
|
||||||
Line <54>NOOP newline
|
Line <54>NOOP newline
|
||||||
Line <55>NOOP tab
|
Line <55>NOOP tab
|
||||||
Line <55>NOOP name test
|
Line <55>NOOP tab
|
||||||
Line <55>NOOP equal
|
Line <55>NOOP tab
|
||||||
Line <55>NOOP true true
|
Line <55>NOOP tab
|
||||||
|
Line <55>NOOP string test
|
||||||
Line <55>NOOP newline
|
Line <55>NOOP newline
|
||||||
Line <56>NOOP tab
|
Line <56>NOOP tab
|
||||||
Line <56>NOOP name test2
|
Line <56>NOOP tab
|
||||||
Line <56>NOOP number
|
Line <56>NOOP tab
|
||||||
Line <56>NOOP equal
|
Line <56>NOOP tab
|
||||||
Line <56>NOOP false false
|
Line <56>NOOP string $x$ $y$ $z$
|
||||||
Line <56>NOOP newline
|
Line <56>NOOP newline
|
||||||
Line <57>NOOP tab
|
Line <57>NOOP tab
|
||||||
|
Line <57>NOOP name test
|
||||||
|
Line <57>NOOP equal
|
||||||
|
Line <57>NOOP true true
|
||||||
Line <57>NOOP newline
|
Line <57>NOOP newline
|
||||||
Line <58>NOOP tab
|
Line <58>NOOP tab
|
||||||
Line <58>NOOP name count
|
Line <58>NOOP name test2
|
||||||
|
Line <58>NOOP number
|
||||||
Line <58>NOOP equal
|
Line <58>NOOP equal
|
||||||
Line <58>NOOP number 0
|
Line <58>NOOP false false
|
||||||
Line <58>NOOP newline
|
Line <58>NOOP newline
|
||||||
Line <59>NOOP tab
|
Line <59>NOOP tab
|
||||||
Line <59>NOOP newline
|
Line <59>NOOP newline
|
||||||
Line <60>NOOP tab
|
Line <60>NOOP tab
|
||||||
Line <60>WHLE control
|
|
||||||
Line <60>NOOP name count
|
Line <60>NOOP name count
|
||||||
Line <60>NOOP not
|
|
||||||
Line <60>NOOP equal
|
Line <60>NOOP equal
|
||||||
Line <60>NOOP number 100
|
Line <60>NOOP number 0
|
||||||
Line <60>NOOP newline
|
Line <60>NOOP newline
|
||||||
Line <61>NOOP tab
|
Line <61>NOOP tab
|
||||||
Line <61>NOOP tab
|
|
||||||
Line <61>NOOP name count
|
|
||||||
Line <61>NOOP plus
|
|
||||||
Line <61>NOOP plus
|
|
||||||
Line <61>NOOP newline
|
Line <61>NOOP newline
|
||||||
Line <62>NOOP tab
|
Line <62>NOOP tab
|
||||||
Line <62>NOOP tab
|
Line <62>WHLE control
|
||||||
Line <62>NOOP string Count = $count$
|
Line <62>NOOP name count
|
||||||
|
Line <62>NOOP not
|
||||||
|
Line <62>NOOP equal
|
||||||
|
Line <62>NOOP number 100
|
||||||
Line <62>NOOP newline
|
Line <62>NOOP newline
|
||||||
Line <63>NOOP tab
|
Line <63>NOOP tab
|
||||||
|
Line <63>NOOP tab
|
||||||
|
Line <63>NOOP name count
|
||||||
|
Line <63>NOOP plus
|
||||||
|
Line <63>NOOP plus
|
||||||
Line <63>NOOP newline
|
Line <63>NOOP newline
|
||||||
Line <64>NOOP tab
|
Line <64>NOOP tab
|
||||||
Line <64>IFFF control
|
Line <64>NOOP tab
|
||||||
Line <64>NOOP parao
|
Line <64>NOOP string Count = $count$
|
||||||
Line <64>NOOP name func
|
|
||||||
Line <64>NOOP parao
|
|
||||||
Line <64>NOOP number 123
|
|
||||||
Line <64>NOOP parac
|
|
||||||
Line <64>NOOP not
|
|
||||||
Line <64>NOOP equal
|
|
||||||
Line <64>NOOP name name
|
|
||||||
Line <64>NOOP bracketo
|
|
||||||
Line <64>NOOP number 1
|
|
||||||
Line <64>NOOP bracketc
|
|
||||||
Line <64>NOOP or
|
|
||||||
Line <64>NOOP true
|
|
||||||
Line <64>NOOP equal
|
|
||||||
Line <64>NOOP equal
|
|
||||||
Line <64>NOOP string Bob
|
|
||||||
Line <64>NOOP parac
|
|
||||||
Line <64>NOOP and
|
|
||||||
Line <64>NOOP name foodCount
|
|
||||||
Line <64>NOOP equal
|
|
||||||
Line <64>NOOP number 10.34
|
|
||||||
Line <64>NOOP newline
|
Line <64>NOOP newline
|
||||||
Line <65>NOOP tab
|
Line <65>NOOP tab
|
||||||
Line <65>NOOP tab
|
|
||||||
Line <65>NOOP string test=true or test2=false!
|
|
||||||
Line <65>NOOP number
|
|
||||||
Line <65>NOOP newline
|
Line <65>NOOP newline
|
||||||
Line <66>NOOP tab
|
Line <66>NOOP tab
|
||||||
Line <66>NOOP tab
|
Line <66>IFFF control
|
||||||
Line <66>NOOP string help me
|
Line <66>NOOP parao
|
||||||
|
Line <66>NOOP name func
|
||||||
|
Line <66>NOOP parao
|
||||||
|
Line <66>NOOP number 123
|
||||||
|
Line <66>NOOP parac
|
||||||
|
Line <66>NOOP not
|
||||||
|
Line <66>NOOP equal
|
||||||
|
Line <66>NOOP name name
|
||||||
|
Line <66>NOOP bracketo
|
||||||
|
Line <66>NOOP number 1
|
||||||
|
Line <66>NOOP bracketc
|
||||||
|
Line <66>NOOP or
|
||||||
|
Line <66>NOOP true
|
||||||
|
Line <66>NOOP equal
|
||||||
|
Line <66>NOOP equal
|
||||||
|
Line <66>NOOP string Bob
|
||||||
|
Line <66>NOOP parac
|
||||||
|
Line <66>NOOP and
|
||||||
|
Line <66>NOOP name foodCount
|
||||||
|
Line <66>NOOP equal
|
||||||
|
Line <66>NOOP number 10.34
|
||||||
Line <66>NOOP newline
|
Line <66>NOOP newline
|
||||||
Line <67>NOOP tab
|
Line <67>NOOP tab
|
||||||
Line <67>NOOP tab
|
Line <67>NOOP tab
|
||||||
Line <67>IFFF control
|
Line <67>NOOP string test=true or test2=false!
|
||||||
Line <67>NOOP name cool
|
Line <67>NOOP number
|
||||||
Line <67>NOOP equal
|
|
||||||
Line <67>NOOP equal
|
|
||||||
Line <67>NOOP true true
|
|
||||||
Line <67>NOOP newline
|
Line <67>NOOP newline
|
||||||
Line <68>NOOP tab
|
Line <68>NOOP tab
|
||||||
Line <68>NOOP tab
|
Line <68>NOOP tab
|
||||||
Line <68>NOOP tab
|
Line <68>NOOP string help me
|
||||||
Line <68>NOOP string We are here
|
|
||||||
Line <68>NOOP newline
|
Line <68>NOOP newline
|
||||||
Line <69>NOOP tab
|
Line <69>NOOP tab
|
||||||
Line <69>NOOP tab
|
Line <69>NOOP tab
|
||||||
Line <69>NOOP tab
|
Line <69>IFFF control
|
||||||
Line <69>NOOP string Nested if
|
Line <69>NOOP name cool
|
||||||
|
Line <69>NOOP equal
|
||||||
|
Line <69>NOOP equal
|
||||||
|
Line <69>NOOP true true
|
||||||
Line <69>NOOP newline
|
Line <69>NOOP newline
|
||||||
Line <70>NOOP tab
|
Line <70>NOOP tab
|
||||||
Line <70>NOOP tab
|
Line <70>NOOP tab
|
||||||
Line <70>ELIF control
|
Line <70>NOOP tab
|
||||||
Line <70>NOOP name food
|
Line <70>NOOP string We are here
|
||||||
Line <70>NOOP equal
|
|
||||||
Line <70>NOOP number 21
|
|
||||||
Line <70>NOOP newline
|
Line <70>NOOP newline
|
||||||
Line <71>NOOP tab
|
Line <71>NOOP tab
|
||||||
Line <71>NOOP tab
|
Line <71>NOOP tab
|
||||||
Line <71>NOOP tab
|
Line <71>NOOP tab
|
||||||
Line <71>NOOP string This is getting weird
|
Line <71>NOOP string Nested if
|
||||||
Line <71>NOOP newline
|
Line <71>NOOP newline
|
||||||
Line <72>NOOP tab
|
Line <72>NOOP tab
|
||||||
Line <72>NOOP tab
|
Line <72>NOOP tab
|
||||||
Line <72>NOOP string Hi
|
Line <72>ELIF control
|
||||||
|
Line <72>NOOP name food
|
||||||
|
Line <72>NOOP equal
|
||||||
|
Line <72>NOOP number 21
|
||||||
Line <72>NOOP newline
|
Line <72>NOOP newline
|
||||||
Line <73>NOOP tab
|
Line <73>NOOP tab
|
||||||
Line <73>ELIF control
|
Line <73>NOOP tab
|
||||||
Line <73>NOOP parao
|
Line <73>NOOP tab
|
||||||
Line <73>NOOP name func2
|
Line <73>NOOP string This is getting weird
|
||||||
Line <73>NOOP parao
|
|
||||||
Line <73>NOOP number 321
|
|
||||||
Line <73>NOOP parac
|
|
||||||
Line <73>NOOP not
|
|
||||||
Line <73>NOOP equal
|
|
||||||
Line <73>NOOP name name2
|
|
||||||
Line <73>NOOP bracketo
|
|
||||||
Line <73>NOOP number 1
|
|
||||||
Line <73>NOOP bracketc
|
|
||||||
Line <73>NOOP or
|
|
||||||
Line <73>NOOP true
|
|
||||||
Line <73>NOOP equal
|
|
||||||
Line <73>NOOP equal
|
|
||||||
Line <73>NOOP string Bob2
|
|
||||||
Line <73>NOOP number
|
|
||||||
Line <73>NOOP parac
|
|
||||||
Line <73>NOOP and
|
|
||||||
Line <73>NOOP name foodCount2
|
|
||||||
Line <73>NOOP number
|
|
||||||
Line <73>NOOP equal
|
|
||||||
Line <73>NOOP number 1.78
|
|
||||||
Line <73>NOOP newline
|
Line <73>NOOP newline
|
||||||
Line <74>NOOP tab
|
Line <74>NOOP tab
|
||||||
Line <74>NOOP tab
|
Line <74>NOOP tab
|
||||||
Line <74>NOOP string This Block
|
Line <74>NOOP string Hi
|
||||||
Line <74>NOOP newline
|
Line <74>NOOP newline
|
||||||
Line <75>NOOP tab
|
Line <75>NOOP tab
|
||||||
Line <75>NOOP name else
|
Line <75>ELIF control
|
||||||
|
Line <75>NOOP parao
|
||||||
|
Line <75>NOOP name func2
|
||||||
|
Line <75>NOOP parao
|
||||||
|
Line <75>NOOP number 321
|
||||||
|
Line <75>NOOP parac
|
||||||
|
Line <75>NOOP not
|
||||||
|
Line <75>NOOP equal
|
||||||
|
Line <75>NOOP name name2
|
||||||
|
Line <75>NOOP bracketo
|
||||||
|
Line <75>NOOP number 1
|
||||||
|
Line <75>NOOP bracketc
|
||||||
|
Line <75>NOOP or
|
||||||
|
Line <75>NOOP true
|
||||||
|
Line <75>NOOP equal
|
||||||
|
Line <75>NOOP equal
|
||||||
|
Line <75>NOOP string Bob2
|
||||||
|
Line <75>NOOP number
|
||||||
|
Line <75>NOOP parac
|
||||||
|
Line <75>NOOP and
|
||||||
|
Line <75>NOOP name foodCount2
|
||||||
|
Line <75>NOOP number
|
||||||
|
Line <75>NOOP equal
|
||||||
|
Line <75>NOOP number 1.78
|
||||||
Line <75>NOOP newline
|
Line <75>NOOP newline
|
||||||
Line <76>NOOP tab
|
Line <76>NOOP tab
|
||||||
Line <76>NOOP tab
|
Line <76>NOOP tab
|
||||||
Line <76>NOOP string That Block
|
Line <76>NOOP string This Block
|
||||||
Line <76>NOOP newline
|
Line <76>NOOP newline
|
||||||
Line <77>NOOP tab
|
Line <77>NOOP tab
|
||||||
Line <77>NOOP string ah this is why no pop
|
Line <77>NOOP name else
|
||||||
Line <77>NOOP newline
|
Line <77>NOOP newline
|
||||||
|
Line <78>NOOP tab
|
||||||
|
Line <78>NOOP tab
|
||||||
|
Line <78>NOOP string That Block
|
||||||
Line <78>NOOP newline
|
Line <78>NOOP newline
|
||||||
Line <79>NOOP bracketo
|
Line <79>NOOP tab
|
||||||
Line <79>NOOP name Bob
|
Line <79>NOOP string ah this is why no pop
|
||||||
Line <79>NOOP colon
|
|
||||||
Line <79>NOOP name char
|
|
||||||
Line <79>NOOP bracketc
|
|
||||||
Line <79>NOOP newline
|
Line <79>NOOP newline
|
||||||
Line <80>NOOP tab
|
|
||||||
Line <80>NOOP name age
|
|
||||||
Line <80>NOOP equal
|
|
||||||
Line <80>NOOP number 24
|
|
||||||
Line <80>NOOP newline
|
Line <80>NOOP newline
|
||||||
Line <81>NOOP tab
|
Line <81>NOOP bracketo
|
||||||
Line <81>NOOP name money
|
Line <81>NOOP name Bob
|
||||||
Line <81>NOOP equal
|
Line <81>NOOP colon
|
||||||
Line <81>NOOP number 100
|
Line <81>NOOP name char
|
||||||
|
Line <81>NOOP bracketc
|
||||||
Line <81>NOOP newline
|
Line <81>NOOP newline
|
||||||
Line <82>NOOP tab
|
Line <82>NOOP tab
|
||||||
|
Line <82>NOOP name age
|
||||||
|
Line <82>NOOP equal
|
||||||
|
Line <82>NOOP number 24
|
||||||
Line <82>NOOP newline
|
Line <82>NOOP newline
|
||||||
Line <83>NOOP bracketo
|
Line <83>NOOP tab
|
||||||
Line <83>NOOP name test
|
Line <83>NOOP name money
|
||||||
Line <83>NOOP colon
|
Line <83>NOOP equal
|
||||||
Line <83>NOOP name env
|
Line <83>NOOP number 100
|
||||||
Line <83>NOOP bracketc
|
|
||||||
Line <83>NOOP newline
|
Line <83>NOOP newline
|
||||||
Line <84>NOOP tab
|
Line <84>NOOP tab
|
||||||
Line <84>NOOP string test
|
|
||||||
Line <84>NOOP newline
|
Line <84>NOOP newline
|
||||||
|
Line <85>NOOP bracketo
|
||||||
|
Line <85>NOOP name test
|
||||||
|
Line <85>NOOP colon
|
||||||
|
Line <85>NOOP name env
|
||||||
|
Line <85>NOOP bracketc
|
||||||
Line <85>NOOP newline
|
Line <85>NOOP newline
|
||||||
Line <86>NOOP bracketo
|
Line <86>NOOP tab
|
||||||
Line <86>NOOP name newblock
|
Line <86>NOOP string test
|
||||||
Line <86>NOOP colon
|
|
||||||
Line <86>NOOP name function
|
|
||||||
Line <86>NOOP parao
|
|
||||||
Line <86>NOOP parac
|
|
||||||
Line <86>NOOP bracketc
|
|
||||||
Line <86>NOOP newline
|
Line <86>NOOP newline
|
||||||
Line <87>NOOP tab
|
|
||||||
Line <87>NOOP string Test #2
|
|
||||||
Line <87>NOOP number
|
|
||||||
Line <87>NOOP newline
|
Line <87>NOOP newline
|
||||||
Line <88>NOOP tab
|
Line <88>NOOP bracketo
|
||||||
Line <88>NOOP string Does it parse this part properly?
|
Line <88>NOOP name newblock
|
||||||
|
Line <88>NOOP colon
|
||||||
|
Line <88>NOOP name function
|
||||||
|
Line <88>NOOP parao
|
||||||
|
Line <88>NOOP parac
|
||||||
|
Line <88>NOOP bracketc
|
||||||
Line <88>NOOP newline
|
Line <88>NOOP newline
|
||||||
Line <90>NOOP eof
|
Line <89>NOOP tab
|
||||||
|
Line <89>NOOP string Test #2
|
||||||
|
Line <89>NOOP number
|
||||||
|
Line <89>NOOP newline
|
||||||
|
Line <90>NOOP tab
|
||||||
|
Line <90>NOOP string Does it parse this part properly?
|
||||||
|
Line <90>NOOP newline
|
||||||
|
Line <92>NOOP eof
|
||||||
|
|||||||
99
DMS/test.dms
99
DMS/test.dms
@ -1,87 +1,94 @@
|
|||||||
entry main
|
entry main
|
||||||
enable warnings
|
enable warnings
|
||||||
|
disable omniscient
|
||||||
//enable debugging
|
//enable debugging
|
||||||
//loadfile "loadtest.dms"
|
//loadfile "loadtest.dms"
|
||||||
version 1.2
|
version 1.2
|
||||||
using extendedDefine
|
using extendedDefine
|
||||||
|
[default:char]
|
||||||
|
// The default stats for all characters.
|
||||||
|
money = 0
|
||||||
[Ryan:char]
|
[Ryan:char]
|
||||||
age = 21
|
age = 21
|
||||||
money = 1000
|
money = 1000
|
||||||
|
// Inside a character block this syntax defines animation/image file for an emotion
|
||||||
|
calm: "./path/to/file"
|
||||||
|
excited: "./path/to/file"
|
||||||
|
|
||||||
[step:function(a,b,c)]
|
[step:function(a,b,c)]
|
||||||
"Testing..."
|
"Testing..."
|
||||||
d = (100 + b) / c
|
d = (100 + b) / c
|
||||||
|
e = "somestring"
|
||||||
e = nil
|
e = nil
|
||||||
f = true
|
|
||||||
g = false
|
g = false
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
[inventory:env]
|
||||||
|
slot1 = ""
|
||||||
|
slot2 = ""
|
||||||
|
slot3 = ""
|
||||||
|
slot4 = ""
|
||||||
|
slot5 = ""
|
||||||
|
slot6 = ""
|
||||||
|
slot7 = ""
|
||||||
|
slot8 = ""
|
||||||
|
|
||||||
[main]
|
[main]
|
||||||
"This works!"
|
Ryan: "This works!"
|
||||||
"What's up"
|
DEBUG "What's up" // Debug lines are removed when debug mode is disabled
|
||||||
|
Ryan:
|
||||||
Ryan "Hello \"how\" are you doing?" // this is a comment
|
speed 100%
|
||||||
Bob "I'm good you?"
|
calm "Hello Bob, "
|
||||||
|
wait 0.455
|
||||||
|
excited "how are you doing?"
|
||||||
|
// Becomes: Hello Bob, how are you doing?
|
||||||
|
|
||||||
tester = "Hello"
|
tester = "Hello"
|
||||||
|
|
||||||
food = 3
|
food = 3
|
||||||
|
|
||||||
hi = {1,2,3}
|
|
||||||
|
|
||||||
list = {{1,2+food,hi[3]},true,tester,123,"This is a string!",false, {3,2,1}}
|
|
||||||
a = list[1]
|
a = list[1]
|
||||||
|
|
||||||
hungry = (-2+4-((5*5)/sqrt(144+5)))^2*2+2
|
hungry = (-2+4-((5*5)/sqrt(144+5)))^2*2+2
|
||||||
list[1] = "Hello"
|
list[1] = "Hello"
|
||||||
var1,var2 = func(1,"string", 2+5)
|
var1 = func(1,"string", 2+5)
|
||||||
a = 100 + func(1,"string", 2+5) + 100
|
a = 100 + func(1,"string", 2+5) + 100
|
||||||
func(1,"string", 2+5)
|
func(1,"string", 2+5)
|
||||||
::label::
|
::label::
|
||||||
//Hello im testing stuff
|
//Hello im testing stuff
|
||||||
|
|
||||||
CHOICE "Pick one:"
|
if statment then
|
||||||
|
"test"
|
||||||
|
elseif statement then
|
||||||
|
"test"
|
||||||
|
if statement then
|
||||||
|
"test"
|
||||||
|
"test"
|
||||||
|
if statement then
|
||||||
|
"test"
|
||||||
|
else
|
||||||
|
"test"
|
||||||
|
elseif statement then
|
||||||
|
"test"
|
||||||
|
else
|
||||||
|
"test"
|
||||||
|
|
||||||
|
goto "somewhere"
|
||||||
|
jump "overhere"
|
||||||
|
|
||||||
|
CHOICE "Pick one:" {
|
||||||
"first" func()
|
"first" func()
|
||||||
"second" func()
|
"second" func()
|
||||||
"third" func()
|
"third" func()
|
||||||
"forth" func()
|
"forth" func()
|
||||||
|
"fifth" goto "here"
|
||||||
|
"sixth" goto name
|
||||||
|
"sevinth" jump "there"
|
||||||
|
"eight" jump name
|
||||||
|
}
|
||||||
|
|
||||||
for x = 1,10
|
|
||||||
for y = 1,10,1
|
|
||||||
for z = 1,10
|
|
||||||
"test"
|
|
||||||
"$x$ $y$ $z$"
|
|
||||||
test = true
|
|
||||||
test2 = false
|
|
||||||
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
while count != 100
|
|
||||||
count++;
|
|
||||||
"Count = $count$"
|
|
||||||
|
|
||||||
if (func(123)!=name[1] or true == "Bob") and foodCount >= 10.34
|
|
||||||
"test=true or test2=false!"
|
|
||||||
"help me"
|
|
||||||
if cool == true
|
|
||||||
"We are here"
|
|
||||||
"Nested if"
|
|
||||||
elseif food >= 21
|
|
||||||
"This is getting weird"
|
|
||||||
"Hi"
|
|
||||||
elseif (func2(321)!=name2[1] or true == "Bob2") and foodCount2 >= 1.78
|
|
||||||
"This Block"
|
|
||||||
else
|
|
||||||
"That Block"
|
|
||||||
"ah this is why no pop"
|
|
||||||
|
|
||||||
[Bob:char]
|
[Bob:char]
|
||||||
age = 24
|
age = 24
|
||||||
money = 100
|
money = 100
|
||||||
|
|
||||||
[test:env]
|
|
||||||
"test"
|
|
||||||
|
|
||||||
[newblock:function()]
|
[newblock:function()]
|
||||||
"Test #2"
|
"Test #2"
|
||||||
|
|||||||
@ -38,6 +38,7 @@ namespace dms::tokens {
|
|||||||
eof,
|
eof,
|
||||||
ret,
|
ret,
|
||||||
gotoo,
|
gotoo,
|
||||||
|
jump,
|
||||||
nil
|
nil
|
||||||
};//stream, t_vec, line, isNum, buffer
|
};//stream, t_vec, line, isNum, buffer
|
||||||
struct token {
|
struct token {
|
||||||
@ -95,6 +96,7 @@ namespace dms::tokens {
|
|||||||
"eof",
|
"eof",
|
||||||
"ret",
|
"ret",
|
||||||
"gotoo",
|
"gotoo",
|
||||||
|
"jump",
|
||||||
"nil"
|
"nil"
|
||||||
};
|
};
|
||||||
out << "Line <" << c.line_num << ">" << codes::list[c.raw] << " " << temp1[c.type] << " \t\t " << c.name;
|
out << "Line <" << c.line_num << ">" << codes::list[c.raw] << " " << temp1[c.type] << " \t\t " << c.name;
|
||||||
|
|||||||
BIN
Debug/DMS.exe
BIN
Debug/DMS.exe
Binary file not shown.
BIN
Debug/DMS.ilk
BIN
Debug/DMS.ilk
Binary file not shown.
BIN
Debug/DMS.pdb
BIN
Debug/DMS.pdb
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user