Commit graph

238 commits

Author SHA1 Message Date
zik.saleeba 65db9a490a Added tests for functions, while and do..while
git-svn-id: http://picoc.googlecode.com/svn/trunk@88 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-19 11:00:51 +00:00
zik.saleeba 6a1d28c1dc switch is now working.
did some work on break / continue in loops.


git-svn-id: http://picoc.googlecode.com/svn/trunk@87 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-19 09:07:00 +00:00
zik.saleeba 834a6daca6 Added comment
git-svn-id: http://picoc.googlecode.com/svn/trunk@86 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-19 04:55:52 +00:00
zik.saleeba f45882e7e2 Now escaping character and string constants correctly
git-svn-id: http://picoc.googlecode.com/svn/trunk@85 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-19 04:34:36 +00:00
zik.saleeba 2caa072dec Added test case for switch/case/break
git-svn-id: http://picoc.googlecode.com/svn/trunk@84 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-18 11:05:34 +00:00
zik.saleeba 2f5523f400 Fixed a parser bug with token checking
git-svn-id: http://picoc.googlecode.com/svn/trunk@83 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-18 11:03:14 +00:00
zik.saleeba fdad9f8d30 Changes to help with implementing switch/case/break/continue/return
git-svn-id: http://picoc.googlecode.com/svn/trunk@82 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-18 08:19:06 +00:00
zik.saleeba d94b70212b Syntax of "switch" is now handled. Not semantics though.
git-svn-id: http://picoc.googlecode.com/svn/trunk@81 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-17 23:36:09 +00:00
zik.saleeba 2e545deb6a Arrays debugged and working
git-svn-id: http://picoc.googlecode.com/svn/trunk@80 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-15 07:39:41 +00:00
zik.saleeba 78e0ff8bc1 Implemented array lookup
git-svn-id: http://picoc.googlecode.com/svn/trunk@79 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-15 06:46:37 +00:00
zik.saleeba 038431067f Arithmetic fixed to work with new system. "for" now works correctly again.
git-svn-id: http://picoc.googlecode.com/svn/trunk@78 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-15 06:16:54 +00:00
zik.saleeba b073f187f8 Revamped the way lvalues work. Now both structs and '.' should work.
git-svn-id: http://picoc.googlecode.com/svn/trunk@77 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-15 05:52:03 +00:00
zik.saleeba f3b46b9afc Fixed bugs in "for"
git-svn-id: http://picoc.googlecode.com/svn/trunk@76 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-12 12:15:25 +00:00
zik.saleeba 36ce6f3b80 Fixed line numbering in error messages
git-svn-id: http://picoc.googlecode.com/svn/trunk@75 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-12 09:34:16 +00:00
zik.saleeba bd5fe4b73c Made a cleaner interface to creating shared values
git-svn-id: http://picoc.googlecode.com/svn/trunk@74 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-11 06:47:36 +00:00
zik.saleeba 177c2a549b '*' dereference operator implemented
git-svn-id: http://picoc.googlecode.com/svn/trunk@73 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-11 06:42:30 +00:00
zik.saleeba e348021c51 Fixed some egregious bugs
git-svn-id: http://picoc.googlecode.com/svn/trunk@72 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-10 22:25:20 +00:00
zik.saleeba 2b1983b668 Implemented the "address of" operator - working towards pointers
git-svn-id: http://picoc.googlecode.com/svn/trunk@71 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-10 11:19:48 +00:00
zik.saleeba 7c9b3c1c8a Added tests for "for" and arrays
git-svn-id: http://picoc.googlecode.com/svn/trunk@70 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-10 11:18:50 +00:00
zik.saleeba 51afc538be struct are now working
git-svn-id: http://picoc.googlecode.com/svn/trunk@69 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-10 08:42:09 +00:00
zik.saleeba 3a2c0552d6 Added struct test
git-svn-id: http://picoc.googlecode.com/svn/trunk@68 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-10 06:17:28 +00:00
zik.saleeba d6a7ac7c14 Redesigned the test system
git-svn-id: http://picoc.googlecode.com/svn/trunk@67 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-10 06:13:14 +00:00
zik.saleeba a8b4b08d93 Implemented the '.' operator for struct/union member access
git-svn-id: http://picoc.googlecode.com/svn/trunk@66 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-09 11:40:56 +00:00
zik.saleeba c9abac9fad Fixed an EOF lexing problem.
Added some optional debug.
Turned debug off.
Fixed handling of LValues to work with stack frames better.
Fixed the handling of stack frames in function calls.
Fixed a bug in popping variable stack frames.

git-svn-id: http://picoc.googlecode.com/svn/trunk@65 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-04 00:17:30 +00:00
zik.saleeba a9494ff382 Put a better (but slower) string hash function back in since it's only used at lex time now.
git-svn-id: http://picoc.googlecode.com/svn/trunk@64 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-03 22:05:11 +00:00
zik.saleeba 70cc4eae49 Fixed lexer EOF handling when whitespace at end of file
git-svn-id: http://picoc.googlecode.com/svn/trunk@63 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-03 11:09:07 +00:00
zik.saleeba bd30654f74 Fixed a problem with VariableAllocValueAndData() allocating the wrong amount of memory.
Fixed a problem with type parsing.


