Commit graph

712 commits

Author SHA1 Message Date
Russell Joyce 31b08382db
Added command line option for enabling interpreter stats collection
'-d' or '-d0' to collect and print basic stats, '-d1' etc. for
alternative output formats.
2020-06-24 17:30:27 +01:00
Russell Joyce 97030639f1
Fixed for loop initialisers with variable declarations 2020-06-18 19:18:14 +01:00
Russell Joyce 9d2327b8be
Added support for commas in for loop initialiser statement 2020-06-18 18:41:27 +01:00
Russell Joyce 7b43483f68
Added handling of "short int" type specifier
Just consumes and discards the "int" token and treats as if it was only
a "short".
2020-06-18 17:20:02 +01:00
Russell Joyce 3979f563aa
Added support for commas in for loop update statement 2020-06-18 17:05:10 +01:00
Russell Joyce d04337125e
Added support for extern variable declarations
Effectively just ignores any declarations as global scope is shared
across files in PicoC anyway, so the ultimate definition should be
enough.
2020-06-17 19:57:10 +01:00
Russell Joyce 875a635648
Increased size of temporary variable creation buffer
Allows for larger arrays to be defined and passed around without hitting
the limit, but at a cost of higher stack memory usage in the
VariableAllocValueAndCopy() function.
2020-06-15 18:29:04 +01:00
Russell Joyce 5261facbd7
Fixed bug with typedef, introduced with extra type qualifier parsing
Caused by overwriting the value of the actual type token being parsed by
any following tokens that were examined or consumed, rather than just
ignoring their values.
2020-06-12 15:33:19 +01:00
Russell Joyce 62969cb0ee
Added handling of 'const' type qualifier keyword
There is currently no enforcement of a variable being constant, and the
actual type is the same as if 'const' wasn't present.
2020-06-11 11:30:51 +01:00
Russell Joyce 9fd31b6d37
Added handling of "long int" type specifier
Just consumes and discards the "int" token and treats as if it was only
a "long".
2020-06-10 18:24:12 +01:00
Russell Joyce b403e76600
Added handling of trailing type qualifiers/storage classes
Handles situations such as `int volatile x` rather than `volatile int x`
by consuming the keywords as part of the type specifier.
2020-06-10 18:21:35 +01:00
Russell Joyce 9abf00e2d3
Added basic pragma parsing
Actual contents of the pragma are currently just discarded. This
supports both #pragma and _Pragma() definitions, but the pragma must end
the line it is on and cannot be in the middle of a statement.
2020-06-09 19:21:00 +01:00
Russell Joyce a96902717c
Added stats code to Makefile
For when not using CMake, e.g. when running tests with 'make test'.
2020-06-09 12:52:35 +01:00
Russell Joyce 2597008035
Small modification to loop C test code 2020-06-09 12:31:20 +01:00
Russell Joyce 45d85111f0
Added parsing of volatile qualifier
This doesn't affect code execution, but is exposed through TypeParse().
2020-06-09 12:30:47 +01:00
Russell Joyce 409f520b61
Added functions to log and count parsing of statements and expressions
Currently prints all expressions and statements to stderr, then outputs
a total count of each token to stderr after program execution.
2020-05-13 18:44:09 +01:00
Russell Joyce 72dff522b3
Added some basic example C files for use with debugging/testing 2020-05-13 18:01:14 +01:00
Russell Joyce 4d3a9715ae
Fixed building on MacOS
'F_FULLSYNC' should be 'F_FULLFSYNC', and sbrk system call is deprecated.
2020-05-13 17:13:11 +01:00
Russell Joyce d57c0044b5
Added CMake/CLion project and associated files 2020-05-13 17:11:53 +01:00
Joseph Poirier a97d94fa3d
Merge pull request #21 from jpoirier/develop
Develop
2018-01-17 08:33:58 -06:00
Joseph Poirier f84bf504d9
fix typo in readme 2018-01-17 08:33:04 -06:00
Joseph Poirier b9ffe4eeb6
delete unused code 2018-01-17 01:49:48 -06:00
Joseph Poirier bb3c5ef926
Merge pull request #20 from jpoirier/develop
add the last bits of the hack
2018-01-17 00:57:35 -06:00
Joseph Poirier 676addf333
add the last bits of the hack 2018-01-17 00:55:24 -06:00
Joseph Poirier 2e35505e26
Merge pull request #19 from jpoirier/develop
make the ugly hack uglier
2018-01-17 00:44:32 -06:00
Joseph Poirier aad3648fc0
make the ugly hack uglier 2018-01-17 00:31:08 -06:00
Joseph Poirier 345b1defbd
Merge pull request #18 from jpoirier/develop
properly print large long values
2018-01-16 21:08:39 -06:00
Joseph Poirier b8b4c48637
properly print large long values 2018-01-16 21:06:52 -06:00
Joseph Poirier 4930d786c8
Merge pull request #17 from jpoirier/develop
fix parsing typedef outside of declaration, don't decrement loop counter
2018-01-16 16:16:21 -06:00
Joseph Poirier e8a2a13595
fix parsing typedef usage outside of the actual declaration, don't decrement loop counter 2018-01-16 16:12:07 -06:00
Joseph Poirier 7008ce7f9e
Merge pull request #15 from jpoirier/develop
Develop
2018-01-11 23:06:56 -06:00
Joseph Poirier e96fabfe56
fix linked list test 2018-01-11 23:04:24 -06:00
Joseph Poirier c053f13e4f
back to original left shift code due to test regression from commit ba652ebe584 2018-01-11 21:49:58 -06:00
Joseph Poirier a9e185ae4d
printf tweaks 2017-08-15 00:33:14 -05:00
Joseph Poirier 3b800edbde
initial long printf fix 2017-08-15 00:23:31 -05:00
Joseph Poirier 3a0bf87bb0
proper typecast, L/R shift fixes 2017-08-14 23:53:36 -05:00
Joseph Poirier e4a559a1dc
remove some tabs 2017-08-14 22:54:09 -05:00
Joseph Poirier df15ea775c
type fixes 2017-08-14 22:50:16 -05:00
Joseph Poirier e1f6569393 test 2015-07-06 04:17:31 -05:00
Joseph Poirier 6ed4aa1b63 formatting 2015-06-22 14:16:49 -05:00
Joseph Poirier f551e28a49 formatting 2015-06-21 20:54:56 -05:00
Joseph Poirier 6e1c3aa71d formatting 2015-06-20 06:16:30 -05:00
Joseph Poirier 44ec8b0ccf line continuation handling, not fully working 2015-06-20 00:08:39 -05:00
Joseph Poirier 57190f3366 tokenize 2015-06-19 05:06:51 -05:00
Joseph Poirier 9316233d16 formatting, initial multiline macro support 2015-06-19 04:45:51 -05:00
Joseph Poirier 27b73e91de formatting 2015-06-18 23:49:13 -05:00
Joseph Poirier b117a0a132 explicit typecast 2015-06-18 23:45:12 -05:00
Joseph Poirier 255b19e51b formatting 2015-06-18 23:20:10 -05:00
Joseph Poirier 9c05060820 initialize 2015-06-18 22:49:47 -05:00
Joseph Poirier 26b21d04be formatting 2015-06-18 15:53:11 -05:00