[grammarians] s-expression dumper: works

Terence Parr parrt at cs.usfca.edu
Sun Nov 27 13:59:53 EST 2005


On Nov 26, 2005, at 8:57 PM, MenTaLguY wrote:

> Ter,
>
> Given Ryan's recent post, I've revisited ParseTree and worked out that
> it can, in fact, be usefully used on entire files.

Nice!

> Attached is a very crude script that dumps s-expressions using a  
> more or
> less Lisp syntax.  Just a few steps up from "unholy abomination" and
> "evil kludge", my script falls neatly under "ugly hack".  But it does
> work for pretty much everything save perhaps __DATA__.

Hmm...having a spot of trouble; can't seem to get past my comments:

~/antlr/code/examples-v3/java/ruby $ dump-ruby.rb ../extest
/usr/local/bin/dump-ruby.rb: line 6: require: command not found
/usr/local/bin/dump-ruby.rb: line 7: require_gem: command not found
/usr/local/bin/dump-ruby.rb: line 9: syntax error near unexpected  
token `('
/usr/local/bin/dump-ruby.rb: line 9: `def parse( text )'
~/antlr/code/examples-v3/java/ruby $ head ../extest
#!/usr/bin/ruby

#
# Build, compile, and run each example in this dir.
#
# Each dir must have at least one .g file and an input/output pair so
# the script can check for valid output. [this is my first ruby script]
#
# TODO: make stderr go away
#
...

Ter


More information about the Rubygrammar-grammarians mailing list