Bill Currie
4336fc2c73
Move method function defs into the far data space.
...
As they are never referenced directly by instructions, there's no need for
them to be in the near data space, taking precious def locations.
2011-02-15 15:33:18 +09:00
Bill Currie
bc882ddc3c
Fix the parser side of aggregate initializers.
2011-02-14 23:31:37 +09:00
Bill Currie
09af401f0c
Reset current_func at the end of each function.
2011-02-14 23:10:46 +09:00
Bill Currie
5fa349927f
Preserve the ivars inheritance chain across build_struct().
...
build_struct() unlinks the structure symbol table from its parent, but
that breaks the ivar inheritance chain.
2011-02-14 23:10:46 +09:00
Bill Currie
5707888fcf
Fix some error-recovery segfaults.
2011-02-14 23:10:46 +09:00
Bill Currie
f1fccb19dd
Allow same-type re-declarations of uninitialized variables.
...
This is especially important for declaring variables that were previously
declared external.
2011-02-14 23:10:46 +09:00
Bill Currie
acced90101
Create the symbol for the struct as early as possible.
2011-02-13 20:55:33 +09:00
Bill Currie
547f361bd3
Allow (void) qc-style functions.
2011-02-13 17:37:11 +09:00
Bill Currie
d75c35ba30
Allow qc style function params.
...
Due to ambiguities in the grammar, qc-style function params and c-style
function params had to be completely separated. This means that qc-style
functions can not use pointers and must use qc-style function declarations
for parameters, and c-style functions must use c-style param declarations.
While this rule is tedious for converting the Ruamoko library, it does
actually make for a more consistent language.
2011-02-13 17:07:14 +09:00
Bill Currie
0b5565396b
Add a class type to symbols and rework the CLASS_NAME handling.
...
This fixes the problem with [Array alloc] producing a warning about Class
not repsonding to -alloc.
2011-02-13 16:05:09 +09:00
Bill Currie
75d90d2f00
Propogate the specifiers through external_decl_list.
2011-02-11 22:29:57 +09:00
Bill Currie
e19f7e3521
Sort out the parameters for QC style functions :)
2011-02-11 22:29:57 +09:00
Bill Currie
e75295b00c
Make normal C style functions generate code.
2011-02-09 10:25:23 +09:00
Bill Currie
daa88d8f1c
Fix a type clash warning I'd failed to notice.
2011-02-08 08:23:25 +09:00
Bill Currie
35d53d0d77
Fix typedefs and class names once and for all.
...
I suspect Holub did them that way as a teaching exercise :P
2011-02-08 08:20:32 +09:00
Bill Currie
7e2173f268
Remove some old code.
2011-02-08 08:16:36 +09:00
Bill Currie
7a1a9e3f2d
Better handling of the current storage for function scopes.
2011-02-07 22:11:22 +09:00
Bill Currie
ff70177041
Fix type handling for local variables.
2011-02-07 21:38:58 +09:00
Bill Currie
a28ac636a7
Make local declarations support C syntax.
2011-02-07 21:29:04 +09:00
Bill Currie
da4ec3d47c
Allow typedefs and classes in structs.
2011-02-07 20:55:13 +09:00
Bill Currie
aefd2a27d5
Make type handling in the grammar more consistent.
2011-02-07 20:54:49 +09:00
Bill Currie
76034861c9
Implement direct ivar access in methods.
...
A warning needs to be generated for access to ivars in a class method, but
it seems to work (unable to check due to other errors).
2011-02-07 08:32:52 +09:00
Bill Currie
6b7a81f5a7
Run find_type() early on enums and structs.
2011-02-06 20:07:19 +09:00
Bill Currie
00bba1eb3a
Fix creation of uninitialized global variables.
2011-02-06 14:37:25 +09:00
Bill Currie
2f7b892452
Fix passing messages to classes.
...
Rename class_pointer_def() to class_pointer_symbol() and use it when a
class name is used as the receiver of a message.
2011-02-06 14:34:40 +09:00
Bill Currie
67957a14df
Bring back convert_name(), but siimplified.
...
It is now mainly for converting __FILE__ etc, handling expression symbols,
and checking for undefined identifiers.
2011-02-06 14:29:14 +09:00
Bill Currie
29fbc3b073
Struct and ivar declarations now seem to work.
...
However, not bit-fields.
2011-02-04 23:48:58 +09:00
Bill Currie
c542e1a453
Possibly fix normal methods.
2011-02-04 22:31:23 +09:00
Bill Currie
d9446c5eb0
Fix builtin methods.
2011-02-04 22:31:22 +09:00
Bill Currie
d0ecbb38b8
Copy the spec bits and storage class for QC functions.
2011-02-04 15:25:21 +09:00
Bill Currie
b07392b818
Allow ivars to use C syntax declarations.
2011-02-03 18:04:41 +09:00
Bill Currie
dc6296e9b1
Allow ivars to use typedefs and other classes.
2011-02-03 18:03:37 +09:00
Bill Currie
2203903bb2
Temporarily splice the class's ivar chain into the symbol table.
...
The root class's ivar symbol table needs to be connected to the global
symbol table while building the current class's ivar symbol table. This
allows access to other classes and typedefs.
2011-02-03 18:02:49 +09:00
Bill Currie
79df3d2cca
Put newly created classes into the symbol table.
2011-02-03 17:28:49 +09:00
Bill Currie
564b7b9968
Use abstract_decl instead of type wherever a generic type is needed.
2011-02-03 10:53:59 +09:00
Bill Currie
d12cdca758
Functions and enums now seem to be working properly.
...
find_type now operates recursively (depth-first) so built up typechains
work as expected.
@overload is treated as a specifier (directly as a storage class, similaar
to typedef).
2011-02-03 10:48:12 +09:00
Bill Currie
52799a4e1c
Must merge specifiers :P
2011-02-02 22:59:08 +09:00
Bill Currie
4420a7125e
Ensure structs get added to the symbol table.
2011-02-02 22:53:53 +09:00
Bill Currie
a4eaa2a89b
Allow typedefed types and classes in parameters.
2011-02-02 21:58:53 +09:00
Bill Currie
aeecdc84dc
Get typedef working.
2011-02-02 21:58:11 +09:00
Bill Currie
cca829aa6b
Remove a stray semicolon from the grammar.
2011-02-02 21:57:41 +09:00
Bill Currie
1fe031e8cb
Build C style var/func/abs decl types from the outside in.
...
QuakeC style are built from the inside out.
2011-02-02 15:15:04 +09:00
Bill Currie
ac91e9376b
The big type-system rewrite. Horribly broken :)
...
While broken, it is good enough to compile modulo.r.
This gives qfcc C's type system with QC specifics bolted on top (rather
than trying to cram C's type system into QC's). Pointers and arrays now
use C syntax and semantics (though I think there's a lot of breakage in
there at the moment). Functions themselves are still dual mode: both QC
style and C style are available.
2011-02-01 21:23:03 +09:00
Bill Currie
36c99a8da1
Get function def creation working again.
2011-01-26 14:48:22 +09:00
Bill Currie
4966120e3b
Untwist param's knickers.
2011-01-25 20:21:41 +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
34ffce50fa
Ensure current_symtab gets set at the start of parsing.
...
current_symtab must be set even if the first thing encountered is a syntax
error.
2011-01-25 12:16:13 +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
30701980bc
Get QC cfunctions and defs working.
2011-01-25 12:16:13 +09:00
Bill Currie
0624408317
Move the diagnostic functions into their own file.
2011-01-24 21:54:57 +09:00