Commit graph

118 commits

Author SHA1 Message Date
zik.saleeba 441f8b4073 Added example functions lineno() and errorprintf()
git-svn-id: http://picoc.googlecode.com/svn/trunk@405 21eae674-98b7-11dd-bd71-f92a316d2d60
2010-02-03 20:01:01 +00:00
zik.saleeba fc348214c9 Stricter handling of semicolons at the end of statements.
git-svn-id: http://picoc.googlecode.com/svn/trunk@402 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-22 11:36:15 +00:00
zik.saleeba fcc6fd6846 Fixed printing of longs
git-svn-id: http://picoc.googlecode.com/svn/trunk@393 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-07 21:12:12 +00:00
zik.saleeba c3dcac1812 Added long and unsigned long data types
git-svn-id: http://picoc.googlecode.com/svn/trunk@392 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-07 21:05:15 +00:00
zik.saleeba b777be13be Fixed the HPPA floating point problem
git-svn-id: http://picoc.googlecode.com/svn/trunk@386 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-07 17:47:25 +00:00
zik.saleeba d2718f62c5 Removed unnecessary guff
git-svn-id: http://picoc.googlecode.com/svn/trunk@375 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-04 20:21:10 +00:00
zik.saleeba e75518e139 Changed the way that arrays are represented to a simpler one without
the extra level of indirection.
Fixed various array-related problems, including array assignment
which is issue #49.


git-svn-id: http://picoc.googlecode.com/svn/trunk@373 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-04 02:02:37 +00:00
zik.saleeba 2e07f89194 Possible fix for big-endian bug
git-svn-id: http://picoc.googlecode.com/svn/trunk@371 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-03 20:40:35 +00:00
zik.saleeba 274f21fdbc Removed "unsigned char" - now all chars are unsigned again.
git-svn-id: http://picoc.googlecode.com/svn/trunk@370 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-01 21:16:19 +00:00
zik.saleeba f1aeadb077 Removed redundant "struct ArrayValue"
git-svn-id: http://picoc.googlecode.com/svn/trunk@369 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-01 21:10:48 +00:00
zik.saleeba 18acb6dc1a Removed old pointer system. Now it's "native pointers" all the way.
git-svn-id: http://picoc.googlecode.com/svn/trunk@368 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-11-01 21:02:31 +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 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 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 eb6f323f06 HeapAlloc() changed to HeapAllocMem() to avoid clash with win32 namespace.
git-svn-id: http://picoc.googlecode.com/svn/trunk@321 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-06-02 08:00:02 +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 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 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 207029259c Helpful comments added on tokens
git-svn-id: http://picoc.googlecode.com/svn/trunk@283 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-24 00:22:04 +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 20c649d7ef Added some changes for umon suggested by Ed Sutter
git-svn-id: http://picoc.googlecode.com/svn/trunk@275 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-05-05 22:12:59 +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 b6e61dd8ab Created a stream output system.
Implemented sprintf().

git-svn-id: http://picoc.googlecode.com/svn/trunk@271 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-27 04:56:58 +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 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 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 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 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 16922d2e73 library struct example for Howard
git-svn-id: http://picoc.googlecode.com/svn/trunk@219 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-04-07 10:48:46 +00:00
zik.saleeba ccbf149212 Fixed a problem with interactive mode error handling.
Will need some extra work for Surveyor... tomorrow.


git-svn-id: http://picoc.googlecode.com/svn/trunk@215 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-31 11:08:29 +00:00
zik.saleeba 79c7619dab New expression system now handles simple numeric values
git-svn-id: http://picoc.googlecode.com/svn/trunk@214 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-30 11:16:40 +00:00
zik.saleeba 45a378231b More work on expressions
git-svn-id: http://picoc.googlecode.com/svn/trunk@213 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-29 11:08:03 +00:00
zik.saleeba 1ab28fcfb7 Took a first stab at implementing new/delete. Needs a bit more thought on how to handle dangling references to deallocated storage.
git-svn-id: http://picoc.googlecode.com/svn/trunk@211 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-16 04:25:58 +00:00
zik.saleeba ce80c66e8f Added new "delete" keyword, used for undefining variables or functions
in interactive mode.


git-svn-id: http://picoc.googlecode.com/svn/trunk@206 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-15 10:44:56 +00:00
zik.saleeba a414de85e5 getchar()/gets() implemented
git-svn-id: http://picoc.googlecode.com/svn/trunk@205 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-15 09:57:19 +00:00
zik.saleeba 207549bf17 Reorganised platform/library stuff for better separation between
platforms.
Removed unnecessary union in pointers.


git-svn-id: http://picoc.googlecode.com/svn/trunk@203 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-15 07:07:21 +00:00
zik.saleeba 48a6472c68 All allocations are now cleaned up neatly on exit. This is probably unnecessary given that we run our own heap but gives confidence that there are no internal memory leaks.
git-svn-id: http://picoc.googlecode.com/svn/trunk@199 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-11 23:49:10 +00:00
zik.saleeba 0523bd570d String literal array values are now shared and deallocated cleanly
git-svn-id: http://picoc.googlecode.com/svn/trunk@197 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-11 22:28:42 +00:00
zik.saleeba 6f7daf0145 Now cleaning up types too
git-svn-id: http://picoc.googlecode.com/svn/trunk@195 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-03-11 10:17:46 +00:00