Most complex grammar?

74 views
Skip to first unread message

Scott Taylor

unread,
Jun 11, 2008, 1:23:42 AM6/11/08
to treet...@googlegroups.com

What is the most complex grammar that has been built with treetop?
Are there open source projects which are currently using it? I'd like
to poke around and see some examples.

Has a grammar for treetop (in treetop) been developed? It sure would
be interesting to see treetop become self-hosting.

Scott

Clifford Heath

unread,
Jun 11, 2008, 1:34:28 AM6/11/08
to treet...@googlegroups.com
On 11/06/2008, at 3:23 PM, Scott Taylor wrote:
> What is the most complex grammar that has been built with treetop?

I can't vouch for that, but the grammar I'm developing for my
Constellation
Query Language is impossible with conventional parser generators because
of the need for unlimited lookahead. It's part of the ActiveFacts
project, see
the treetop modules (these all get composed as one grammar) under
<http://activefacts.rubyforge.org/svn/lib/activefacts/cql/>.

Some examples of CQL (merely data definitions, not fact derivations -
queries)
are here: <http://activefacts.rubyforge.org/svn/examples/CQL/>. These
CQL
files are generated from the Object Role Models in the adjacent norma
and
images directories, and the generated Ruby model code is there also.

> Has a grammar for treetop (in treetop) been developed? It sure would
> be interesting to see treetop become self-hosting.

It always was (after the initial bootstrap) and still is, see
<http://github.com/nathansobo/treetop/tree/master/lib/treetop/compiler/metagrammar.treetop
>

Clifford Heath.

Alex Chaffee

unread,
Jun 11, 2008, 10:00:25 AM6/11/08
to Treetop Development
> Are there open source projects which are currently using it?  I'd like  
> to poke around and see some examples.

http://erector.rubyforge.org/svn/trunk/lib/erector/rhtml.treetop

(an HTML Treetop grammar, used to convert HTML or RHTML files into
Erector classes)

(and no, we didn't solve the "but HTML isn't context-free" problem --
we just assume that any close tag closes the most recently seen open
tag, which works for most HTML out there, but if you've got weird
nesting it fails, e.g.,
<b>foo<i>bar</b>baz</i>
=>
b do
text "foo"
i do
text "bar"
end
text "baz"
end
=>
<b>foo<i>bar</i>baz</b>
)

Iñaki Baz Castillo

unread,
Jun 11, 2008, 5:00:23 PM6/11/08
to treet...@googlegroups.com
El Miércoles, 11 de Junio de 2008, Scott Taylor escribió:
> What is the most complex grammar that has been built with treetop?
> Are there open source projects which are currently using it? I'd like
> to poke around and see some examples.

I'm doing a complete parser for SIP protocol. It's 99% done (RFC 3261 is 100%
complete but I need to implement other RFC's related to SIP protocol).
Of course I use Treetop and have created the grammar based on the ABNF grammar
of SIP. It's 100% accurate and precise.

It's not a public project still since I must develop more SIP stack.

Regards.


--
Iñaki Baz Castillo

dragonlist

unread,
Aug 10, 2008, 3:36:44 PM8/10/08
to Treetop Development
I was able to create a Java grammar, and tested on Jython source code,
works pretty well.

Justin Catterson

unread,
Oct 30, 2014, 9:25:03 AM10/30/14
to treet...@googlegroups.com
dragonlist, can I get your grammar file? 
Reply all
Reply to author
Forward
0 new messages