Commit Graph

336 Commits

Author SHA1 Message Date
Bill Currie 5cfeb7809f Fix a missing ; 2012-11-20 17:11:39 +09:00
Bill Currie f307c7bebc Rework the unary_expr grammar to allow ++*foo.
This required throwing out the primary rules that snax did up to help me
with conflicts many years ago, but they were now getting in the way. Now
the productions from primary are merged in with unary_expr.
2012-11-09 12:32:38 +09:00
Bill Currie f14d8060e0 Merge qfpc into qfcc.
Since gnu bison and flex are required anyway, no harm in using their api
prefix options. Now, qfcc can compile both QC/Ruamoko and Pascal files
(Pascal is (currently?) NOT supported in progs.src mode), selecting the
language based on the extension: .r, .qc and .c select QC/Ruamoko, .pas and
.p select Pascal, while anything else is treated as an object file (as
before).
2012-10-26 16:01:41 +09:00
Bill Currie dbc203b625 And a few more bits of whitespace. 2012-05-23 08:21:27 +09:00
Bill Currie bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie 617e70c8e3 Clean up a bunch of bison unused warnings. 2011-06-21 19:52:47 +09:00
Bill Currie 1617f0765e Support the default type without segfaulting. 2011-03-25 09:59:48 +09:00
Bill Currie a7cfe3b215 Preserve the current class across protocol defs.
It seems that protocol defs are allowed in class implementations, so don't
let the protocol def kill the current class for the class implementation.
2011-03-24 11:55:17 +09:00
Bill Currie 71af121665 Detect missing @end tags.
Give a warning when @end is forgotten in class implementations.
2011-03-24 11:44:22 +09:00
Bill Currie f1d9570dc8 Fix constant value type handling.
Rename immediate.[ch] to value.[ch] and clean up the mess.

Add convert_value() to convert the type of a value (only scalar types).
2011-03-22 12:24:39 +09:00
Bill Currie 6312ccba81 Fix storage class blocks.
@extern { defs }; etc
2011-03-07 20:51:51 +09:00
Bill Currie 4db8ebb6af Support qcc style local function variables. 2011-03-07 20:04:05 +09:00
Bill Currie 853cc53d0f FIx the handling of storage class. 2011-03-07 17:49:01 +09:00
Bill Currie 16103f9018 Fix param mangling for qc style functions. 2011-03-07 10:43:38 +09:00
Bill Currie 28f4de94d2 Fix switch statements so the work in the new scheme.
Convert case labels to be the same type as the switch expression.
Use alias expressions for the various test expressions.
2011-03-06 00:29:29 +09:00
Bill Currie 8cfa80b5d4 Implement think expressions. 2011-03-05 18:01:37 +09:00
Bill Currie c5ecc170b6 Give labels a usage count to detect unused labels. 2011-03-03 15:28:49 +09:00
Bill Currie 76f912c7a1 Fix function typedefs. 2011-03-02 22:23:24 +09:00
Bill Currie 330e76a9ac Set the correct storage class for struct and enum specifiers. 2011-03-02 11:29:08 +09:00
Bill Currie b584a22d6b Fix external function declarations.
Use spec.storage rather than current_storage.
2011-03-01 11:08:33 +09:00
Bill Currie b50b392746 Fix field def allocation for function fields.
Assignment of nil to a field function is permitted, but trying to use one
as a builtin or as a normal function is treated as an error.
.void (float y) func;       OK
.void (float y) bi = #0;    error
.void (float y) ni = nil;   OK
.void (float y) co = { };   error
2011-02-22 12:07:31 +09:00
Bill Currie 87b240f469 Use special treatment for .float ()foo; functions.
The parser wants to treat .float () foo; as a function returning a float
field, but qcc treats it as a field holding a function variable.
Fortuantely, field types are always "simple" (ie, at worst, just more
field type wrappers around the non-field type), so all that's needed to
obtain qcc grammar is to reach into the field type layers and do the
function type calculation based on the non-field type found there.
2011-02-22 08:54:01 +09:00
Bill Currie d04865884f Set the method's function pointer. 2011-02-15 22:27:13 +09:00
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