May 10th, 2006 -- Variables! Tests!
As I mentionedyesterday, Makefile.PL and a basic test file were added. But there were still something missing. I fixed the t/basic.t so that the test really passes. And the last two tests are corrected by updating the compile_p6grammar.pl to the one I used which deal with backslashes correctly.
On the another hand, I originally planned to support statements more than a single "return." But I dropped the idea due to two reasons:
Assignment is not provided so variables can be translated to a simple "let ... in ..." expression, pure lambda one. The old yada example can now be written as
Final notes:
On the another hand, I originally planned to support statements more than a single "return." But I dropped the idea due to two reasons:
- I was not familiar enough to rules to write the grammar.
- Translating general statements to Haskell is not straight forward.
Assignment is not provided so variables can be translated to a simple "let ... in ..." expression, pure lambda one. The old yada example can now be written as
and translated into (the production rule part)rule yadaLiteral {
$<sym> := [ <'...'> | <'???'> | <'!!!'> ]
{ my $yada = doYada( $<sym> );
my $err = Val( VStr( $<sym> ~ " - not yet implemented") );
return App(
Var( $yada ),
Nothing,
[ $err ]
)
}
}
let yada = (doYada sym) in
let err = (Val (VStr (sym ++ " - not yet implemented"))) in
return $ (App (Var yada) Nothing [err])
Final notes:
- Now it takes nearly three minutes for compile_p6grammar.pl to translate the grammar to .pm file.
- There are three kinds of variables now: named capture, numbered capture, and temporary. Some renaming (prefix or suffix adding) may be performed to prevent conflict.
0 Comments:
Post a Comment
<< Home