kframework/k — pull request #421 by radumereuta (2014-05-06 18:48:28+00:00)
Title: Added the reject for keywords mechanism in the new parser.

- the grammar generator takes as arguments a set of all tokens found in the definition
- when finding a Token declaration it compares all tokens to see which one overlap and add them as an exception to the matcher
- added a regression test which compares the output and err of krun
- added the AmbFilter at the end of the new parser.

@dwightguth please review.
It's a bit different from what we discussed yesterday, but I think this is more efficient.
I'm letting the regular expression match on the string, and at the end, compare with a list of keywords that I know can overlap (computed during grammar generation time).

Just like before, keywords are automatically rejected, but now, if you don't want them to be, you can just declare them of the sort you want them to match. Example:
syntax Id ::= Token{[a-z]+}
syntax Stmt ::= "return" Exp ";"
syntax Id ::= "return"

The common case is that you want to reject those as being Id, but now you have a way to get around that.