Growing trees

After my last post I dived into the wondrous world of PHP-syntax and the SDF
of StringBorg. This SDF will generate a parse table that can parse PHP-files and generates
a representation in the ATerm format. A simple example:
$a = 1 + 3
can be parsed into:
Assign( LitVar("a"),
Plus(LNumber("1"),
LNumber("3")
)
)
For small things, like operators, this is easy. But how to translate a script into a tree? And how do you call all the different construct?

Luckily there is a list of parser tokens used in the actual parser. If you ever made a typo in a PHP script, you probably did if you ever wrote anything in PHP, then you will recognise some of the terms in the list.

No comments: