Next: Error handling, Previous: Semantic guards, Up: Top [Contents][Index]
Many programming languages use reserved words which resemble identifiers lexically, but form part of the syntax of the language. Pacc’s bound literals can help to express these. A bound literal is written as ‘"string":Rule’. It calls ‘Rule’, which must have type ‘char *’ or ‘ref_t’, and succeeds only if ‘Rule’ returns a value equal to ‘"string"’.
Here’s a tiny language with reserved words.
S <- "add":Word a:Digit b:Digit { a + b }
/ "sub":Word a:Digit b:Digit { a - b }
Digit <- d:[0-9] " "* { ref_0(d) - '0' }
Word :: ref_t <- w:[a-z]+ " "+ -> w
Last updated: 2016-08-03 21:39:50 UTC
One thing pacc needs is more users. And, perhaps, one way to get more users is to reduce the friction in getting started with pacc. An obvious lubricant is packaging. Read More...
Looking at _pacc_coords(), I noticed that it seemed to have the same realloc() bug that I'd just fixed in _pacc_result(). However, the "list of arrays" trick really wasn't going to work here. Read More...