kjosib / booze-tools

Booze Tools will become the complete programming-language development workbench, all written in Python 3.9 (for now).
MIT License
14 stars 1 forks source link

Scanner start-conditions and the `Conditions` header #2

Closed kjosib closed 5 years ago

kjosib commented 5 years ago

Rather than merely "inclusive" and "exclusive" scan conditions, I prefer a model where individual scan rules are grouped, and then these groups can be arbitrarily combined into scanner start-conditions.

MacroParse definitions are supposed to support this with the conditions header, but the code isn't built yet.

The mechanism is straightforward, involving some well-placed epsilon transitions in the NFA.

The developer interface -- what these directives should look like -- is an open question.

Probably we give a condition and a list of rule-groups it contains. Zero or more conditions may refer to any given rule-group.

What about rule-groups not mentioned in conditions? Presumably they represent a stand-alone condition. But what if that represents an oversight or mistake? And certainly we should validate that mentioned rule-groups actually exist.

kjosib commented 5 years ago

Wrote in an update to the "decaf" example and built out the corresponding feature in the compiler module. Checked in the result on 5 May 2019.