BuildYourOwnLisp icon indicating copy to clipboard operation
BuildYourOwnLisp copied to clipboard

Reverse Polish notation expressions

Open GeriatricJacob opened this issue 6 years ago • 1 comments

How could I have reverse polish notation expressions in my language? expr : <number> | <expr>+ <operator> ; Results in error: Maximum recursion depth exceeded!

GeriatricJacob avatar Dec 13 '19 08:12 GeriatricJacob

You forget ‘(‘ and ‘)’ at the beginning and the end of expr, don’t you? Since your regex contains left-recursion (https://en.m.wikipedia.org/wiki/Left_recursion), the parser goes into infinite-loop! :(

kumachan-mis avatar Mar 19 '20 03:03 kumachan-mis