Great. And for more fun I've created the basics of a NCI interface [1]
for ast functions. Heavily underdocumented and unfinished (as of an hour
hacking time ;-), but maybe someone takes it over and continues it. It
needs trunk rev 8598 for some added NCI signatures in src/call_list.txt.
It needs probably also a split into a "Past" and "Node" classes.
Compiling the resulting top node is also missing, but it should be quite
simple to either call the ast compile / emit functions with NCI or
create a better interface for that (I didn't look yet).
PS due to upcoming changes in parrot opcodes, you might avoid the
'compile' opcode. Instead:
compi = compreg 'PIR'
prog = compile compi, 'the_code'
the future is:
prog = compi('the_code')
i.e. just invoke the compiler.
> Thanks,
> Allison
leo
[1]
$ tar -tzf libpast.tar.gz
ast.pir
libpast.pir
$ tar -xzf libpast.tar.gz
$ ./parrot ast.pir
libast loaded
open_unit ok
Py_Module(
Py_Print(
Const(hello
n)))
done
> needs trunk rev 8598 for some added NCI signatures in src/call_list.txt.
or branches/leo-ctx5 r8599.
leo
>If the goal is to demonstrate the capability of the upcoming expression
>parser and minimal AST, I think "bc", the arbitrary precision calculator
>language, is a good candidate.
>
>
Indeed it is. The nice thing about 'bc' is that is fairly simple, but
still has variables and subroutines.
It might also be a neat test case for a future BigNum PMC, as the specs
that it must support multi precission decimal coded numbers.
For my humble efforts, I'm just trying to make the step from evaluationg
'1+1' to evaluating '1+1+1'.
Anybody knows about a bc test suite?
CU, Bernhard