fleabitdev / glsp

The GameLisp scripting language
https://gamelisp.rs/
Apache License 2.0
395 stars 13 forks source link

Parser defect: number should take priority over abbreviation #25

Open tyomitch opened 3 years ago

tyomitch commented 3 years ago

The reference says:

When the parser encounters a sequence of characters which could represent a symbol, or could represent a number or abbreviation, then the number or abbreviation will take priority.

Currently this means that numbers starting with a period are parsed as meth-name, so e.g. (let decay-rate .05) fails with an "error: unbound symbol 'meth-name'" This is never helpful, as 05 is not a valid method name.

fleabitdev commented 3 years ago

The parser is working as specified. We imitate Rust's syntax for numbers and strings wherever possible, and in Rust, .05 isn't a valid floating-point literal.

Leaving this issue open, because you've raised two good points: