March 2001
Intermediate to advanced
400 pages
8h 35m
English
You can create a Sling parser almost directly from the Sling grammar. You must supplement the parser with the assemblers, as Section 16.11 shows. You also must add logic for reserved words.
In Sling, you want to allow variable definition, but you do not want to allow confusion about whether pi, s1, and s2, for example, are variables or built-in expressions. You do not want to allow
s1 = 42; // wrong
In fact, entering this line as a program in the Sling development environment will elicit this message:
> s1 is a reserved word
The strategy that SlingParser uses to reserve words is to modify the standard tokenizer to return specified words as a different type of token. The parser uses the class ...
Read now
Unlock full access