HuoLanguage / huo

interpreted language written in C
MIT License
212 stars 21 forks source link

Minus sign "-" is ambiguous to tokenizer #51

Closed incrediblesound closed 8 years ago

incrediblesound commented 8 years ago

Currently the minus sign is ambiguous to the tokenizer because it is present in both the functions constants and the numbers constants (not sure what to call "numbers" and "letters" but I agree those names are poor). The tokenizer should be improved to better distinguish between functions and values.

TheLoneWolfling commented 8 years ago

I'm "about to" drop a pull request that does just that.

A couple of related ambiguities / questions / thoughts:

  1. Do you want people to be able to redefine builtin functions / keywords? E.g. (let true (do (print "true!") 1). Or, more generally, do you want builtins to act as reserved words, or just as though they are predefined functions / keywords?
  2. Do you want numbers of the form .123 (i.e. starting with a decimal point) to be accepted? (Personally, no. Too easy to be confused with commas in arrays)
  3. Do you want arrays to require separating commas? ([1, 2] versus [1 2]) (Personally, don't know)
  4. Do you want "statements" to allow separating commas? ((1, 2) versus (1 2)`) (Personally, don't know)
  5. Do you want arrays to allow trailing commas? (Personally, yes)
  6. Do you want integers to allow digit separators? (Java, for instance, allows 1_000_000) (Personally, yes.)
  7. Do you want to allow floats to have a trailing dot? (Personally, yes.)
TheLoneWolfling commented 8 years ago

I'd love to know your thoughts on my questions, though.