...
I think I can do all of these simply by collecting a list of symbols of the various types then doing some checks.
Done:DONE 2/7/2010
- RULE_REDEFINITION
- ACTION_REDEFINITION
- RULE_HAS_NO_ARGS
- UNDEFINED_RULE_REF
- MISSING_RULE_ARGS
- SCOPE_REDEFINITION (new)
- TOKEN_ALIAS_REASSIGNMENT
- LABEL_CONFLICTS_WITH_RULE
- LABEL_CONFLICTS_WITH_TOKEN
- SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE (label v scope, token v scope, rule v scope)
- LABEL_TYPE_CONFLICT
TODO:
...
argument, return value attribute issues
- LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE
- LABEL_CONFLICTS_WITH_RULE_ARG_RETVALTOKEN_ALIAS_CONFLICT (In combined only. Need to compare tokens def in combined with lexer rule in implicit lexer)
syntax related
These need tree pattern matching to find subtrees with the right syntax. They need to check what's on the left-hand side of rewrites, so I also need to track a list of references within each alternative.
...
- INVALID_RULE_PARAMETER_REF
- NO_SUCH_RULE_IN_SCOPE
- ...
Unsure:
- RULE_INVALID_SET
- IMPORTED_TOKENS_RULE_EMPTY
- TOKEN_ALIAS_CONFLICT (In combined only. Need to compare tokens def in combined with lexer rule in implicit lexer)
Implementation notes
I have to say: tree pattern matchers kick ass! Instead of specifying an entire tree grammar or tree visitor, you specify the patterns of interest and then an action to execute if they match. This is like using an awk script. I'm using two of them so far as I start to build this v4. The first thing I use it for is to do the basic semantic checking. BasicSemanticTriggers.g has rules like this
...