We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PlayWithCompiler/lab/craft/SimpleCalculator.java
Line 224 in 4aaaf03
根据 mul -> mul * pri | pri 这里需要递归调用multiplicative()方法,否则只能解析 2 * 3 ,而无法解析 234*5…… 调整为如下可以解决问题 SimpleASTNode child2 = multiplicative(tokens);
The text was updated successfully, but these errors were encountered:
从上面的BNF看,mul表达式也会产生左递归问题,需要想处理 add 表达式那样,改写语法规则,即 mul -> mul '' pri | pri mul -> pri mul' mul -> '' pri mul' 使用EBNF格式,则为: mul -> pri ( '*' pri) *
Sorry, something went wrong.
+1
No branches or pull requests
PlayWithCompiler/lab/craft/SimpleCalculator.java
Line 224 in 4aaaf03
根据 mul -> mul * pri | pri
这里需要递归调用multiplicative()方法,否则只能解析 2 * 3 ,而无法解析 234*5……
调整为如下可以解决问题
SimpleASTNode child2 = multiplicative(tokens);
The text was updated successfully, but these errors were encountered: