How can I determine a given grammar can be parsed by yacc?

"Bin Chen" <>
14 Mar 2007 14:34:05 -0400

          From comp.compilers

Related articles
How can I determine a given grammar can be parsed by yacc? (Bin Chen) (2007-03-14)
| List of all articles for this month |

From: "Bin Chen" <>
Newsgroups: comp.compilers
Date: 14 Mar 2007 14:34:05 -0400
Organization: Compilers Central
Keywords: parse, question
Posted-Date: 14 Mar 2007 14:34:05 EDT


I want to write a fast and secure SIP protocol[1] 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)[2]. 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]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.