Commit Graph

351 Commits

Author SHA1 Message Date
Irmen de Jong
e227cc92ff new ast: regular subroutine has just 0 or 1 return type 2022-03-12 14:12:06 +01:00
Irmen de Jong
3961f26635 consolidating modules 2022-03-11 20:45:39 +01:00
Irmen de Jong
e51c274a18 reducing dependencies 2022-03-11 20:32:35 +01:00
Irmen de Jong
e75d0c58a9 reducing dependencies 2022-03-10 23:46:43 +01:00
Irmen de Jong
9a798360f4 introduced codeAst and codeCore modules to reduce dependencies 2022-03-10 22:38:16 +01:00
Irmen de Jong
abcdd331db started with a simulator 2022-03-10 21:23:00 +01:00
Irmen de Jong
179a7a2792 reducing dependencies 2022-03-10 02:17:06 +01:00
Irmen de Jong
251b6fcf70 reducing dependencies 2022-03-10 02:09:34 +01:00
Irmen de Jong
ab1fffb721 reducing dependencies 2022-03-10 01:41:42 +01:00
Irmen de Jong
da352a322c reducing dependencies 2022-03-10 01:27:27 +01:00
Irmen de Jong
f7aa0c45df optimize imports 2022-03-05 15:54:42 +01:00
Irmen de Jong
a72d58cdf9 updated 3rd party library versions 2022-03-05 15:28:22 +01:00
Irmen de Jong
fc1c3c6808 working on altered pipe syntax 2022-03-02 20:58:38 +01:00
Irmen de Jong
96ba895b84 working on altered Pipe syntax 2022-02-27 02:42:28 +01:00
Irmen de Jong
c5504c6657 added ATASCII encoding table for atari 2022-02-25 23:48:39 +01:00
Irmen de Jong
6a0551cea1 added 'atari' compiler target beginnings (Atari 800 XL)
also default char and string encoding now taken from compiler target
2022-02-22 00:52:35 +01:00
Irmen de Jong
064a8e785c cleanups 2022-02-21 03:26:17 +01:00
Irmen de Jong
60b2c44a44 fix returntype handling of builtinfunctions, fix errors in pipe expressions 2022-02-21 01:44:29 +01:00
Irmen de Jong
c4fe3ecc0a refactor 2022-02-20 22:04:18 +01:00
Irmen de Jong
2f18a8f6d0 introduced BuiltinFunctionCall (expression) node for codegen 2022-02-20 02:48:27 +01:00
Irmen de Jong
7a2164b4d0 introduced BuiltinFunctionCallStatement node for codegen 2022-02-18 23:27:11 +01:00
Irmen de Jong
41fece4643 slight tweaks related to builtin functions in the ast 2022-02-17 01:25:13 +01:00
Irmen de Jong
af0e7f7187 searching names in inlined assembly now ignores source comments 2022-02-13 13:41:12 +01:00
Irmen de Jong
c8cd6e9460 removed old @"screencodes" string encoding syntax (use sc:"hello" instead) 2022-02-11 22:07:14 +01:00
Irmen de Jong
0cd27d6129 fix empty lines in subroutine ast printing 2022-02-11 21:44:38 +01:00
Irmen de Jong
b47fc1c020 renames of some Ast node classes 2022-02-11 00:34:36 +01:00
Irmen de Jong
bd0dee5db5 cleanup 2022-02-10 22:22:50 +01:00
Irmen de Jong
08bacdd090 temp vars are now dynamically added to AST as needed 2022-02-10 02:52:47 +01:00
Irmen de Jong
98b2855b9c cleanups 2022-02-09 16:35:52 +01:00
Irmen de Jong
1307bdc612 more cleanups to the allocator 2022-02-08 22:46:49 +01:00
Irmen de Jong
8c2e6971fc start using vars instead of callgraph (2) 2022-02-08 21:09:00 +01:00
Irmen de Jong
7d67005709 more rewrite variable allocation 2022-02-08 20:40:10 +01:00
Irmen de Jong
6bdd81623f cleaning up AsmGen interface 2022-02-06 17:07:03 +01:00
Irmen de Jong
1ab635bd7e small tweak of parse messages 2022-02-05 14:02:24 +01:00
Irmen de Jong
30e1c3307c simplify SourceCode: just read the full text immediately. Also optimized imports. 2022-02-05 03:50:54 +01:00
Irmen de Jong
6916b8bff7 remove redundant properties 2022-02-03 23:59:24 +01:00
Irmen de Jong
5c8c64242f callgraph: nameInAssemblyCode searches smarter (for unused()) 2022-02-01 00:33:05 +01:00
Irmen de Jong
ddf96943f0 remove Nop ast node. 2022-01-31 22:36:10 +01:00
Irmen de Jong
a170506356 simplify IdentifierReference equality check back to default (name+pos) 2022-01-27 23:32:55 +01:00
Irmen de Jong
5ecf2a3357 enable more optimizations for typecasted assignments. Fixed missing codegen for assigning bytes to words in certain cases. 2022-01-27 18:05:25 +01:00
Irmen de Jong
08db72903c for long containment checks use a subroutine instead of huge cmp-table 2022-01-24 22:40:22 +01:00
Irmen de Jong
4bf4771f08 fix @requirezp in astToSource. Fix sometimes allocating zeropage variables in normal ram. 2022-01-23 13:42:52 +01:00
Irmen de Jong
7afc96112b now correctly requires using & (address-of) when assigning the address of a label or subroutine, used to generate invalid code when it was omitted 2022-01-23 02:23:30 +01:00
Irmen de Jong
9219ec539d allow "goto pointervar" for indirect jumps 2022-01-21 22:55:59 +01:00
Irmen de Jong
6b02f2eea0 implement iso encoding and new string encoding syntax, fixes #38 2022-01-19 21:21:32 +01:00
Irmen de Jong
3b59592110 generalize string encoding flag into enum 2022-01-18 21:21:49 +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
8e56656c8d fix broken code generated for certain ==/!= expressions 2022-01-16 17:10:49 +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
e425c4cca8 optimizing pipe codegen 2022-01-11 23:17:35 +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
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
a23281afab added experimental -noreinit option 2022-01-01 16:35:36 +01:00
Irmen de Jong
d8f7feb672 cleanup code style 2021-12-30 18:47:38 +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
de6ce4a46e add "X in [1,2,3]" expression (efficient containment check) 2021-12-29 17:26:00 +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
98d25fc4e9 fix some unneeded open classes 2021-12-28 01:29:08 +01:00
Irmen de Jong
1c7c4fc3b0 optimized if-goto codegeneration 2021-12-28 00:42:00 +01:00
Irmen de Jong
c55fdd9834 removed special code generation for while and util expression (replaced by jumps)
also added exhaustive parent node checker in validation step
2021-12-27 02:04:28 +01:00
Irmen de Jong
08f87c321f fixed capitalization of operator sets to be consistent with other sets names 2021-12-15 23:43:14 +01:00
Irmen de Jong
b21f7411dd fix compiler crash when trying to concatenate string var and string literal. 2021-12-14 23:07:46 +01:00
Irmen de Jong
33061aaa0d fix: allow scoped variables such as cx16.rX as loop variable in forloops 2021-12-10 14:59:04 +01:00
Irmen de Jong
84f75f4156 tweaked some more .getOrElse 2021-12-06 21:22:00 +01:00
Irmen de Jong
edffe92a24 astchecker is smarter in detecting rts in inline assembly 2021-12-05 21:28:31 +01:00
Irmen de Jong
81deed143b fix grammar problem: \x and \u escape sequences didn't work in character literals. 2021-12-05 18:11:40 +01:00
Irmen de Jong
c92f914081 gradle build settings tweak to avoid jdk version conflict 2021-12-04 18:36:47 +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
fbcd9a0c1d reduce number of similar errors for type problem in assignment 2021-12-02 17:44:52 +01:00
Irmen de Jong
f0dadc4a43 optimize 1-arg functioncalls 2021-11-28 16:55:10 +01:00
Irmen de Jong
960b60cd2d tweak 2021-11-28 14:06:12 +01:00
Irmen de Jong
42fe052f9f got rid of old getScopedSymbolNameForTarget routine 2021-11-26 21:09:29 +01:00
Irmen de Jong
58d9c46a9b got rid of old makeScopedName routine 2021-11-26 20:56:30 +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
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
8095c4c155 added GoSub node (internal use only later for calling subroutines) 2021-11-21 16:23:48 +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
eacf8b896a fix augmentable check to align with what the asmgen understands 2021-11-20 22:06:51 +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
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
4f5d36a84d optimization added: bitwise operations with a negative constant number -> replace the number by its positive 2 complement 2021-11-18 02:51:42 +01:00
Irmen de Jong
8f379e2262 give an error when initializing an integer var with a float value instead of silently rounding 2021-11-18 01:56:11 +01:00
Irmen de Jong
52bedce8f4 added test for assignment.isAugmented 2021-11-18 01:05:16 +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