Bill Currie
6ce3c5a59a
Get statments being emitted to the code segment.
...
The first function seems to work fine, but there's a problems with the
scope of params causing params to get their knickers in a twist (tangled
linked list).
2011-01-25 15:46:48 +09:00
Bill Currie
fd3b594ca5
Move label relocs to the relevant statement block.
2011-01-25 15:45:31 +09:00
Bill Currie
f45919df09
Need alias defs after all.
2011-01-25 15:42:26 +09:00
Bill Currie
a648f043de
Give functions their own defspace.
...
The defspace is propogated through the function's sub-scopes.
2011-01-25 12:34:45 +09:00
Bill Currie
726f293d0d
Allocate space for defs and handle basic initializations.
...
Block initializers (arrays and structs) are still broken.
2011-01-25 12:16:13 +09:00
Bill Currie
7e914b8c53
Fix copyright headers.
...
Add forgotten templates and fill in the information in places I had
forgotten. I hope I got the dates right (timezone issues).
2011-01-25 09:01:37 +09:00
Bill Currie
49b7c2d527
Document make_symbol
2011-01-25 09:01:37 +09:00
Bill Currie
0624408317
Move the diagnostic functions into their own file.
2011-01-24 21:54:57 +09:00
Bill Currie
d618e51dc8
Move save_string and make_string into strpool
...
Might not be the perfect place, but at least they're strongly related.
2011-01-24 21:32:48 +09:00
Bill Currie
afc5b2827d
Simplify def handling, use far data.
...
Since there is now a proper symbol table, defs are now just references to
memory locations and the symbol table takes care of duplicates.
Also, start using far data for ObjQC structures.
The qfo functions have been stubbed out until I figure out what to do with
object files in the new scheme.
2011-01-24 15:41:43 +09:00
Bill Currie
20b14af024
Add "is_math" type check and use for unary +/-.
2011-01-23 11:12:58 +09:00
Bill Currie
341f370662
Rename is_math() to is_math_op().
2011-01-23 11:12:05 +09:00
Bill Currie
dea6771d92
Create type_nil for passing nil into ...
2011-01-22 16:41:31 +09:00
Bill Currie
d5f669af7a
Nuke temp reference counting.
...
The whole reason for this crazy developement branch :)
2011-01-22 11:40:53 +09:00
Bill Currie
3b462e16cf
Produce flow diagrams of the basic blocks.
2011-01-22 11:40:53 +09:00
Bill Currie
52b561f7cb
Nuke bind expressions.
...
Since I'm planning on implementing CSE and other optimizations, they're
rather redundant (and I'm having trouble getting them to work).
2011-01-21 19:07:58 +09:00
Bill Currie
4a24393d8d
Temp expressions now use operands instead of defs.
2011-01-21 11:26:43 +09:00
Bill Currie
16e013ff5d
Allow the operand to override the symbol's type.
2011-01-21 10:56:32 +09:00
Bill Currie
f8cc347dce
Print expressions as dot files.
...
While the resulting images can be a little confusing, they're much easier
to read than my cryptic postfix notation.
2011-01-20 15:23:19 +09:00
Bill Currie
5deda9c9b9
Clean out ex_def as ex_symbol replaces it.
2011-01-19 22:25:04 +09:00
Bill Currie
b5424bca7d
Start work on getting expressions converted to internal statements.
2011-01-19 15:47:45 +09:00
Bill Currie
cac2e04b18
Avoid namespace issues with dstatements.
2011-01-19 11:35:34 +09:00
Bill Currie
f2ef24d0cc
Make symbols use the new value struct for constants.
2011-01-19 11:09:54 +09:00
Bill Currie
e08efe036b
Move the constant expression values into their own struct.
2011-01-19 08:43:24 +09:00
Bill Currie
ff6e1b4d6c
Get functions attempting to generate code.
...
However, the statements are only printed as expressions.
2011-01-19 08:38:09 +09:00
Bill Currie
87ce9f5333
Get basic function creation working.
...
Even more FIXMEs, but the pascal parser can now create functions. The
function records even get emitted.
2011-01-18 12:47:13 +09:00
Bill Currie
8fb1b49a9d
Add support for function symbols.
2011-01-18 10:46:42 +09:00
Bill Currie
ea3895805b
Rewrite much to use symbols and symtabs. Gut emit.c. Massive breakage.
...
That which isn't rewritten is horribly broken. However, this does include a
nice mechanism for building QC structs for emitting data.
emit.c has been gutted in the spirit of "throw one away".
There is much work to be done to get even variables emitted, let alone
code. Things should be a little more fun from here on.
2011-01-17 22:34:41 +09:00
Bill Currie
85de101aa3
Break out the defspace code.
...
This also makes some improvements to the free block handling code.
2011-01-17 22:34:41 +09:00
Bill Currie
d3a98af783
Make internal_error globally available.
2011-01-17 22:34:41 +09:00
Bill Currie
537b930ba6
Add new_symbol_type to ease creation of typed symbols.
...
This is inteded for code generation functions that need to create
variables and structures.
2011-01-17 12:04:41 +09:00
Bill Currie
fb8b3d1211
Rework the lexer and parser to use symbols instead of defs.
...
Currently parses the test program just fine, but code generation is very
very broken.
2011-01-13 14:58:16 +09:00
Bill Currie
8f71986306
Add symbol expressions (like def expressions).
...
They will eventually replace def expressions. Currently quite broken.
2011-01-13 14:54:24 +09:00
Bill Currie
5b8725ca66
Rewrite the symbol (table) management in light of actual usage.
2011-01-13 14:48:38 +09:00
Bill Currie
ac14db7b1b
Create a function to ease param list building.
...
This is especially useful for QuakePascal, but it will mean I'll be able to
get rid of the parameter reversals in Ruamoko later on.
2011-01-13 14:45:53 +09:00
Bill Currie
258c896e4d
Create a function to build if/else blocks.
2011-01-13 14:33:16 +09:00
Bill Currie
3c9991364b
Add a "void return" instruction.
...
I got fed up with always having to explicty return something.
2011-01-13 00:29:56 +09:00
Bill Currie
21d7c78eb7
Allow deep copying of expression trees.
...
Certain expression types (eg labels) are created fresh.
2011-01-11 12:05:29 +09:00
Bill Currie
abe471110c
Make inc/dec_users return the the expression.
...
Just for convenience.
2011-01-11 08:44:43 +09:00
Bill Currie
18ae178eaf
Make new_vector_expr and new_quaternion_expr const-correct.
2011-01-11 08:43:34 +09:00
Bill Currie
75ec6bf244
Clean out some unnecessary types from the progs engine and clean up the mess.
...
This is a nasty commit, sorry, but 99% of the commit is interdependent.
2011-01-10 12:25:31 +09:00
Bill Currie
7971b0868e
Break out the begin_function code into its own function.
2011-01-10 12:25:31 +09:00
Bill Currie
c5d0acf0fa
Allow arrays to have ranges (not fully implmented)
2011-01-10 12:25:31 +09:00
Bill Currie
ae4ca52661
Make function.h more independent.
2011-01-10 12:25:31 +09:00
Bill Currie
66ac56063f
Break out the frame macro code from qc-lex.l
2011-01-10 12:25:31 +09:00
Bill Currie
a09f02db1a
Break out the debug and string functions from qc-lex.l.
2011-01-10 12:25:30 +09:00
Bill Currie
695f71eeb6
Get clost to the look I wanted for symtab_flat_copy's graph.
2011-01-10 12:25:30 +09:00
Bill Currie
782a4c9a8d
New symbol table code.
2011-01-10 12:25:30 +09:00
Bill Currie
02f78e46f8
More expression docs.
2011-01-03 16:25:59 +09:00
Bill Currie
5627e43465
Use the method's selector rather than its def name in error messages.
2011-01-03 16:25:29 +09:00