I’m using ParseKit for objective-C which takes a BNF-like syntax for specifying grammers:
@start = command+;
command = new;
new = 'new' object ';';
object = 'house' | other;
Inclusion of the last line causes an error.
Basically I want to say an object can be a house or something else. The non-terminal element “other” is supposed to catch whatever word was there that wasn’t house.
Am I going about the “anything-here” idea the wrong way?
Thanks!
As suggested in the comments, you should either replace
otherwithWordor add a new rule:Since
'house'is aWord, you can also directly replace theobjectrule with:A
Wordin ParseKit is a contiguous sequence of characters ([a-zA-Z]), numbers ([0-9]), and the symbols-,_, and', that starts with a character. You can find more information about ParseKit tokens in the documentation.