In pattern matching, how do you discriminate between literal patterns and variables patterns? I'm especially curious about how `true' and `false' vs `result' are handled.
This is handled in the parser. There are two productions, identifier and reserved and the two don't intersect. Reserved identifiers like true and false match more eagerly than regular identifiers.