I haven’t really advertised my project on ruby talk before, so I figured
it’s
time to give it a go.
If you’re not familiar with ANTLR ( ANother Tool for Language
Recognition:
http://www.antlr.org ), it is a general language recognizer generator,
like
Bison, YACC, etc… It constructs lexers, parsers, and tree-parsers that
use a
LALR recognition strategy from a grammar specification written with a
fairly
clean and readable syntax. While the tool itself is written in Java, it
permits code generation in a number of different target languages,
including
Ruby.
If you are familiar with ANTLR, you are probably also aware that the
built-in
Ruby output functionality is severely limited (with all due respect to
the
developers, of course). Basically, the Ruby target permits parser and
lexer
generation, with limitations and lacking the majority of ANTLR’s
interesting
features, such as AST construction and grammar delegation ( `import’
statements ).
For a while, I’ve been working on a new, fully-featured replacement for
ANTLR’s built-in Ruby target. My package implements all of ANTLR’s
features,
including grammar debugging, AST output, grammar profiling, tree
parsing,
token stream rewriting – pretty much everything except for the
‘template’
output mode. Currently, I’m working on implementing a template output
mode
using ERB, instead of porting the StringTemplate language.
I’m definitely open to feedback/suggestions from end-user developers,
and I’m
open to collaboration and contribution. While everything runs cleanly on
my
system, the library could use more wide-spread usage and testing to
catch bugs
I may have missed.
Bare-bones library and ANTLR jar:
gem install antlr3
rubyforge: http://rubyforge.org/projects/antlr3
gemcutter: RubyGems.org | your community gem host
Full development repository:
git clone git://github.com/ohboyohboyohboy/antlr3.git
github: GitHub - ohboyohboyohboy/antlr3: Fully-featured ruby parser generation using ANTLR version 3
- I’m fairly new to ruby talk, so I’m not exactly sure if there’s a more
appropriate way to advertise the project – so all apologies if I’m
breaking
some mailing-list etiquette with which I’m unfamiliar.
Thanks,
Kyle Yetter