git-svn-id: http://picoc.googlecode.com/svn/trunk@62 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-03 10:39:48 +00:00
zik.saleeba 943aa9cf97 Added some heap debug
git-svn-id: http://picoc.googlecode.com/svn/trunk@61 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-03 06:27:34 +00:00
zik.saleeba c009864bbb Fixed type parsing error
git-svn-id: http://picoc.googlecode.com/svn/trunk@60 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-03 00:46:02 +00:00
zik.saleeba d95e7debf8 Fixed off-by-one error in LexGetToken()
git-svn-id: http://picoc.googlecode.com/svn/trunk@59 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-03 00:43:13 +00:00
zik.saleeba 11fd7f0f16 Fixed handling of interactive input at EOF
git-svn-id: http://picoc.googlecode.com/svn/trunk@58 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-03 00:23:13 +00:00
zik.saleeba 5b1d4a611f More compact storage of lex token values
git-svn-id: http://picoc.googlecode.com/svn/trunk@57 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-03 00:13:50 +00:00
zik.saleeba 44117cde04 Fixed fallthrough problem in lexer
git-svn-id: http://picoc.googlecode.com/svn/trunk@56 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 23:45:34 +00:00
zik.saleeba 0547bcaff0 Increased heap size to 8k
git-svn-id: http://picoc.googlecode.com/svn/trunk@55 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 22:35:59 +00:00
zik.saleeba e267efdb96 Changed order of initialisation to fix reserved word bug
git-svn-id: http://picoc.googlecode.com/svn/trunk@54 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 22:35:34 +00:00
zik.saleeba 7cd75ae05b Some cleanup of memory references
git-svn-id: http://picoc.googlecode.com/svn/trunk@53 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 22:33:51 +00:00
zik.saleeba b0c3f9d63d Uninitialised memory bug fixed
git-svn-id: http://picoc.googlecode.com/svn/trunk@52 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 22:33:07 +00:00
zik.saleeba 8fcc680dd2 Size error in big allocation fixed
git-svn-id: http://picoc.googlecode.com/svn/trunk@51 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 22:32:24 +00:00
zik.saleeba bd37037d5f Freeing tokens after intrinsic parse
git-svn-id: http://picoc.googlecode.com/svn/trunk@50 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 11:51:45 +00:00
zik.saleeba 1389084b36 Fixed some egrerious bugs
git-svn-id: http://picoc.googlecode.com/svn/trunk@49 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 11:50:55 +00:00
zik.saleeba 956efab67f Parser is now updated to work with the new lexer and string system.
System now compiles - needs debug.


git-svn-id: http://picoc.googlecode.com/svn/trunk@48 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 11:08:36 +00:00
zik.saleeba f8216bb79f Type system now works with the new lexer.
git-svn-id: http://picoc.googlecode.com/svn/trunk@47 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 05:27:15 +00:00
zik.saleeba 0c0ac9b332 Lexer now supports interactive input.
Lexer now pre-scans the source and returns a buffer of tokens.
Heap can provide unallocated memory for a temporary buffer.

git-svn-id: http://picoc.googlecode.com/svn/trunk@46 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 04:53:45 +00:00
zik.saleeba 8bd1c18d24 Converting to use shared strings
git-svn-id: http://picoc.googlecode.com/svn/trunk@45 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 03:27:05 +00:00
zik.saleeba a9a93f3aa4 Now uses the benefits of shared strings to simplify the hash table for value lookups.
Added a more compact way of storing shared string hash chains.

git-svn-id: http://picoc.googlecode.com/svn/trunk@44 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-02 03:25:15 +00:00
zik.saleeba 86af5318da Bulko lexer change for more efficient pre-scanned tokens.
Removed Str type - replaced with standard C strings.
Added hashed string tables for efficient string storage.


git-svn-id: http://picoc.googlecode.com/svn/trunk@43 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-01 11:31:18 +00:00
zik.saleeba 921ccdf17d Fixed a bug in HeapFree().
Allowed for coalescing frees on the bottom of the heap.


git-svn-id: http://picoc.googlecode.com/svn/trunk@42 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-01 03:39:16 +00:00
zik.saleeba 2d7b467b96 Changed from a linear probing hash table to a hash chain method since we now have better storage allocation. This is more space efficient and removes the static limits on local variable table sizes.
git-svn-id: http://picoc.googlecode.com/svn/trunk@41 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-01-29 22:26:04 +00:00
zik.saleeba b2396d3eda Now stack frames appear on our new stack as they should. The old static
limits are gone.


git-svn-id: http://picoc.googlecode.com/svn/trunk@40 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-01-29 11:10:46 +00:00
zik.saleeba 86cea880e3 Changed away from old FunctionStore approach now that I have dynamic
allocation available.


git-svn-id: http://picoc.googlecode.com/svn/trunk@39 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-01-29 10:56:50 +00:00