Replace object parser with lalr library

This commit is contained in:
Ilusha 2024-03-07 12:33:46 +03:00
parent 3ba4bef93b
commit f666416696
13 changed files with 499 additions and 995 deletions

View file

@ -0,0 +1,33 @@
oscript {
%whitespace "[ \t\r\n]*";
scope:
'{' statements '}' [scope]
| ;
statements:
statements ';' statement ';' [stm_scope_append]
| statement [stm_scope_create]
| ;
statement:
statementVar [tmp]
| statementLog [tmp];
statementVar: 'var' id [stm_defVar];
statementLog: 'print' value [stm_log];
value:
boolean [expr_bool]
| integer [expr_int]
| real [expr_float]
| string [expr_string]
|
;
id: "[a-z]";
boolean: "true|false";
integer: "(\+|\-)?[0-9]+";
real: "(\+|\-)?[0-9]+(\.[0-9]+)?((e|E)(\+|\-)?[0-9]+)?";
string: "[\"']:string:";
}