help-bison
[Top][All Lists]
Advanced

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

Re: Interactive continuation prompting


From: Hans Aberg
Subject: Re: Interactive continuation prompting
Date: Wed, 25 Jun 2014 23:00:10 +0200

On 19 Jun 2014, at 04:53, Grant McKenzie <address@hidden> wrote:

> I would eventually like to implement a simple command line interface to my 
> little language. I understand that I can set yyin to some stream that I 
> control from as-yet-to-be-implemented command line interface. That interface 
> would also manage command line history etc.  I'm struggling to understand 
> however how bash / python style continuation prompting would work ( e.g. 
> python sets it's prompt in an interactive session to '...' when syntax is 
> incomplete ). In order to be able to manage these prompts, I somehow need to 
> send an indication from bison to flex to my interface that syntax is 
> incomplete.

> 1. use the push-parser design described here 
> http://www.gnu.org/software/bison/manual/html_node/Push-Decl.html

If you want your interpreter to read and interact token-by-token, then you 
should use the push parser. If you further want to show correct token 
completions, then an LR(1) parser should be used: the Bison default is LALR(1), 
which has states compacted in such a away that though the parsing is always 
correct, there may be some actions issued before one arrives at the state with 
the correct token completion. Further, the token information in the .output 
file is not explicit in the parsing tables, so that must be extracted somehow.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]