Irmen de Jong
fe51698579
tweak how zp varnames are stored
2022-01-16 17:20:36 +01:00
Irmen de Jong
a798fe72d3
cx16 reserved zp vars (virtual registers)
2022-01-16 17:20:36 +01:00
Irmen de Jong
7dd2517f67
fix Zp allocation issues
2022-01-16 17:20:36 +01:00
Irmen de Jong
641477d6f6
add @requirezp and allow str/array to be on zp (with warning)
2022-01-16 17:20:32 +01:00
Irmen de Jong
c58b8a4973
fix ast to source: @shared wasn't printed
...
fix grammar: @shared and @zp can occur in any order now in vardecl
2022-01-13 02:29:55 +01:00
Irmen de Jong
056ec986c2
use var initializer assignments in a clearer way
2022-01-11 00:34:44 +01:00
Irmen de Jong
de3b2fb95b
slightly optimized certain list iterations into sequences
2022-01-10 23:15:24 +01:00
Irmen de Jong
b29c3152db
Assignment: make its origin explicit
2022-01-10 02:25:02 +01:00
Irmen de Jong
3831679772
VarDecl: make its origin explicit
2022-01-10 01:53:03 +01:00
Irmen de Jong
895534f32b
don't remove dead variable assignments if they are a function call
2022-01-09 18:41:01 +01:00
Irmen de Jong
50c16fe6de
code size optimization: don't copy floats with inlined copy code but use copy_float routine
2022-01-09 16:18:13 +01:00
Irmen de Jong
6fa3f0b6cd
small refactor
2022-01-08 18:02:38 +01:00
Irmen de Jong
d99d977d2b
fix more typecasting issues
2022-01-08 17:04:25 +01:00
Irmen de Jong
7dd7e562bc
pipes also as expressions, cleanup codegen, fix various typecasting issues
2022-01-08 13:45:19 +01:00
Irmen de Jong
17694c1d01
better error handling of invalid number casts
2022-01-07 22:12:13 +01:00
Irmen de Jong
749ad700d8
naming consistency for some expression classes
2022-01-07 21:02:55 +01:00
Irmen de Jong
8f3df3039a
added pipe operator `|>
`
2022-01-06 22:54:18 +01:00
Irmen de Jong
02c315c194
add missing unit tests and type checking for 'in' expression
2022-01-06 00:01:49 +01:00
Irmen de Jong
96225efd96
library doc tweaks
2022-01-03 23:15:34 +01:00
Irmen de Jong
74257163b1
fix that memory("name", ...) also allocates a STR variable for the name
2022-01-02 17:07:04 +01:00
Irmen de Jong
7bc75fd220
fix that memory("a b c", ...) produces invalid symbol
2022-01-02 16:11:53 +01:00
Irmen de Jong
a23281afab
added experimental -noreinit option
2022-01-01 16:35:36 +01:00
Irmen de Jong
c15a75556d
Merge branch 'master' into c128target
...
# Conflicts:
# compiler/src/prog8/CompilerMain.kt
# examples/test.p8
2021-12-30 18:22:05 +01:00
Irmen de Jong
5267e06969
added -asmlist cli option to produce assembler listing output
2021-12-30 14:42:09 +01:00
Irmen de Jong
05a1ddad05
Merge branch 'master' into c128target
...
# Conflicts:
# examples/test.p8
2021-12-29 18:14:24 +01:00
Irmen de Jong
de6ce4a46e
add "X in [1,2,3]" expression (efficient containment check)
2021-12-29 17:26:00 +01:00
Irmen de Jong
7a9e5afb93
fix: for loop over array literal no longer crashes the compiler
2021-12-28 17:51:38 +01:00
Irmen de Jong
b2876b0a03
add a suggestion to use when statement if it seems appropriate
2021-12-28 16:38:12 +01:00
Irmen de Jong
30f04962d4
Merge branch 'master' into c128target
...
# Conflicts:
# codeGeneration/src/prog8/codegen/target/C128Target.kt
# codeGeneration/src/prog8/codegen/target/c128/C128MachineDefinition.kt
# codeGeneration/src/prog8/codegen/target/c128/C128Zeropage.kt
# compiler/src/prog8/CompilerMain.kt
# compiler/src/prog8/compiler/Compiler.kt
2021-12-28 14:30:11 +01:00
Irmen de Jong
0feeb88024
codegen package rename 2
2021-12-28 14:23:36 +01:00
Irmen de Jong
56d21de001
Merge branch 'master' into c128target
...
# Conflicts:
# examples/test.p8
2021-12-28 13:57:27 +01:00
Irmen de Jong
7b54aa0c7d
more consistent naming of the statement classes
2021-12-28 13:56:47 +01:00
Irmen de Jong
6e11b8ada1
GoSub no longer inherits from Jump node, fixes subtle ast/codegen bugs related to jsrs
2021-12-28 01:55:13 +01:00
Irmen de Jong
67b0890a6e
remove unneeded var inits when an assignment is already present
2021-12-25 23:31:25 +01:00
Irmen de Jong
6da83e2bd7
first steps to add C128 compiler target
2021-12-21 19:08:33 +01:00
Irmen de Jong
77c2b2b326
fix position of @shared in array var declarations so that the order is now type[] @shared
2021-12-16 20:36:05 +01:00
Irmen de Jong
629117e594
code size optimization: subroutine calls with 1 int arg will pass it via register instead of separate param assignment at every call site
2021-12-16 00:56:59 +01:00
Irmen de Jong
1ff13723fe
implicit int to float conversion is now an error if floats are not enabled.
2021-12-15 01:52:28 +01:00
Irmen de Jong
510bda1b28
fix compiler crash when using floats in a comparison expression
2021-12-15 01:24:25 +01:00
Irmen de Jong
3d743a1ba1
added more constfolding
2021-12-09 23:32:48 +01:00
Irmen de Jong
abca618008
added more constfolding
2021-12-09 23:12:12 +01:00
Irmen de Jong
0d2c3901a3
added more constfolding
2021-12-09 22:12:31 +01:00
Irmen de Jong
d8d56b195f
comments
2021-12-09 21:13:13 +01:00
Irmen de Jong
98315de723
allow using ubyte[] as subroutine parameter type (because it is equivalent to uword pointer var)
2021-12-07 23:28:45 +01:00
Irmen de Jong
dcf487bdc1
fix: correctly insert return statement if needed to prevent 'fall through' into following subroutine
...
this wasn't working correctly anymore when the last statement before the subroutine was a jump/goto
2021-12-07 21:34:50 +01:00
Irmen de Jong
837804b231
test for string x and u escape sequences
2021-12-05 18:39:34 +01:00
Irmen de Jong
0018dc6ce7
refactor machinedefinition
2021-12-04 19:07:19 +01:00
Irmen de Jong
0498444ef2
moved all unit tests into single project to avoid dependency issues
2021-12-04 18:20:22 +01:00
Irmen de Jong
ce3c34e458
tweak in error output for file links, corrected column number off-by-one
2021-12-04 16:52:03 +01:00
Irmen de Jong
b867d8f731
cleanups
2021-12-04 01:03:51 +01:00
Irmen de Jong
b7fffbb6df
release 7.4.1 - oops, funcion call arg count validation was broken
2021-12-01 21:44:03 +01:00
Irmen de Jong
3d1d0696b9
refactor compiler arguments passing
2021-11-30 01:40:21 +01:00
Irmen de Jong
9ecf95b075
fix syntaxerror in const processing of ranges if it contained variables
2021-11-29 23:36:41 +01:00
Irmen de Jong
a2db44f80c
also consider Y register for clobber check for functioncall arguments
2021-11-29 22:09:05 +01:00
Irmen de Jong
c838821615
refactor fuction arguments codegen a bit
2021-11-27 21:14:21 +01:00
Irmen de Jong
110e047681
replace subroutine calls (statement) by GoSub
2021-11-26 19:47:01 +01:00
Irmen de Jong
17d403d812
Merge branch 'ref-subroutine-param' into v7.4-dev
...
# Conflicts:
# compilerAst/src/prog8/ast/AstToplevel.kt
2021-11-26 01:12:14 +01:00
Irmen de Jong
e52d05c7db
fix some scoping related symbol lookup issues, clarified scoping rules in docs
2021-11-23 23:43:23 +01:00
Irmen de Jong
b00db4f8a2
no longer report unknown type errors as well for unknown symbols,
...
added a bunch more unit tests for symbol scoping rules
2021-11-23 22:45:57 +01:00
Irmen de Jong
ff715881bc
allow scoped identifiers to reference a subroutine parameter directly.
...
also for asmsubroutines, but the asm generation for that is not yet done.
2021-11-21 23:21:39 +01:00
Irmen de Jong
8887e6af91
fix substituting 0 only if its actually the same variable that's substituted
2021-11-21 12:34:57 +01:00
Irmen de Jong
b292124f3c
replaced many short/int values by unsigned types if appropriate
2021-11-21 00:55:56 +01:00
Irmen de Jong
c0035ba1a2
char encodings now use UByte type instead of short
2021-11-21 00:07:17 +01:00
Irmen de Jong
adfaddbcf4
give a nicer error when given a wrong compilation target.
2021-11-20 18:30:55 +01:00
Irmen de Jong
74db5c6be7
fix referencesIdentifier() and better removal of unnecessary assignments
2021-11-20 17:41:41 +01:00
Irmen de Jong
f9399bcce7
r=(q+r)-c and r=q+(r-c) are now both also 'augmentable', and BinExprSplitter doesn't check for associativeOperator anymore
2021-11-20 02:03:32 +01:00
Irmen de Jong
87600b23db
fix constvalue parent linkage for prefix and typecast
2021-11-20 00:20:35 +01:00
Irmen de Jong
cedfb17b18
fix too aggressive removal of vars that weren't completely unused
2021-11-19 22:49:35 +01:00
Irmen de Jong
fa4c83df6b
added 3 tests for discovered problems
2021-11-18 23:55:20 +01:00
Irmen de Jong
42c8720e8b
fix float rounding tests
2021-11-18 22:54:49 +01:00
Irmen de Jong
b334d89715
refactor and fix the way memory addresses are checked to be in IO space or regular ram
2021-11-18 22:47:58 +01:00
Irmen de Jong
4c82af36e6
fix improperly changed behavior about =0 initializer
2021-11-18 00:17:22 +01:00
Irmen de Jong
dafa0d9138
fix compiler crash bug due to reused ast expression nodes. Now all (relevant) Nodes have a copy() function to make a clone.
2021-11-17 23:05:59 +01:00
Irmen de Jong
f48d6ca9f8
simplified NumericLiteral to always just contain a Double instead of a Number for the value
2021-11-16 23:52:54 +01:00
Irmen de Jong
c858ceeb58
compiler shouldn't use cx16.r15 as temp var
2021-11-14 02:38:59 +01:00
Irmen de Jong
f0f52b9166
optimize typecasted binary expression to avoid even more estack use. also fix wrong parent crash in removal of unused variable's assignments.
2021-11-13 14:22:37 +01:00
Irmen de Jong
3483515346
preparing for more optimizations
2021-11-12 23:23:51 +01:00
Irmen de Jong
75a06d2a40
preparing for more optimizations
2021-11-12 02:17:37 +01:00
Irmen de Jong
53ac11983b
better unused variable removal
2021-11-11 03:03:21 +01:00
Irmen de Jong
8df3da11e3
add cosr8, sinr8, cosr16 and sinr16 builtin functions that take a degree 0..179 (= 0..358 in 2 degree steps)
...
to more easily scale halves/quarters etc of a circle than possible with the ones that take 0..255 'degrees'.
2021-11-09 23:39:26 +01:00
Irmen de Jong
b909facfe5
fix compiler stackoverflow crash on certain typecasted expressions containing floats.
2021-11-09 19:31:19 +01:00
Irmen de Jong
7780d94de1
discovered crash related to float typecasting in asm assignment codegen
2021-11-09 03:45:07 +01:00
Irmen de Jong
4937e004b5
fix compiler crash where it used wrong datatype in split assignment
...
fixes crash for "ubyte bb ;; uword ww ;; bb = not bb or not ww"
2021-11-09 01:13:23 +01:00
Irmen de Jong
2d1e5bbc7e
remove unimportant empty tests
2021-11-08 17:00:10 +01:00
Irmen de Jong
7961a09d16
converting compiler module's testcases to kotest assertions
2021-11-08 16:14:22 +01:00
Irmen de Jong
613efcacc7
converting compiler module's testcases to kotest (ongoing)
2021-11-08 15:08:48 +01:00
Irmen de Jong
eea3fb48a8
add command line option 'optfloatx' to explicitly re-enable float expr optimization as this can increase code size significantly.
...
The output size of the various example programs using floating point, when not using this optimization, has been reduced significantly.
The resulting code runs a (tiny) bit slower though.
2021-11-03 22:52:08 +01:00
Irmen de Jong
b4fa72c058
fix parent node linkage for reading array parameter
2021-11-03 21:57:31 +01:00
Irmen de Jong
7e287a5359
proper parent node linkage in generated const values out of typecast expressions. Fixes crash mentioned in #72
2021-11-02 00:47:01 +01:00
Irmen de Jong
1110bd0851
fix vardecl initialization value to not use stack eval anymore but separate assignment
...
(this causes the optimized assignment code gen to be used instead)
but some programs now end up larger in output size
2021-11-01 00:24:15 +01:00
Irmen de Jong
dfbef8495d
got rid of ParsingFailedError
2021-10-30 17:05:23 +02:00
Irmen de Jong
7b17c49d8f
update petscii tables with improvements to box drawing chars. fixes #68
2021-10-30 16:45:23 +02:00
Irmen de Jong
4b3f31c2ee
added option to suppress assembler output (and enabled this in unit tests)
2021-10-30 15:26:40 +02:00
Irmen de Jong
9ccc65bf8f
more petscii tests
2021-10-30 15:15:11 +02:00
Irmen de Jong
3767b4bbe7
'Program' is not an ast Node
2021-10-30 00:25:34 +02:00
Irmen de Jong
d7d2eefa4f
implemented CharLiteral.constValue()
2021-10-30 00:05:55 +02:00
Irmen de Jong
6737f28d1e
moved unittests of compilerInterfaces into compiler module itself
2021-10-29 23:46:51 +02:00
Irmen de Jong
3da9404c2d
removed memsizer arg from all builtin functions
2021-10-29 23:38:31 +02:00
Irmen de Jong
1137da37c3
reshuffle ErrorReporter
2021-10-29 17:02:03 +02:00
Irmen de Jong
495a18805c
move asmgen test to codeGeneration module
2021-10-29 16:20:53 +02:00