Identifiers & Datatypes

Upper and lowercase letters carry different meaning when at the start of a word.

A Datatype must always start with an uppercase letter, and an identifier must start with either a lowercase letter or an underscore.

Identifier

Identifier        = (underscore | lowercase_letter), identifier_letter*

identifier_letter = underscore | lowercase_letter | uppercase_letter | decimal_digit
identifier
_identifier
_123
_many_letters
camelCasethp
    

Datatype

Datatype = uppercase_letter, indentifier_letter*
Datatype
PDO
WEIRD_DATATYPEthp
    
Syntax error: There should be an identifier after a binding at line 2:1

Keywords

The following are (currently) THP keywords:

val     var     funthp
    
Syntax error: There should be an identifier after a binding at line 1:8

Keywords are scanned first as identifiers, then transformed to their respective tokens.