Commit graph

69 commits

Author SHA1 Message Date
zik.saleeba b0c74d8c00 Fixed a bug in pointer coercion which was breaking string functions.
git-svn-id: http://picoc.googlecode.com/svn/trunk@350 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-26 20:00:01 +00:00
zik.saleeba 24a601271a malloc() and free() implemented.
git-svn-id: http://picoc.googlecode.com/svn/trunk@346 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-25 20:50:56 +00:00
zik.saleeba c6d483ee6f Unsigned types now exist. They're probably not handled quite correctly in expressions yet though.
git-svn-id: http://picoc.googlecode.com/svn/trunk@345 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-25 11:54:34 +00:00
zik.saleeba 8c7434424d Native pointers no longer carry their size with them.
git-svn-id: http://picoc.googlecode.com/svn/trunk@344 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-23 19:01:32 +00:00
zik.saleeba d5811d37d5 printf() now supports field widths, zero-padding and left/right justification.
git-svn-id: http://picoc.googlecode.com/svn/trunk@342 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-22 20:08:43 +00:00
zik.saleeba 196331d6ba 'short' data type added
git-svn-id: http://picoc.googlecode.com/svn/trunk@340 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-11 11:09:07 +00:00
zik.saleeba bb718dcf21 Turning on NATIVE_POINTERS by default.
Fixed a minor warning in pointer assignment.


git-svn-id: http://picoc.googlecode.com/svn/trunk@339 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-10 18:06:17 +00:00
zik.saleeba 8e735ef68f First cut of casts completed but not debugged
git-svn-id: http://picoc.googlecode.com/svn/trunk@338 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-10 17:59:55 +00:00
zik.saleeba 7d135bbdd5 Doing some work on casts and sizeof
git-svn-id: http://picoc.googlecode.com/svn/trunk@337 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-10 14:49:49 +00:00
zik.saleeba fcab11f844 Made both Val and Op co-exist in the ExpressionStack.
Some preliminary work for casts.


git-svn-id: http://picoc.googlecode.com/svn/trunk@336 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-10-04 16:22:19 +00:00
zik.saleeba 32727cc365 Native pointers feature added
git-svn-id: http://picoc.googlecode.com/svn/trunk@331 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-05 00:55:54 +00:00
zik.saleeba 3a1e39f9d3 New fancy error reporting feature makes nice error messages
git-svn-id: http://picoc.googlecode.com/svn/trunk@330 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-04 07:41:06 +00:00
zik.saleeba 2a69c48777 Fixed a bug in parsing "while ()" and "do..while()". I tried to be too clever. Bad idea.
git-svn-id: http://picoc.googlecode.com/svn/trunk@329 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-04 00:18:28 +00:00
zik.saleeba 44eb3d3def Now handles "4 = b;" correctly (ie. with an error message)
Also fixed a problem with prompting again for more input on EOF.


git-svn-id: http://picoc.googlecode.com/svn/trunk@324 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-03 02:15:25 +00:00
zik.saleeba d38b4fa617 Added nicer error reports to parameter assignment
git-svn-id: http://picoc.googlecode.com/svn/trunk@323 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-03 00:26:14 +00:00
zik.saleeba bb0d19a733 Now conforms fully to the ISO C90 standard
git-svn-id: http://picoc.googlecode.com/svn/trunk@320 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-02 07:50:46 +00:00
zik.saleeba a4889edcf1 Fixes in handling void values.
Making quicksort test more real.
Better error reporting for invalid parameters.



git-svn-id: http://picoc.googlecode.com/svn/trunk@318 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-02 07:01:43 +00:00
zik.saleeba 2f8f365d46 "int a = *'" now reports an error
git-svn-id: http://picoc.googlecode.com/svn/trunk@316 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-02 06:30:14 +00:00
zik.saleeba 825c393240 Reworking of how assignment works. Now all places which do assignment of values
should work the same.


git-svn-id: http://picoc.googlecode.com/svn/trunk@314 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-02 05:51:51 +00:00
zik.saleeba d1d1b7e84e Fixed a problem with type coercion on parameter passing.
Added a handy feature for better-than-C type coercion in printf().
Added a regression test for all sorts of type coercion.

git-svn-id: http://picoc.googlecode.com/svn/trunk@298 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-27 23:54:22 +00:00
zik.saleeba 4668c0a80e Fixed a bug which caused a hang when a comma was omitted in a parameter list, followed by an identifier.
git-svn-id: http://picoc.googlecode.com/svn/trunk@297 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-27 05:59:44 +00:00
zik.saleeba 4949ad046a Added type coercion to floating point from numeric types in parameters.
git-svn-id: http://picoc.googlecode.com/svn/trunk@295 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-27 05:03:48 +00:00
zik.saleeba 2cb35ef26a Fixed a problem with floating point prefix expressions.
Added a regression test for floating point.

git-svn-id: http://picoc.googlecode.com/svn/trunk@293 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-27 04:01:52 +00:00
zik.saleeba 77c4b6e71b Floating point evaluation implicit casting fixes.
Fixed a problem on UNIX where the program usage message couldn't be printed due to the platform output system not being initialised by that point in execution.

git-svn-id: http://picoc.googlecode.com/svn/trunk@290 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-27 03:02:30 +00:00
zik.saleeba 6c8d9ba4cb Fixed a floating point type error bug.
Re-ordered handling of infix floating point operators to handle them before integer coercion.

