|
|
@ -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"); |
|
|
|