Re: BNF to Wisent grammar converter

"Eric M. Ludlam" <[email protected]>
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
I know I hadn't worked on an indent engine via semantic because the 
existing system has kept me busy enough. ;)   In addition, the current 
wisent grammars (except java) all stop parsing at the { of the functions 
and don't go inside.  Most code you want to indent is in there, and 
expanding the parsers for that will be a big task.

It is possible to incrementally parse via wisent.  Since the semantic 
grammars all create and store tags, the tag information is used to wrap 
edited code into easily reparsed unit.  See semantic/edit.el for the 
incremental reparse engine.  If you have a tag, it is also easy to do 
the local parsing separate from the outer parsing.  See semantic/ctxt 
for examples of that in get-local-variables.

It would probably be easy to start by writing an wisent grammar for 
writing BNF, and  then you could use the existing srecoder tool to write 
out a wisent grammar.  I haven't tried it, but the other recoder macros 
for C++ etc were pretty easy once the system was in there.  I'd be happy 
to help out with the recoder system.  It isn't heavily used so the doc 
is a bit sparse.

Eric

On 09/11/2014 12:35 AM, Brian J Mingus wrote:
> I'm interested in a more automagic solution to code indentation (in
> particular, CoffeeScript). There is the recently released 'wisi' tool
> that takes a wisent grammar and produces an indentation library although
> it's not clear to me how complex it will be to use it.
>
> The biggest issue I see is that a straightforward BNF -> Wisent
> converter would result in batch but not incremental parsing, which would
> be slow for large files, giving a big advantage to heuristic-based systems.
>
> Still, I'm not convinced that this problem can't be solved once and for
> all for all programming languages. Provide a BNF grammar, get an
> indenter with plenty of options. Why doesn't this exist?
>
> On Wed, Sep 10, 2014 at 8:38 PM, Eric M. Ludlam <[email protected]
> <mailto:[email protected]>> wrote:
>
>     On 09/05/2014 01:56 PM, Brian J Mingus wrote:
>
>         Hi all,
>
>         Where can I find a converter from BNF to the wisent grammar format?
>
>
>     Hi,
>
>     There is no handy converter, though I know several grammars have
>     been converted by hand with little effort.
>
>     In the good old days there was a pun in CEDET where the .bnf grammar
>     files were "bovine normal form", but that has long since been removed.
>
>     Creating such a thing would be a fun project for someone.
>
>     Eric
>
>

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.