Sierra Style Parsers in AGS
Created on 2020-12-29T00:16:33-06:00
- Each word is associated with an ID number.
- An ID of zero means the word is ignored while reading.
- Multiple words may share an ID; this makes them synonyms with one another.
Parsing
- Input from the user is tokenized and replaced with IDs from the table.
- Scripts can then ask if the list of IDs matches a list of IDs that means something.
AGS scripting lets you say Parser.Said("foo [bar]") which replaces foo and bar with the IDs from the table. Notation in brackets makes a word optional.
For example "fiery potato" would become 3 7. If potato and spud were synonyms then both "fiery potato" and "fiery spud" would be parsed as 3 7.
Special tokens
- rol: matches the rest of input line
- anyword: matches a single word