[antlr-interest] Problems with first example

Bill Ramsay RamsayW1 at comcast.net
Mon Dec 21 13:49:26 PST 2009


Actually, I figured out what was the problem.   I typed in the example 
phrase, but it required an end of file (Cntl D) along with the enter 
key.    It was waiting for me to close the input.

It works great now.   (A small beginning, but I have great expectations!)


Terence Parr wrote:
> and don't forget hitting ctrl-z for EOF if you're a PC person or 
> ctrl-d if you're a unix guy, as gawd intended ;)
> Ter
> On Dec 21, 2009, at 6:30 AM, John B. Brodie wrote:
>
>> Greetings!
>> On Mon, 2009-12-21 at 09:08 -0500, Bill Ramsay wrote:
>>> Hello,
>>>
>>> I'm new to Antlr and am trying to work through the Definitive 
>>> Guide.   I can't seem to get the first example to work.
>>> I create the .g file and lexer and parser classes fine.   I compile 
>>> my example test program fine.   And it runs fine.  Except for one 
>>> minor problem - it doesn't work.   I put a few debug lines in the 
>>> code and  it gets hung up on the line:
>>>
>>>    ANTLRInputStream input = new ANTLRInputStream(System.in);
>>>
>>> It never seems to move past this line.   The code used is copied 
>>> from the book,page 10 - 12.
>>
>> System.in is java-speak for the standard input device which, unless you
>> have redirected it, is your keyboard.
>>
>> So this line is establishing a I/O connection with the keyboard in order
>> to read in text to be parsed.
>>
>> It would seem that everything is working just fine.
>>
>> You simply need to type some text into your keyboard so that the example
>> grammar may parse it for you (or re-direct stdin to a disk file).
>>
>> Hope this helps...
>>   -jbb
>>
>>
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: 
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>



More information about the antlr-interest mailing list