[grammarians] s-expression dumper: works
MenTaLguY
mental at rydia.net
Sat Nov 26 23:57:47 EST 2005
Ter,
Given Ryan's recent post, I've revisited ParseTree and worked out that
it can, in fact, be usefully used on entire files.
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__.
First argument is the file to parse and to dump, second argument is the
file to dump to. If the second argument is omitted, it dumps to stdout.
I've also got this in our Rubyforge CVS, under the 'grammar-test'
module. (I'm no fan of CVS, but it's what we've got available...)
-mental
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dump-ruby.rb
Type: application/x-ruby
Size: 1064 bytes
Desc:
Url : http://rubyforge.org/pipermail/rubygrammar-grammarians/attachments/20051126/9ab4ede0/dump-ruby.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://rubyforge.org/pipermail/rubygrammar-grammarians/attachments/20051126/9ab4ede0/attachment.bin
More information about the Rubygrammar-grammarians
mailing list