[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sablecc grammar (help!)


Just a comment.

I have seen many postings on the comp.compilers newsgroups to the effect
that it is difficult to write an LALR(1) HTML grammar.

The current version of SableCC (2.x) is rather ill suited for "debugging"
huge grammars, such as HTML, COBOL, or C++. This is because the parser
generation process is slow (even though the generated parser is fast). A
fast version of YACC (like Bison on Linux/Unix) is better suited for the
non-LALR(1) -> LALR(1) grammar conversion/debugging. Once such a grammar is
obtained, then SableCC is ideal for constructing the AST.

I strongly suggest that you try to find an existing LALR(1) grammar for
HTML. You can search YAHOO or the com.compilers archives at
http://www.iecc.com/compilers (there is a link somewhere on it to an FTP
site with many grammars for YACC/Bison).

If you find an impure grammar (that uses precedence declarations, for
example), you will have to unfold the grammar and make the precedence
explicit, like it is done in the Java grammar.

Work is being done on SableCC to extend it's parsing capabilities beyond
"pure LALR(1)".


-----Original Message-----
From: Jenny Lam <jlam@sojournlabs.com>
To: sablecc-list@sable.mcgill.ca <sablecc-list@sable.mcgill.ca>
Date: Monday, August 10, 1998 7:16 PM
Subject: sablecc grammar (help!)

>I written a small grammar file defining html tags.  When I ran it through
>Sablecc, got an error message saying "...parser.parserException: [63,2]
>TIgnored TProductions TLBrace TId *EOF* expected."  I am assuming [63, 2]
>is refering to line 63 of the grammar file.  I looked at that and change a
>couple of things, but still getting the same error.  Any help will be
>greatly appreciated.  Grammar file attached.