How to discover a grammar ?

View: New views
4 Messages — Rating Filter:   Alert me  

How to discover a grammar ?

by Jean-Baptiste BRIAUD -- Novlog :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again,

I managed to start using the scriptonite grammar file that describe  
javascript (I already used SableCC for several project before).

Unfortunatly, I'm a little bit lost with the grammar by itself despite  
the fact I think I have to do simple thing with it.

In a string like the following one I have to maintain a list of the  
variables :

eg1 : 'there is ' + n ' elements';
eg2: 2+n;
eg3: 2+i*sin(x);

I have to catch :
n for eg1,
n for eg2
i and x for eg3

how to find the node's name for that variables in a grammar I didn't  
wrote ?
Any advice ?

Is there a quick (generic ?) way to print out with node had been  
caugth by a given visitor for a given javascript ?

Thanks for your help !

_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion

Re: How to discover a grammar ?

by Niklas Matthies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu 2009-03-05 at 22:45h, Jean-Baptiste BRIAUD wrote on sablecc-discussion:
:
> Is there a quick (generic ?) way to print out with node had been  
> caugth by a given visitor for a given javascript ?

The ASTDisplay class in the sablecc3example.tar.gz linked under
http://www.mare.ee/indrek/sablecc/#example would probably help with
that.

-- Niklas Matthies

_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion

Re: How to discover a grammar ?

by Jean-Baptiste BRIAUD -- Novlog :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Few years after I completly forgot that gem and also, in usual hurry,  
I was confused by the fact it was no more directly on the new site.
About that new site, may I suggest to completly move the old one so no  
information are left on the old site that doesn't exist on the new one ?
This is really confusing "from outside".
If the problem is hosting, depending on the needs and bandwith  
consuption I may help with our server.

So, I'm just really happy : I was able to keep using SableCC over  
other generator because :
1. I found a SableCC javascript grammar on scriptonite and despite the  
fact it look like a "ghost town with nobody", the grammar worked for  
my needs.
2. I used the Indrek's Swing visitor to find the node I'm interested  
in, and it works.
3. I'm now able to use that sweet visitor in my domain context without  
having to pact with that evil ET tree grammar that would have mix  
everything.

A big thanks to SableCC, it rocks !

On 6 Mar 2009, at 00:50, Niklas Matthies wrote:

> On Thu 2009-03-05 at 22:45h, Jean-Baptiste BRIAUD wrote on sablecc-
> discussion:
> :
>> Is there a quick (generic ?) way to print out with node had been
>> caugth by a given visitor for a given javascript ?
>
> The ASTDisplay class in the sablecc3example.tar.gz linked under
> http://www.mare.ee/indrek/sablecc/#example would probably help with
> that.
>
> -- Niklas Matthies
>
> _______________________________________________
> SableCC-Discussion mailing list
> SableCC-Discussion@...
> http://lists.sablecc.org/listinfo/sablecc-discussion
>


_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion

Re: How to discover a grammar ?

by Etienne M. Gagnon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jean-Baptiste,

> About that new site, may I suggest to completly move the old one so no
> information are left on the old site that doesn't exist on the new one ?
The new site is a Wiki so that contributors could easily help improve
the site. So, you're welcome to help improve the site. :-)

As for moving all the old information to the new site, there's a little
yet important problem that prevented me from doing so: all the content
of the new site must be licensed under the AL2 license. I cannot
re-license text and code written by others without getting their
approval first. Getting all permissions would be tedious.

SableCC 4 has a new syntax. So, as soon as SableCC 4 is released, most
of the old information will be obsolete anyway, including old grammars.
Writing grammars for SableCC 4 is easier than before, so it should be
fairly easy to write new grammars and license them under the AL2. So, I
am not sure it is that important to move old information around. You
could always add a few links to old information on the
sablecc3.sablecc.org site.

> 2. I used the Indrek's Swing visitor to find the node I'm interested
> in, and it works.
Oh yeah! We need to remember adding such functionality in SableCC 4.

Have fun!

Etienne

--
Etienne M. Gagnon, Ph.D.
SableCC:                                            http://sablecc.org




_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion

signature.asc (265 bytes) Download Attachment