diff --git a/version0.6/ebnf.cpp b/version0.6/ebnf.cpp index d3ecb4b..ef9884b 100644 --- a/version0.6/ebnf.cpp +++ b/version0.6/ebnf.cpp @@ -45,9 +45,11 @@ data type = <(> | <)> <{> <}> <1> ::= <=> |||| <;> + <=> <(> |||| <)> <;> <=> <1> ::= <=> |||| <;> + <=> <(> |||| <)> <;> ::= <(>> | |||| <;> diff --git a/version0.6/finished.txt b/version0.6/finished.txt index dde89cd..a70664c 100644 --- a/version0.6/finished.txt +++ b/version0.6/finished.txt @@ -19,4 +19,6 @@ if(!e.e)e; var e=e.e("str",1).e()*e.e("str",1).e*0.001; e.e("str",1).e("str",e-e); e.e(e("str",e.e()/2880)~"str"); -var e=func(){e;}; \ No newline at end of file +var e=func(){e;}; +var e=e+e-e; +var e=e+e+e+e; diff --git a/version0.6/main.cpp b/version0.6/main.cpp index c324686..0c11dee 100644 --- a/version0.6/main.cpp +++ b/version0.6/main.cpp @@ -7,8 +7,10 @@ int main() nasal_lexer lex; nasal_parser par; std::string command; - std::cout<<">> nasal-- script by ValKmjolnir"<> nasal script interpreter by ValKmjolnir"<> input \"help\" to find help."<> Be careful: this interpreter uses strict methods to check if there's an error."<> "; diff --git a/version0.6/nasal_parser.h b/version0.6/nasal_parser.h index 4ed3d59..200e415 100644 --- a/version0.6/nasal_parser.h +++ b/version0.6/nasal_parser.h @@ -451,7 +451,7 @@ class nasal_parser temp.pop(); } - if((tbl[2]!=__scalar) && (tbl[2]!=__identifier) && ((tbl[1]==__sub_operator) || (tbl[1]==__add_operator)) && (tbl[0]==__identifier)) + if((tbl[2]!=__scalar) && (tbl[2]!=__identifier) && (tbl[2]!=__calculation) && ((tbl[1]==__sub_operator) || (tbl[1]==__add_operator)) && (tbl[0]==__identifier)) { parse_unit t; t.type=__identifier; @@ -759,9 +759,9 @@ class nasal_parser } bool definition_check() { - int tbl[5]={0}; + int tbl[7]={0}; std::stack temp; - for(int i=0;i<5;++i) + for(int i=0;i<7;++i) { if(parser.empty()) break; @@ -769,7 +769,7 @@ class nasal_parser tbl[i]=temp.top().type; parser.pop(); } - for(int i=0;i<5;++i) + for(int i=0;i<7;++i) { if(temp.empty()) break; @@ -786,6 +786,16 @@ class nasal_parser parser.push(t); return true; } + else if((tbl[6]==__var) && (tbl[5]==__identifier) && (tbl[4]==__equal) && (tbl[3]==__left_curve) && ((tbl[2]==__identifier) || (tbl[2]==__scalar) || (tbl[2]==__list) || (tbl[2]==__hash) || (tbl[2]==__calculation)) && (tbl[1]==__right_curve) && (tbl[0]==__semi)) + { + parse_unit t; + t.type=__definition; + t.line=parser.top().line; + for(int i=0;i<7;++i) + parser.pop(); + parser.push(t); + return true; + } else if((tbl[3]=__var) && (tbl[2]==__identifier) && (tbl[1]==__equal) && (tbl[0]==__function)) { parse_unit t; @@ -800,9 +810,9 @@ class nasal_parser } bool assignment_check() { - int tbl[4]={0}; + int tbl[6]={0}; std::stack temp; - for(int i=0;i<4;++i) + for(int i=0;i<6;++i) { if(parser.empty()) break; @@ -810,7 +820,7 @@ class nasal_parser tbl[i]=temp.top().type; parser.pop(); } - for(int i=0;i<4;++i) + for(int i=0;i<6;++i) { if(temp.empty()) break; @@ -830,6 +840,18 @@ class nasal_parser parser.push(t); return true; } + else if((tbl[5]==__identifier) && ((tbl[4]==__equal) || (tbl[4]==__add_equal) || (tbl[4]==__sub_equal) + || (tbl[4]==__mul_equal) || (tbl[4]==__div_equal) || (tbl[4]==__link_equal)) + && (tbl[3]==__left_curve) && ((tbl[2]==__identifier) || (tbl[2]==__scalar) || (tbl[2]==__list) || (tbl[2]==__hash) || (tbl[2]==__calculation)) && (tbl[1]==__right_curve) && (tbl[0]==__semi)) + { + parse_unit t; + t.type=__definition; + t.line=parser.top().line; + for(int i=0;i<6;++i) + parser.pop(); + parser.push(t); + return true; + } return false; } bool function_def() diff --git a/version0.6/remainbug.txt b/version0.6/remainbug.txt index 077bc08..ec747fa 100644 --- a/version0.6/remainbug.txt +++ b/version0.6/remainbug.txt @@ -1 +1 @@ -null +null \ No newline at end of file