[antlr-interest] interactive envionments and non-delayed rule reduction

Monty Zukowski monty at codetransform.com
Mon Aug 2 09:34:54 PDT 2004


Feed the parser one complete line at a time using a StringStream or 
equivalent.  Then the end of the line will really be EOF and ANTLR will 
know that no more is coming.

Monty

On Aug 2, 2004, at 5:18 AM, Neurosurg wrote:

> Hi all,
>
> in interactive environments, the input expression should be
> parsed and evaluated right after, say, the enter is pressed.
> Parser is not expected to wait for the further following input.
> This is not what we get if we consider in the pasted below
> grammar taken after calc.g from antlr examples.
> After the first expression is provided, semicolon is given
> and even end-of-line (EOL) is entered -- still no reduction
> according to expr rule is done. The output is given only
> after some next expression is given.
>
> ----------------------------------
> top
> 	: (expr)*
> 	;
>
> expr	:	mexpr (PLUS^ mexpr)* SEMI! EOL {
> 			CalcTreeWalker walker;
> 			float r = walker.expr(#expr);
> 			std::cout << "value is " << r << std::endl;
> 	}
> 	;
>
> mexpr	:	atom (STAR^ atom)* ;
>
> atom:	INT ;
> ----------------------------------
>
> any good hints/links?
> (RTFMed, STFWed, sorry if missed smth)
> thanks,
> Valery
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list