Parsing/AST example.

33 views
Skip to first unread message

Victor Hugo Borja

unread,
Oct 6, 2008, 3:10:24 PM10/6/08
to gazelle-users
Hi All,

I'm interested in learning how to use gazelle, I've read the gazelle
docs and I think it covers how to specify a grammar in gazelle, but
something I missed was some examples of how to actually use the
resulting parser.

Is there any example of how to use the generated output in conjunction
with the gazelle runtime to build an AST?. I'm still new on parsing so
any basic example would do it (an example using the json gazelle
syntax would be a good starting point)

Thanks!

manu...@gmail.com

unread,
Oct 7, 2008, 6:10:52 PM10/7/08
to gazelle-users
You can interpret the JSON expression produced by the gzlparse with
the adequate library of your favourite language.
You can hack the C code of gzlparse.
Or you can encourage Mr Haberman to write further the "The C Runtime"
section of the Gazelle manual.

Joshua Haberman

unread,
Oct 7, 2008, 8:47:49 PM10/7/08
to gazelle-users
Gazelle currently only provides a way to do event-based parsing. You
can ask Gazelle to call a callback of your choice whenever it
successfully parses a rule -- see gzlparse.c for an example of how to
do this.

Gazelle probably isn't your best choice at the moment for building
AST's. You can certainly do it, it will just take a bit of work that
might be a bit intimidating if you're new to parsing. Eventually I
want Gazelle to make this dead-easy, it's just not there yet. But
thanks for your interest!
Reply all
Reply to author
Forward
0 new messages