Add compiler todo note
This commit is contained in:
parent
f90349c09a
commit
f4c5577153
|
|
@ -4,6 +4,23 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
|
||||||
|
For expressions we should use the shunting yard algorithem.
|
||||||
|
This will be useful because it will make it trivial to track types.
|
||||||
|
If the type is a literal, we just read it, if it is a variable we read the variable type from the info.
|
||||||
|
|
||||||
|
During the first pass we count the number of variables. We assign a local to each variable.
|
||||||
|
|
||||||
|
When parsing a expression, we assign any function call or literal to a temp variable slot,
|
||||||
|
(3 maybe?) First one goes in 0, then 2nd in 1, then do operation. Store the operation in 0.
|
||||||
|
If it is a function call, use 1 to load and push the args, then use 1 for the return variable.
|
||||||
|
If both happen to be function calls use 0, 1, 2. Where 1 & 2 are the function calls, and the result operation gets stored in 0.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#define DEBUG_COMPILER
|
#define DEBUG_COMPILER
|
||||||
|
|
||||||
void emit_byte(u8 byte) {
|
void emit_byte(u8 byte) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue