当前位置: 动力学知识库 > 问答 > 编程问答 >

Anything wrong with reusing a subset of terminals already used in BNF for an LR lex/parser?

问题描述:

Please excuse my terminology as I am still getting my head wrapped around everything. I am trying to put together my first parser and have trying to find as many examples as I can to in trying to build my grammar. I've seen many situations where a non-termianal gets multiplie productions

<F>::=(<E>)

<F>::=id

Which is the same as writing

<F>::id|(<E>)

From everything I've read, this is perfectly fine. What I am looking to do is the following

<atsign>::[email protected]

<expl>::=!

<special>::=!|@|#|$|%|^|&|*|(|)|+

Is there anything I need to be mindful of? Is my ordering correct for an LR parser? This isn't exactly homework as I am not in school at the moment, but it can be treated as such since I know this is a course I'll be taking in the future.

分享给朋友:
您可能感兴趣的文章:
随机阅读: