fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
7 stars 0 forks source link

Change identifier syntax once again #43

Closed fmease closed 4 years ago

fmease commented 4 years ago

For the record, the current syntax of "alphanumeric" identifiers is ([a-zA-Z][a-zA-Z0-9]*'*)(-[a-zA-Z][a-zA-Z0-9]*'*)*. They consist of segments separated by a single dash - where each segment may contain ASCII alphabetic characters and — except for the first character — digits and may end with several primes '.

I now think allowing primes leads to poor naming strategies, so it's better to remove them from the syntax of identifiers. Next, we probably should allow underscores in identifiers even if our naming convention is kebap case not snake or pascal case.

With that, the new lexical syntax should be: ([a-zA-Z_]\w*)(-[a-zA-Z]\w*)* where a single _ becomes a keyword.