Commit Graph

451 Commits

Author SHA1 Message Date
Irmen de Jong
0e086d788b removed chained comparisons again, because they caused invalid expression evaluations due to changed semantics. 2024-01-01 16:00:11 +01:00
Irmen de Jong
d1f8ee1e56 replace most common subexpressions by a single temp variable 2024-01-01 14:57:24 +01:00
Irmen de Jong
d03ff1e4d0 improved var -> const replacement, now done in constfolding already (fixes some obscure problems later on)
Also fixed some directive parenting errors
2023-12-29 19:48:40 +01:00
Irmen de Jong
932bbd0381 allow casting of byte<->ubyte and word<->uword 2023-12-29 16:23:24 +01:00
Irmen de Jong
ccc11e49d2 fix asmgen for uword shift right 8 or more bits 2023-12-29 05:06:09 +01:00
Irmen de Jong
d28c994ecd directive really needs to be listed out in the parser otherwise it confuses it with % modulo :-(
Also fix missing const fold pass in optimizer
2023-12-29 03:45:20 +01:00
Irmen de Jong
bcc4bf5c2b almost forgot 2023-12-28 20:39:27 +01:00
Irmen de Jong
37fcde30d6 constants have p8c_ prefix instead of p8v_ in the asm 2023-12-28 05:28:32 +01:00
Irmen de Jong
09c6cb4d6b replace unwritten vars by consts. Improved const eval.
Fixed some slight bugs in library code
2023-12-28 05:17:15 +01:00
Irmen de Jong
b428343c2a tweak chained comparisons 2023-12-28 02:31:39 +01:00
Irmen de Jong
dfce292294 allow chained comparisons i<x<j (desugared into: i<x and x<j) 2023-12-28 01:18:59 +01:00
Irmen de Jong
2b8f613a00 added %option ignore_unused to suppress warnings about unused vars and subs in that module/block.
Also improved error for invalid directive.
2023-12-26 23:37:59 +01:00
Irmen de Jong
4bb2b8ca9b make isArray a computed property by simply checking the datatype 2023-12-26 19:58:08 +01:00
Irmen de Jong
5179562fb2 can be val 2023-12-26 19:39:02 +01:00
Irmen de Jong
0a4de45453 get rid of vardecl.declareddatatype 2023-12-26 19:33:58 +01:00
Irmen de Jong
66d939df0d docs about new asm symbol prefixes 2023-12-20 22:37:46 +01:00
Irmen de Jong
6bc079c7b7 more asm symbol prefixing: variables with p8v_, subroutines with p8s_ etc
labels with p8l_ . All this to avoid symbol clashes in the generated assembly code.
Everything got its own distinguishing prefix so we're done with it once and for all and have only 1 breaking change moment.
2023-12-20 22:20:59 +01:00
Irmen de Jong
69f6afe420 block names in asm now prefixed with p8b_ (instead of p8_)
as part of fixing var versus block symbol conflict handling
2023-12-19 23:00:20 +01:00
Irmen de Jong
b7279a3d9e fix 'not in' parsing error
fixes #115
2023-12-19 19:49:25 +01:00
Irmen de Jong
a8be94de6b better error message when attempting to cast a float to integer 2023-12-15 22:28:06 +01:00
Irmen de Jong
e98e951834 fix chained assignment and multi-vardecl RHS evaluation 2023-12-10 16:44:51 +01:00
Irmen de Jong
ef1c665b9a allow underscores for numerical grouping 2023-12-09 13:13:34 +01:00
Irmen de Jong
d56565be25 fix multi-var decl 2023-12-09 12:32:41 +01:00
Irmen de Jong
e076b3aedc fix multi-var decl in nested scopes 2023-12-09 12:07:09 +01:00
Irmen de Jong
ae3b2ddf5f allow multi var declarations for floats too 2023-12-08 23:29:13 +01:00
Irmen de Jong
1bdc427d73 multi var declarations ubyte x,y,z 2023-12-08 22:18:21 +01:00
Irmen de Jong
6a639ce533 chained assignments x=y=z=42 2023-12-08 01:07:16 +01:00
Irmen de Jong
8e4319cd5a module directive %encoding to set the text encoding for that whole file (iso, petscii, etc.) 2023-12-06 23:54:08 +01:00
Irmen de Jong
ee782e92ac fix cast error and vm float parsing 2023-12-05 22:51:15 +01:00
Irmen de Jong
b09e0a05bf some tweaks to errors about long integer literals 2023-12-03 02:45:26 +01:00
Irmen de Jong
c609e982fe allow const expression intermediate values to be 32 bits integers to avoid needless overflow errors. 2023-12-03 01:48:12 +01:00
Irmen de Jong
c45fbe6310 continue stmt added 2023-11-25 01:14:35 +01:00
Irmen de Jong
62d3f01948 fix name check in inline asm
this no longer removes a subroutine that is otherwise only called from inlined asm.
2023-11-21 01:26:50 +01:00
Irmen de Jong
7e3b8c2c59 fix compiler crash on certain subroutine inlining attempts. 2023-11-09 21:16:12 +01:00
Irmen de Jong
3b0d7ea960 better const-evaluation of addressOf a memory mapped variable 2023-11-08 22:04:41 +01:00
Irmen de Jong
ee2888e744 verafx.mult/muls now return upper 16 bits of the result in r0 2023-11-06 21:55:58 +01:00
Irmen de Jong
0904712a00 remove last trace of getTempVar (arry index expression)
tiny optimization
2023-10-27 21:41:52 +02:00
Irmen de Jong
880c0a5da8 allow taking address of array element 2023-09-18 04:37:41 +02:00
Irmen de Jong
00b0ec58b4 update to Antlr 4.13.1 2023-09-14 21:11:55 +02:00
Irmen de Jong
6afdd4e6fd preparing next version 2023-09-12 21:53:49 +02:00
Irmen de Jong
c15c10a94e fixed 'unroll CONSTANTEXPR' compiler errors 2023-09-05 01:03:35 +02:00
Irmen de Jong
525a9b5036 prepare parser to allow chained array indexing later 2023-09-03 19:06:47 +02:00
Irmen de Jong
66857ca477 prepare parser to be more flexible with array indexed expressions 2023-08-15 13:07:01 +02:00
Irmen de Jong
f98ee326b4 error when doing txt.print('@') where "@" was intended (byte for string parameter) 2023-08-14 19:25:31 +02:00
Irmen de Jong
2c9e50873c use math.square for optimized X*X calculation (words only).
Added IR SQUARE instruction.
2023-08-14 01:05:17 +02:00
Irmen de Jong
7c0bde7310 parser: allow curly brace on next line for asmsub too
downgrade antlr4 one version again to what is used in IntelliJ's antlr plugin, to avoid potential version conflicts
2023-08-09 20:01:12 +02:00
Irmen de Jong
c223702ea0 code cleanups 2023-07-30 18:42:45 +02:00
Irmen de Jong
70c9ab9074 upgrade libraries 2023-07-06 23:33:58 +02:00
Irmen de Jong
6d1fdf1ba6 upgrade to Kotlin 1.9.0 2023-07-06 23:03:47 +02:00
Irmen de Jong
0db141eeac todo 2023-07-02 21:19:33 +02:00