Idorobots / spartan

A small Lisp dialect that serves me as a test bed for programming language features.
MIT License
13 stars 3 forks source link

Explicit regex clauses in the PEG parser. #187

Closed Idorobots closed 3 months ago

Idorobots commented 3 months ago

Currently the PEG generator treats any multi-character strings as regexps. That's probably not performant for the simple cases (for instance ,@) and kinda inconvenient for the REPL use-cases (known command names). Could use an explicit (rx ...) combinator that takes a string and checks if the regexp represented by that string matches the input:

 (Digit
   (rx "[0-9]"))