|How can I determine a given grammar can be parsed by yacc? firstname.lastname@example.org (Bin Chen) (2007-03-14)|
|From:||"Bin Chen" <email@example.com>|
|Date:||14 Mar 2007 14:34:05 -0400|
|Posted-Date:||14 Mar 2007 14:34:05 EDT|
I want to write a fast and secure SIP protocol parser, and I want
the yacc can be a choice. But I am quite not familiar about parsing,
so I ask here to seek your kind help.
The SIP grammar are described in section 25 Augmented BNF for the SIP
Protocol, RFC3261, with its augumented BNF(ABNF). Many people told
me that the ABNF can't be parsed by yacc, but I want to know why. As
in my understanding, whether the yacc can parse is decided by the
grammar(LALR(1)), does LALR has some relation to ABNF?
More generic, I want to know how to decide a given grammar is LALR(1)?
Thanks in advance.
[LALR is basically a subset of BNF. The easiest way to find out if a
particular grammar is LALR is to run it through a parser generator and
see if it can generate a parser. It is often possible to rewrite ABNF
and BNF grammars so they are LALR, but it can be tedious. -John]
Return to the
Search the comp.compilers archives again.