Commit Graph

34 Commits

Author SHA1 Message Date
Andrius Štikonas 185ef7a7c2 Improve handling of compound assignment operators.
Previously, compound assignment operators were replaced in preprocessor.
This only worked for simple cases where we only had 1-token variable.

This commit switches to proper implementation in the parser.
2021-11-15 00:06:08 +00:00
Andrius Štikonas ba51f3dcc8 Fix a crash. 2021-11-11 23:54:44 +00:00
Andrius Štikonas b2414918cc Add support for assignment operators. 2021-11-11 21:18:14 +00:00
Andrius Štikonas ae48dbd6cb Add riscv64 port. 2021-10-02 11:59:21 +01:00
Jeremiah Orians da542698e7
Fix all special cases where line number was wrong 2021-05-28 23:27:17 -04:00
Jeremiah Orians d80d8a652b
Move more functionality into M2libc 2021-04-03 22:41:52 -04:00
Sanne Wouda a8551f2fcd Implement --bootstrap-mode for preprocessor
- // and # lines always appear in the result of read_all_tokens

- in bootstrap mode, // tokens (but not the subsequent lines) and #
  lines are stripped. no preprocessing happens.

- in non-bootstrap mode, // lines are stripped and # lines stay for the
  preprocessing phase

- updates tests to pass --bootstrap-mode when necessary
2021-01-09 17:38:50 +00:00
Sanne Wouda cd96f65a23 Add macro directives to token_list
- change the lexer to not remove preprocessor directives
- preprocess() removes any lines starting with a macro directive that it
  doesn't understand (which is currently all of them)
2021-01-05 22:53:39 +00:00
Sanne Wouda a18e0c1782 Add newline tokens to parse stream
- needed to determine start and end of macro directives
- the main parser doesn't need them, so strip out the newline tokens
  before parsing to avoid changing it
2021-01-05 22:23:15 +00:00
Sanne Wouda fa0f135ebb Fix typo 2021-01-03 13:16:55 +00:00
Jeremiah Orians 921cc86ce6
First generation implemention of typedef 2021-01-02 22:00:02 -05:00
Jeremiah Orians e7a0ecd244
Cleared out non-essential string primitives and added support for --max-string 2020-12-19 09:46:22 -05:00
Jeremiah Orians 57264eb157
Catch potential segfaulting behavior in generated binaries 2020-11-08 21:13:12 -05:00
Jeremiah Orians 0709770730
Enabled forgotten cleanup scripts and add logic to catch ?alloc errors 2020-01-25 14:15:45 -05:00
Jeremiah Orians 4b2a048f14
Start reducing number of segfaults possible in M2-Planet 2020-01-22 18:03:28 -05:00
Jeremiah Orians 923784c797
Starting to restrict bad input 2020-01-21 17:50:26 -05:00
Jeremiah Orians 420f8b62b9
1/24 working tests for AMD64 Port 2019-04-17 20:19:17 -04:00
Jeremiah Orians 25d57d7d59
Adding support for octal and binary numbers 2019-01-27 22:35:44 -05:00
Jeremiah Orians 9a2c6b4019
Harmonized License headers and added missing license headers 2018-10-17 19:27:06 -04:00
Jeremiah Orians df451c1728
Code Clean up done during knight platform bootstrap work 2018-08-10 17:30:48 -04:00
Jeremiah Orians eb8b3e4eb4
Reduced Memory usage by another 50% 2018-07-26 19:51:44 -04:00
Jeremiah Orians 7833cd5660
Reduced Memory allocation from 4KB per token string to size of string
+ fixed null padding
2018-07-26 18:27:32 -04:00
Jeremiah Orians 95fa0de49f
Fixed ARM build issue 2018-07-21 12:45:19 -04:00
Jeremiah Orians dc94afb558
Lots of clean and enhancements to simplify task of writing it in assembly. 2018-07-19 22:33:02 -04:00
Jeremiah Orians 280b2ade52
bug clean up and new functionality 2018-06-01 20:05:27 -04:00
Jeremiah Orians cba66b015b
Catching up on enhancements 2018-05-26 16:33:00 -04:00
Jeremiah Orians f6752b2802
Added additional functionality such as mixed structs, do while loops,
gotos and tests for the new functionality
2018-01-24 20:00:22 -05:00
Jeremiah Orians 4602adb0b1
Converted from legacy M2-Planet Input.c Output.c to M2-Planet -f input.c ... -f inputN.c -o output.M1 2018-01-20 22:56:50 -05:00
Jeremiah Orians cb866c127b
Initial prototype for struct support in M2-Planet (it is still very ugly) 2018-01-11 21:46:20 -05:00
Jeremiah Orians 9fe1a878cc
Added CONSTANT to the language and fixed Capitalization problems 2017-12-19 15:44:27 -05:00
Jeremiah Orians 18e433def4
Broke out globals and now reduce the memory churn in string creation 2017-12-15 18:17:29 -05:00
Jeremiah Orians e25401c0b8
Moved strings to the bottom of the output 2017-12-14 17:01:30 -05:00
Jeremiah Orians 32e1f700bc
Isolated global_token to cc.c and added FOR Loop support along with example 2017-11-08 18:05:54 -05:00
Jeremiah Orians fd27258305
Initial public release of M2-Planet 2017-11-05 09:23:17 -05:00