Pasukon-简单的JavaScript解析器生成器

2020-09-02 11:27:51

Lex Match Number/[0-9]+(?:\.[0-9]+)?/Match plus';+';Match减去';--';Match Time';*';Match DIV';/';Match POPEN';(';Match PCLOSE';)';忽略空格/^\s+//lexadd|(减法为:lhs)。返回$.lhs+$.rhs';|减法;减法|(乘法为:lhs)THEN:减去THEN(乘法为:RHS)|&>;返回$.lhs-$.rhs';|乘法;乘法|(除法为:LHS)THEN:乘以THEN(除法为:RHS)|&>&39;返回$.lhs*$.rhs&39;|除法;除法。RETURN$.lhs/$.rhs';|表达式;表达式|:POPEN THEN(添加为:EXPR)THEN:PCLOSE|&>;';RETURN$.EXPR';|NUMBER;NUMBER|:NUMBER';RETURN+$1';;START|ADDITION;