[antlr-interest] Re: interactive envionments and non-delayed rule reduction
Monty Zukowski
monty at codetransform.com
Wed Aug 4 07:15:15 PDT 2004
On Aug 3, 2004, at 8:41 PM, Richard Clark wrote:
>
> On Aug 3, 2004, at 19:46, Monty Zukowski wrote:
>
>> Then my suggestion will work. Parse a single line, if it fails wait
>> for the next line, put them together and try again.
>
> Um, Monty, are you sure? I've been thinking about this and wondering
> how I'd structure it if I did this.
>
> Try this scenario:
>
> (3 + 4
> )
> *5
>
> The first (3+4 throws a RecognitionException (incomplete expression).
> Adding the ) makes it OK. But then *5 throws a recognition expression,
> and no number of added lines will fix it.
>
> I wonder if this would work: leave the EOL tokens in and use them to
> mark the end of an expression. If you get a recognition expression, and
> the token is an EOL, append the next line and retry the whole thing. If
> you get a recognition expression and the token is _not_ an EOL, report
> and error and flush the input buffer.
>
> What do you think?
>
>
I think I already asked Valery about that scenario. It's supposed to
fail on the *5.
>> What do you do if they type this?
>>
>> (3 + 4)
>> *5
>
> (3+4) ==> reduce, and calculate
>
> then
>
> *5 --> error
>
> It is very similar to what we have in R or, say, in Scheme.
Monty
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