tokay-lang / tokay

Tokay is a programming language designed for ad-hoc parsing, inspired by awk.
https://tokay.dev
MIT License
239 stars 7 forks source link

Builtin / default constants #51

Open phorward opened 2 years ago

phorward commented 2 years ago

With Tokay v0.5, the language is entering a phase where modularity becomes an important part.

For example, the new builtin native tokens Int and Float can be grouped by a pure Tokay parselet Number, defined as

Number : Float | Int

And together with #10, generic parselets are needed in various ways to provide tools for different use-cases.

Currently, there is no way to define such default parselets, except hacking directly in Compiler::get_constant() or Compiler::set_constant() as with the Whitespace defaults handling.

For sure, Float and Int could either be implemented in pure Tokay code on their own, but this may end in performance lose.

Ideas for this issue (partly from #10):

phorward commented 2 years ago

First step towards this is done by 38a130dd95bc1a4e652d63c0ee63aabf6089e4b6

phorward commented 2 years ago

Token-parselet added by 8ff20f7.