On Tue, Aug 26, 2014 at 08:40:49PM -0400, Dan Espen wrote: > Thomas Adam <[email protected]> writes: > > > * Tokenisation in the form key/value means that each command can lookup > > the data in the same way. For instance: > > > > if (has_token("level")) { > > int l = strtonum(get_token("level"), 1, INT_MAX, NULL); > > if (l > 10) > > fprintf(stderr, "Sorry, break level too high!\n"); > > } > > Comments: > > What you show above tells me we have 2 functions "has_token" and > "get_token" that as a result of a parser can retrieve parts of the > command just parsed using a token in the command. > > Doesn't imply some kind of hash table? > > I would expect a table driven parser to have a table representing the > commands arguments. > > Maybe: > > Animated_Move = {"int", &x, > "int", &y, > "keyword", "WARP", &warp_keyword};
Right. I wasn't taking a table-driven parser quite as literally as that. I've never been a fan of that approach in the literal sense, but it's certainly one way. -- Thomas Adam
