Closed bencinn closed 7 months ago
We should write the grammar in EBNF i think.
https://github.com/amained/kapuc/blob/b1e94e0d2c90ea014450c413b857f3de2d0b3165/src/kapuc/lex.c#L41 It seems that the lexer is different from the grammar. Remove let, change grammar to have const.
This is really not that done but enough to start writing parser and analyzer.
Kapu is meant to be explicit for speed, mean there should be not that magic happening?
Grammar:
Lexer + Parser:
, overload?) (https://github.com/microsoft/TypeScript/issues/16392 this is a great example I think)i8, i16, i32, i64
u8, u16, u32, u64
char
isu8
string
is&u8
end with'\0'
&t
(pointer to t)t<x, y>
(t with parameter x, y) (parameter of types should be type themselves)t::a
(enumerator t of type a)t::b(c<d>)
or something like that@safe
@unsafe
, ...), variadic parameters)@safe @unsafe
blocks,@_internal
blocks)@_c_call
(for use in@_internal
blocks only)@_w_off
(use to turn specific warnings off, not recommended) (internal because you should be able to turn warnings off in flags)@_internal
(for compiler libraries only)@import_ffi
(for c interface/ffi)@safe
@unsafe
@export_wasm
import aa::bb::cc::{d, e};
) and the::
syntax for path