git-svn-id: http://picoc.googlecode.com/svn/trunk@288 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-27 00:05:31 +00:00
zik.saleeba 5dcde3d5ea Fix for a bug where variables which were initialised on declaration weren't writable.
git-svn-id: http://picoc.googlecode.com/svn/trunk@279 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-14 00:21:29 +00:00
zik.saleeba a76fc34881 By popular demand I'm adding support for native pointers. It's a work in progress - not working yet.
git-svn-id: http://picoc.googlecode.com/svn/trunk@277 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-06 00:25:09 +00:00
zik.saleeba bd9cb90e02 Added the beginnings of flying fox platform support.
Removed some annoying debug.
Made it easier to compile unmodified on non-UNIX systems.


git-svn-id: http://picoc.googlecode.com/svn/trunk@274 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-04 12:02:16 +00:00
zik.saleeba 997f0c119f Fixed a char * arithmetic bug
git-svn-id: http://picoc.googlecode.com/svn/trunk@273 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-29 03:24:15 +00:00
zik.saleeba 5f09200360 Implementing variants on pointer assignment - assigning arrays and array
pointers to pointers to the array element type.


git-svn-id: http://picoc.googlecode.com/svn/trunk@272 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-27 12:19:36 +00:00
zik.saleeba 647cc90999 Added pre/post inc/dec operators for pointers.
git-svn-id: http://picoc.googlecode.com/svn/trunk@270 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-26 11:39:16 +00:00
zik.saleeba 4ea76ea5b3 Changed dereferencing to handle arrays correctly.
git-svn-id: http://picoc.googlecode.com/svn/trunk@269 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-26 03:26:04 +00:00
zik.saleeba c805b3fdec Added ability to print types in error messages
git-svn-id: http://picoc.googlecode.com/svn/trunk@268 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-24 01:02:25 +00:00
zik.saleeba f2f44b1bf7 Slightly neater and more general way of handling type coercion on parameter passing. Doesn't actually correct the Param->Typ any more but this shouldn't be necessary.
git-svn-id: http://picoc.googlecode.com/svn/trunk@267 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-23 22:46:32 +00:00
zik.saleeba d06f2442fb Fixed int->char coercion error in parameter passing.
git-svn-id: http://picoc.googlecode.com/svn/trunk@265 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-23 11:57:45 +00:00
zik.saleeba 99656dc9fb Added NO_FP around new FP assign code
git-svn-id: http://picoc.googlecode.com/svn/trunk@264 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-22 22:28:30 +00:00
zik.saleeba 146a591ed0 Fixed a bug in char<->int coercion in parameter passing.
git-svn-id: http://picoc.googlecode.com/svn/trunk@263 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-22 22:05:27 +00:00
zik.saleeba 95f2b3e193 Characters are now actually stored as char and coerced to other types when necessary.
Parameters are passed as the requested types and coerced where appropriate.
Assignments are now a function rather than a macro.
Cleaned up some comments in lex.c.
Small valued integer constants are passed as char constants to save space.


git-svn-id: http://picoc.googlecode.com/svn/trunk@262 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-22 12:06:58 +00:00
zik.saleeba 16c5b72f4d Pointer comparison operations implemented
git-svn-id: http://picoc.googlecode.com/svn/trunk@260 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-22 08:19:52 +00:00
zik.saleeba e5fa7017f0 Better checks on pointers.
Pointer offsets are now honoured.


git-svn-id: http://picoc.googlecode.com/svn/trunk@259 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-22 07:23:26 +00:00
zik.saleeba 8c918707f2 Added checks for NULL pointer dereference
git-svn-id: http://picoc.googlecode.com/svn/trunk@258 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-22 01:58:03 +00:00
zik.saleeba 096def8f55 Pointer arithmetic and NULL pointer support added
git-svn-id: http://picoc.googlecode.com/svn/trunk@255 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-19 11:49:01 +00:00
zik.saleeba 7c2ce7290a Fixes for a clean surveyor compile
git-svn-id: http://picoc.googlecode.com/svn/trunk@253 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-19 01:15:01 +00:00
zik.saleeba 94e051c9c9 The new expression system is now the mainstream expression evaluator. Hoorah!
git-svn-id: http://picoc.googlecode.com/svn/trunk@249 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-15 10:49:22 +00:00
zik.saleeba 2e22614595 Final problems with the new expression system fixed
git-svn-id: http://picoc.googlecode.com/svn/trunk@248 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-15 10:47:51 +00:00
zik.saleeba 7cb2079af4 Macros implemented
git-svn-id: http://picoc.googlecode.com/svn/trunk@245 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-15 06:57:02 +00:00
zik.saleeba 883db65e15 '->' now works in the new expression system.
git-svn-id: http://picoc.googlecode.com/svn/trunk@244 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-15 06:40:56 +00:00
zik.saleeba 8339e586d1 Fixed a problem with assignment of non-numeric types
git-svn-id: http://picoc.googlecode.com/svn/trunk@242 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-15 05:26:46 +00:00
zik.saleeba 031edfb7ab Problem with ending expressions fixed in new expression system.
Problem with handling ternary operators in case values fixed (those colons are tricky).


git-svn-id: http://picoc.googlecode.com/svn/trunk@233 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-14 23:44:49 +00:00
zik.saleeba 9fdee50576 Case expression handling fixed.
git-svn-id: http://picoc.googlecode.com/svn/trunk@232 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-14 08:44:47 +00:00