I make two significant changes to the token grammar: I forgot that it makes sense to break the various keywords and operators into their own token terminals, as it makes the job of writing the parser easier later on.
Code:
keyword ::= <base-type> | <if-clause> | <elif-clause> | <else-clause> |
<unbounded-iteration> | <indefinite-iteration> | <reverse-indefinite-iteration> | <definite-iteration> |
<fn-decl> | <var-decl> | <mutable-modifier> | <object-decl> |
<return-statement>
<import-statement> | <as-op> | <alias-op> |
<and-op> | <or-op> | <not-op>
base-type ::= "i8"| "i16" | "i32" | "i64" |"f32" | "f64" |
"bool" | "char" | "string" | "ptr" | "Array" | "Vector"
if-clause ::= "if"
elif-clause ::= "elif"
else-clause ::= "else"
unbounded-iteration ::= "loop"
indefinite-iteration ::= "while"
reverse-indefinite-iteration ::= "once"
definite-iteration ::= "for"
fn-decl ::= "fn"
var-decl ::= "let"
mutable-modifier ::= "mut"
object-decl ::= "object"
return-statement ::= "return"
import-statement ::= "import"
as-op ::= "as"
alias-op ::= "alias"
and-op ::= "and"
or-op ::= "or"
alias-op ::= "not"
and
Code:
arithmetic-op ::= <add-op> | <sub-op> | <mult-op> | <div-op>
add-op ::= "+"
sub-op ::= "-"
mul-op ::= "*"
div-op ::= "/"
bitwise-op ::= <left-shift-op> | <right-shift-op> |<bitwise-and-op> |<bitwise-or-op>
left-shift-op ::= "<<"
right-shift-op ::= ">>"
bitwise-and-op :: = "&"
bitwise-or-op ::= "|"
logical-op ::= <equals-op> | <not-equal-op> | <less-than-op> | <greater-than-op> | <lt-eq-op> | <gt-equal-op>
equals-op ::= "=="
not-equal-op ::= "!="
less-than-op ::= "<"
greater-than-op ::= ">"
lt-eq-op ::= "<="
gt-equal-op ::= ">="
There are still going to be more changes needed, but it is a starting point. I'll see what I can do about a syntax grammar for the parser.