Explorar el Código

Test user-defined AST nodes.

master
Ian Piumarta hace 1 año
padre
commit
6ba66daa8b
Se han modificado 1 ficheros con 15 adiciones y 0 borrados
  1. +15
    -0
      test.txt

+ 15
- 0
test.txt Ver fichero

@ -320,6 +320,21 @@ print("call testfun\n");
testfun();
// used-defined AST nodes are evaluated the same way as built-in types
MakeSeven = Object.subtype(#MakeSeven);
MakeSeven.__eval__(exp, env) {
print("MakeSeven.__eval__ invoked\n");
7;
}
myNode = MakeSeven.new();
ast = (`6 * @myNode;); // user-defined node in AST
print("AST eval => ", eval(ast), "\n");
for (i from 0 to 10) print(i, " "); print("\n");
for (i from 10 to 0) print(i, " "); print("\n");
for (i in 10) print(i, " "); print("\n");

Cargando…
Cancelar
Guardar