前缀表示法的解析器如何检测到丢失的乘法符号? [英] How does a parser for the infix notation detect the missing multiplication sign?
本文介绍了前缀表示法的解析器如何检测到丢失的乘法符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I am writing a parser that parses mathematical expressions based on a syntax diagram very similar to this one.
我还没有找到一种处理丢失的乘法符号的方法(例如在3(x+y)
中).我必须在语法图中的哪里处理?
I have not found a way to handle a missing multiplication sign (for example in 3(x+y)
). Where in the syntax diagram do I have to handle this?
推荐答案
您可以在term
的定义中将*
设置为可选.
You'd make the *
optional in the definition of term
.
ASCII图:
o-->-->--[factor]->-->--o
/ \
\ /
---<--[*]--<---
\ /
--<--
这篇关于前缀表示法的解析器如何检测到丢失的乘法符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文