I've finished the first round of work on a unit testing framework for
our grammar(s).  I took the guts of the dump-ruby.rb script and turned
it into generate.rb, which parses and dumps s-expressions for ruby files
in the samples/ directory into
exemplars/ruby-{RUBY_MAJOR_VERSION}.{RUBY_MINOR_VERSION}.

Depending on whether or not a sample parsed or failed, the script will
generate either an .sexp file (Lisp s-expressions, with the original
Ruby at the top as comments), or a .failed file which is simply a copy
of the original sample.

Right now the exemplar trees are more or less direct from Ryan's
ParseTree library, but I'm going to start "normalizing" them, stripping
out the bits which reflect implementation details of the interpreter
rather than syntax of the language.  Eventually we'll be left with
exemplar trees which represent "platonic" Ruby parsing product.

The idea is this: those of us doing grammars can set up test harnesses
which output .sexp and .failed files, run them against the samples, and
compare the output against the contents of the appropriate exemplar
directory.

-mental

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Rubygrammar-grammarians mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rubygrammar-grammarians

Reply via email to