[antlr-interest] Step-by-Step parsing

Pablo H paox75 at gmail.com
Mon Dec 10 05:28:24 PST 2007


Thank you Harald !

On Dec 8, 2007 11:04 AM, Harald Mueller <harald_m_mueller at gmx.de> wrote:

> Hi -
>
> this is what is called "(computation of) follow sets" in parsing
> terminology; and ANTLR internally certainly does this - however, as far as
> I(!) know and have seen in the generated code, not for public use, but for
> its internal code generation only; with ANTLR3's LL(*) analysis, I would
> guess that at times it does not even compute good(?) old "follow sets", but
> "follow graphs", which are not that useful for you.


I (I!) would start that project from scratch - and restrict myself to a
> simple grammar definition syntax, not ANTLR's full fledged machinery - with
> e.g. its syntactic predicates, multiple ways to specify tokens (names and
> strings), additional syntax for AST generation(^) and executable code(nested
> {...}s) etc. Only when that project starts getting "large," you would/could
> contribute to ANTLR to make follow sets visible.
>

I have read about computation of follow sets, and, now, I have a clear idea
of how to obtain them from scratch.

I am starting to consider programming the simplifier parser generator that
you suggest me. I was browsing antlr source code, and I can not find how to
obtain the follow-set interface. However, I have found two classes (
antlr.tool.Interpreter and antlr.tool.RandomPhrase) that might hint me how
to build these follow-sets using antlr. At this time, I am trying to devise
how to adapt both classes to make a step-by-step parsing, although, I do not
know yet if it is possible.

>
> Otherwise, you need an "ANTLR internals guru" (e.g. Terence!) who'd show
> you around the guts of ANTLRs to make the follow-set-interface publicly
> useable.
>

I have seriously lack of ANTLR internals, so any comment, hint,
suggestion... will be well received.

Many thanks

>
> Regards
> Harald
>
> -------- Original-Nachricht --------
> > Datum: Fri, 7 Dec 2007 15:09:26 +0000
> > Von: "Pablo H" <paox75 at gmail.com>
> > An: antlr-interest at antlr.org
> > Betreff: [antlr-interest] Step-by-Step parsing
>
> > Hi everybody,
> >
> > I am newbie in parser generator tools. I have just downloaded antlr and
> I
> > have made some basic examples. I would like to know how to use antlr for
> > parsing a grammar step-by-step. My goal is to develop a program that,
> > given
> > that a particular state of the parsing processing, it returns the list
> of
> > candidate tokens. For example, given that the following grammar:
> >
> > S : 'a' A 'c' B ;
> > A : ('b')* | 'c' ;
> > B : ('d')+ ;
> >
> > if the parser has already recognized "abb", calling the function
> > getCandidateList() will return "b c".
> >
> > May you provide me some hints?
> >
> > Thank very much in advance
>
> --
> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
> Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
>



-- 
Pablo Haya Coll
<a href="http://rincon.uam.es/dir?cw=230957031250000">e-card</a>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071210/77e40de5/attachment.html 


More information about the antlr-interest mailing list