[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: No parser generated in 2.5?
I think that I now see your "problem".
You are saying that no parser is generated when there is no "Productions"
section in a grammar.
This is true, indeed. It is intended to be this way. It lets you write a
"stand-alone" lexer using SableCC. This is needed, for example, for writing
a complete Java lexer. You need 2 layers of lexers. One for dealing with
Unicode escapes, and the second to scan the "Unicode escape preprocessed"
stream.
Another interesting way of using SableCC is to generate a "stand-alone"
parser. This is achieved by defining "Tokens" as follows:
Tokens
token1 = ;
token2 = ;
token3 = ;
token4 = ;
...
Productions
grammar = token1 ...;
...
To use the parser, you need to write a customized Lexer class that does the
scanning. The default provided lexer does nothing;-)
Etienne
-----Original Message-----
From: Philip Estes <estesp@austin.ibm.com>
To: sablecc-list@sable.McGill.CA <sablecc-list@sable.McGill.CA>
Date: September 17, 1998 11:48 PM
Subject: Re: No parser generated in 2.5?
>
>Yes, I had tried that. It just didn't seem like an error condition
>since there was no warning or output at all..just a quiet exit from
>SableCC. I ran it through jdb and found that in
>ca.mcgill.sable.sablecc.GenParser.java in caseStart1() method that
>hasProductions is equal to false, which looks like it is only set if
>outProd1 method is called. I didn't look any further than this, other
>than to look at 2.1 code to see if it was any different..looks mostly
>the same as far as how that code path runs in GenParser.java. Any
>thoughts or suggestions? I noticed that grammar.txt and unicode.txt
>are quite larger now than in 2.0/2.1 SableCC. Anyway, since
>hasProductions boolean is false it does not generate a Parser, just
>returns to caller and then quietly exits.
>
>Phil
>
>>Have you tried using the "-mx1024m" argument, e.g.:
>>
>>java -mx1024m SableCC grammar.txt
>>
>>Because, if you didn't, the Java VM might have run out of memory. (By
>>default, it does not use anymore than 16 Megs).
>>
>>Etienne