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

Re: Anybody listening?



Thanks for that. I've got most of it, but the [foo]:bar concept wasn't
explained in the thesis in chapters 2 or 3. Is there a reference manual I am
missing? Is the thesis all there is at the moment? I had the idea of writing
a manual which is easier reading than Etienne's Master's thesis, once I got
the hang of it.

Anyway, [left]:something and [right]:something doesn't seem to be all one
can put in these square brackets to distinguish two of the same type used in
a single production. I'll quote here from the sample minibasic grammar:

    {for}        for identifier assign [from_exp]:expression to
[to_exp]:expression [nl1]:new_line
                   statements
                 next [nl2]:new_line |

...

I don't see from_exp, to_exp, nl1 or nl2 defined anywhere. So does this mean
that they are "made up" just to distinguish parts which appear twice, and
simply serve to give a name to the nodes when referring to them in the Java
worker/tree walker code? (?) It seems like they are used to give names to
two of the same construct used in a production, if you can see what I am
trying to say.

Thanks for help, greatly appreciated!!

James Buchanan


----- Original Message -----
From: "fidel viegas" <javaguru_uk@yahoo.com>
To: <james@spunkysoftware.com>
Cc: "sablecc list" <sablecc-list@sable.mcgill.ca>
Sent: Monday, August 13, 2001 4:03 AM
Subject: Re: Anybody listening?


> --- james@spunkysoftware.com wrote: > Hey Thanks. In
> the grammar files:
> >
> > What are the parts in curly braces {like_this} - are
> > these productions?
> No, they are called alternatives and are used to
> identify a specific alternative of a production.
>
> > What are the parts in square brackets with colons
> > [like]:this
>
> This are used when an element appears twice in an
> alternative. e.g:
>
> let's say we have the following alternative of
> production statement:
>
> statement =
>   {multiply} expression multiply expression |
>   ....;
>
> This is an error in sablecc. it has to do with the
> enforcement of the tree property of the AST. So, you
> would do it like this:
>
> statement =
>   {multiply} [left]:expression multiply
>              [right]:expression |
>    ...;
>
>
> So, when you implement the DepthFirstAdapter or any
> other Adapter you can get the node with getLeft() or
> getRight().
>
> anyway, I'm skipping loads of stuff here. Just
> download the thesis from www.sablecc.org and read
> chapter 2 and 3. That should be enough to get you
> started.
>
>
> > Can I find a tutorial/reference on EBNF notation as
> > it applies to SableCC
> > grammars somewhere?
> Just like a mentioned above, you could read just the
> thesis, but You could also get the Dragon Book, by
> Alfred Aho
>
> > Do I need ant and xerces? It would take me forever
> > to download these but I'm
> > sure it would make building and installing things
> > much easier. Should I get
> > them; is it worth it?
>
> No, you don't need Ant or xerces. I'm not using it
> yet, So I don't really know the advantages of it.
>
> Could anyone else answer to this one?
>
> Just read chapters 2 and 3 of the thesis and if you
> have any query regarding to that, then just send it to
> the list, all right?
>
> I don't know what your knowlegde regarding compiler
> design is, but I assume that you are just starting
> out. So, just read it.
>
> All the best
> Fidel Viegas, BEng
>
>
> ____________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie
>
>