issues
search
project-langx
/
X
A placeholder language with shareable bytecode IR.
2
stars
0
forks
source link
Add variable support in X
#40
Open
frankhart2018
opened
2 years ago
frankhart2018
commented
2 years ago
Closes #21
Implementation
Identify 'var' keyword, assignment operator ('='), and identifiers in tokenizer.
Add VarDeclNode for variable declaration.
Parse the variable declaration statement according to the new grammar.
Compile var declaration node to
VAR
opcode.
Add a way to check the symbol table.
Add a virtual memory for storing variables, and
-m
to debug memory.
Add VarAssignNode for variable assignment.
Parse the variable assignment statement according to the new grammar.
Compile var assignment node to
ASSIGN
opcode.
Add a way to update the existing symbol table entry.
Add support for the
ASSIGN
opcode in the VM, the memory now gets updated with the value.
Check if variables are declared or redeclared in the symbol table and throw errors accordingly.
Add IdentifierNode for using variables in expressions.
Compile identifier node to
LOAD_VAR
opcode.
Check if the variable is declared before actually using it.
Add support for
LOAD_VAR
in VM, now the variables are actually usable.
Closes #21
Implementation
VAR
opcode.-m
to debug memory.ASSIGN
opcode.ASSIGN
opcode in the VM, the memory now gets updated with the value.LOAD_VAR
opcode.LOAD_VAR
in VM, now the variables are actually usable.