f84eb16490
codegen: emit Store for Assign exprs
2019-09-29 11:41:16 -03:00
5d8efd657f
analysis: add analysis of Assign expressions
2019-09-28 22:48:59 -03:00
2fea745df4
codegen: use current_scope's meta_map instead of resolveVarType
2019-09-28 22:18:22 -03:00
f2520e7d02
change bits and pieces everywhere about var meta
2019-09-28 22:16:33 -03:00
a95d0e7fd8
comp_ctx: make resolveVarType's return type be nullable
...
- add a parameter to prevent unwanted side-effects of resolveVarType
- add basics of resolving scope variables
2019-09-28 21:30:52 -03:00
182d831408
comp_ctx: use more pointers to variable metadata
2019-09-28 20:52:45 -03:00
c7920246a5
codegen: add emitting of unary exprs
2019-09-28 17:58:17 -03:00
65a9e58a9a
emit a store for the stack fn arguments
2019-09-28 13:40:11 -03:00
21dcb3e65d
codegen: emit load instruction for (now-stack) params
...
- comp_ctx: make ParameterMap use ptrs to Parameter
2019-09-28 13:30:05 -03:00
a136a377ce
change symbol table to use pointers to heap allocated symbols
2019-09-28 13:17:11 -03:00
93811c986d
codegen: use Parameter.llvm_alloca
2019-09-28 12:46:23 -03:00
61c8493484
add basics of stack-stored arguments
...
this requires some changes regarding the const-ability of the passed
nodes into codegen.
2019-09-28 11:40:56 -03:00
178acc656f
codegen: allow for mutable statements
...
- ast: add llvm_alloca llvmvalueref pointer in VarDeclStmt
2019-09-28 11:30:21 -03:00
d235ce0d13
add codegen for allocating vardecls onto stack (not init yet)
...
codegen pass needs type information about the variable. thankfully,
analyze pass already did the hard work for it, and scope info has types
of all its declared names. we use that info to generate the alloca
to have information about which current scope we are, we add a "child
index" to scopes so we can repoint current context at them instead of
bumpScope(), which always creates new, empty ones.
initializer exprs are next
2019-09-27 22:36:35 -03:00
849bbc0e94
add support for resolving parameters in function body
2019-09-27 20:39:16 -03:00
3f48be3420
codegen: prepare for variable emitting
2019-09-27 17:18:38 -03:00
7e41d03eb9
add proper Integer32 and Integer64 literals
2019-09-27 12:07:20 -03:00
c3d3486163
rename types.zig to analysis.zig
2019-09-27 00:00:06 -03:00
fc9f5d9ce0
add get expr analysis
...
- rename GetExpr.struc to GetExpr.target
2019-09-26 18:03:39 -03:00
bf035abadf
add lots of TODOs for variables and type analysis of statements
...
- comp_ctx: replace Function.symbols to Function.env
2019-09-26 00:11:48 -03:00
45275d73db
change variable declarations to statements
...
doing them as expressions was a hack since no 'var' keyword,
also, yeet the := operator from the parser.
2019-09-25 22:22:13 -03:00
e69451cdd9
example: function calls can't happen on consts yet
...
- add suggestion to make it work as TODO
2019-09-25 18:10:17 -03:00
0b72462954
codegen: add emitting of call exprs
...
- codegen: add llvm value ref table to more easily fetch function
values
- comp_ctx: add fetchGlobalSymbol
- types: use ctx.fetchGlobalSymbol
2019-09-25 18:05:56 -03:00
04c624e210
codegen: add emitting of const declarations
2019-09-25 17:05:37 -03:00
1040eef79f
codegen: add emitting for enum get expressions
2019-09-25 12:28:22 -03:00
5188dac3c0
add type analysis of enums
2019-09-25 11:59:36 -03:00
0b0a8896bb
add basic resolution of enums to llvm types
...
- pass ctx to codegen
- add better type solver error for unhandled nodes
2019-09-25 11:29:47 -03:00
e2cca03d52
add type resolving for structs and fn params
...
- add a printer for the symbol table
- add error contexts to type pass
2019-09-25 00:26:30 -03:00
bfe9f4fe0d
s/testfile/output.ll
2019-09-24 18:59:00 -03:00
9e80ad4c23
fix if statement emitting
...
- don't emit br instructions (or any other) if branch emits ret
- remove phi node (ifs are statements, not exprs)
- emit to testfile (even if ir is broken)
2019-09-24 18:49:35 -03:00
c1d6939c43
add the rest of (currently nonfunctional) emitting of if stmts
...
- add compilation context and basics of type solver
2019-09-24 17:47:17 -03:00
1bb1fb813d
add basics of if statement emitting
...
- add util mkLLVMBool
- add left/right paren to if statements
- lowkey fix for statements' semicolon
2019-09-24 14:12:37 -03:00
1ac63cdbef
resolve llvm types for function parameters
2019-09-24 13:32:00 -03:00
e25621350a
fix boolean operators
...
- remove Logical expressions
- add basic token return type to LLVMTypeRef converter
- add codegen for Bool literals
- fix "and" and "or" being identified as identifiers
2019-09-24 13:23:23 -03:00
f08d613198
switch BinaryExpr.op to BinaryOperator instead of token
...
less strings, more fun!
2019-09-23 23:18:31 -03:00
013aafa8a4
add emitting of integer and float literals
...
- remove panics
- add emitting for return statements
- remove default emitting of return a+b;
2019-09-23 22:07:19 -03:00
4c1bdb5f91
codegen: add incomplete generation of expressions
2019-09-23 18:34:12 -03:00
05c480c364
initialize all llvm features befbore emitting
2019-09-22 18:40:15 -03:00
469625d32a
add CompileError error type
2019-09-22 18:26:00 -03:00
a1bf15fe4d
add support for target machine
2019-09-21 23:56:22 -03:00
86e899e771
cgen: output .bc file
2019-09-21 12:37:41 -03:00
243e3cc694
fix llvm linking
2019-09-21 12:31:47 -03:00
6c3d20bbbb
add the basics of llvm codegen
2019-09-20 23:40:21 -03:00