project-langx / X

A placeholder language with shareable bytecode IR.
2 stars 0 forks source link

Fix expr parsing #1

Closed frankhart2018 closed 3 years ago

frankhart2018 commented 3 years ago

expr -> string is a very näive grammar. Convert it to a full scale grammar, refer:- http://www2.lawrence.edu/fast/GREGGJ/CMSC270/parser/parser.html

The grammar will be:

expr -> sum
sum -> mul (+|- mul)
mul -> factor (*|/ factor)
factor -> term
term -> string | number