Parser is reading variable declarations, read more

This is an incomplete process. It's supposed to be robust enough to
support the types of arrays and dictionaries, but arrays and
dictionaries aren't implemented in the literals yet, so that's my next
task.

I'll come back to variable declarations later.
This commit is contained in:
2022-08-10 11:01:32 +01:00
parent 9603baeb0a
commit 6a883bde96
9 changed files with 218 additions and 17 deletions

View File

@@ -11,7 +11,7 @@ typedef enum Opcode {
OP_LITERAL,
OP_LITERAL_LONG, //for more than 256 literals in a chunk
//operators
//arithmetic operators
OP_NEGATE,
OP_ADDITION,
OP_SUBTRACTION,
@@ -20,9 +20,15 @@ typedef enum Opcode {
OP_MODULO,
OP_GROUPING_BEGIN,
OP_GROUPING_END,
//variable stuff
OP_SCOPE_BEGIN,
OP_SCOPE_END,
OP_TYPE_DECL, //declare a compound type to be used
OP_VAR_DECL, //stack: literal name, literal type (referenced by array index)
OP_VAR_ASSIGN, //stack: literal name, literal value
//meta
OP_SECTION_END,
//TODO: add more