| Home News Profile Contact Half-Life Music PCASTL Computer Science Videos Readings OpenGL Elements C64 sids Links | 
| Operators Data Types Internal Functions Tree Structure Batch Execution Examples Interpreter | 
| PCASTL by Parent and Childset Accessible Syntax Tree Language The PCASTL is an interpreted high level programming language which makes writing self-modifying code easier. Its features are: 
 
The most recent version is 3.5 and was released on 2018-03-31. So, what's a syntax tree? For example, inside the interpreter, the tree having its root in the variable fact after the following code has been executed: fact = function(x)
{
   if (x == 1) return(1)
   return(x * fact(x - 1))
}
is: 
 Below you can see how childset and parent keywords can be used to navigate this tree. > info(fact) [node_type] "function definition" [nb_children] 2 [parameters][0] "x" > > info(fact.childset[0]) [node_type] "list" [nb_children] 1 > > info(fact.childset[0].childset[0]) [node_type] "variable" [nb_children] 0 [name] "x" > > info(fact.childset[1]) [node_type] "list" [nb_children] 2 > > info(fact.childset[1].childset[0]) [node_type] "if statement" [nb_children] 2 > > info(fact.childset[1].childset[1]) [node_type] "function call" [nb_children] 2 [nb_args] 1 > > info(fact.childset[0].parent) [node_type] "function definition" [nb_children] 2 [parameters][0] "x" Here are ways to edit the tree: > mknode(fact.childset[1], `if (x < 1) {
+    print("Parameter must be greater than zero.")
+    abort()
+ }', 0)
> fact(-2)
        "Parameter must be greater than zero."
> info(fact.childset[1])
[node_type]     "list"
[nb_children]   3
>
> info(fact.childset[1].childset[0].childset[1].childset[1])
[node_type]     "function call"
[nb_children]   2
[nb_args]       0
>
> fact.childset[1].childset[0].childset[1].childset[1] = `return(-1)'
        0x431c20
> info(fact.childset[1].childset[0].childset[1].childset[1])
[node_type]     "function call"
[nb_children]   2
[nb_args]       1
>
> fact(-2)
        "Parameter must be greater than zero."
        -1
 |