December 2009
Intermediate to advanced
380 pages
9h 2m
English
Let’s say we wanted to build an English-like scripting language to draw 3D scenes. The language might look something like this:
| | x = Cube |
| | y = Sphere |
| | y.radius = 20 |
| | draw x |
| | draw y to the left of x and behind x |
The fastest way to get this running is probably with Pattern 24, Syntax-Directed Interpreter. Most likely we wouldn’t care about speed. Issuing commands is a lot faster than rendering objects in 3D, so parsing and interpreting would not be the bottleneck. The interpreter would need Pattern 2, LL(1) Recursive-Descent Lexer and Pattern 3, LL(1) Recursive-Descent Parser or Pattern 4, LL(k) Recursive-Descent Parser. To go beyond recognition, we’d need to add actions to the parser that respond to the ...
Read now
Unlock full access