meisl
db76c8d7f4
-/* remove IStringEncoding as param in compilerAst, and all other uses that were only because of that.
...
For good measure we also turn on *all* compiler tests with examples (they do take some time).
Note that the total *mentions* of IStringEncoding in the entire project went down from ~50 to 6, only 3 of which are *actual uses* (the others are 2 imports and 1 supertype ref in ICompilationTarget : IStringEncoding)!
2021-07-17 22:08:17 +02:00
meisl
de92740e87
* simple refactoring: move IStringEncoding, IMemSizer and IBuiltinFunctions to files of their own, also ext method Number.toHex to file compilerAst/src/prog8/ast/Extensions.kt. Moved the other interfaces that are indeed closely related to Node to the top of AstToplevel.kt. *This is really ONLY moving text around*, so it's easier to find things. Nothing else.
2021-07-17 21:29:01 +02:00
meisl
522bf91c30
* refactor RangeExpr, step 2: make toConstantIntegerRange and size *extension methods* and move them to compiler/astprocessing/AstExtensions.kt (along with the simple helper makeRange). They are in fact *only* used from the compiler module - strong indication that they actually belong there.
2021-07-17 21:13:34 +02:00
meisl
48d3abc1fe
* refactor RangeExpr, step 1: remove IStringEncoding as ctor arg and instead put it as arg to the two methods that actually depend on it: toConstantIntegerRange and size (as *it* calls the former)
2021-07-17 20:45:17 +02:00
meisl
34ba07ee3b
+ expose #55 : float[] initializer as range where no array size is stated
2021-07-17 16:30:16 +02:00
meisl
0567168ea9
+ add AST node CharLiteral, *without* turning them into ubyte s. This breaks tests, particularly 3 in TestCompilerOnCharLit. I'm comitting this separately since the failure modes might be of interest (compiler says "internal error").
2021-07-11 21:32:18 +02:00
meisl
c80a15846d
* some more housekeeping re tests: gradle doesn't like .* imports for annotations, added @Disabled comments, made warnings go away
2021-07-11 19:04:53 +02:00
meisl
5e194536a8
* refactor compiler tests, again prog8test.helpers (TODO: remove duplication)
2021-07-11 18:18:27 +02:00
meisl
43c5ab8ecc
* refactor compilerAst tests, intro prog8test.helpers, @Disable the 3 tests that will pass after subsequent steps of "the plan"
2021-07-11 17:32:29 +02:00
meisl
6c42221620
* fix AstToSourceCode: missing semicolon in header and footer, missing "@" for strings with altEncoding
2021-07-11 14:28:09 +02:00
meisl
0d73a7cd07
+ add TestAstToSourceCode.kt (all 8 new tests failing due to missing semicolon)
2021-07-11 14:11:32 +02:00
meisl
6fa50a699f
+ add two tests for parseModule with empty source text (from File and from String)
2021-07-10 21:03:40 +02:00
meisl
ddaef3e5d5
+ add tests for SourceCode.fromResources; refactor tests
2021-07-10 20:55:23 +02:00
meisl
c3e9d4a9f8
* make resources available in compilerAst/test s; *you may have to re-import the gradle project into IDEA*
...
Note: these resources are NOT going into the production .jar
2021-07-10 20:50:07 +02:00
meisl
7530fb67c8
+ add tests for inner nodes' positions; refactor tests
2021-07-10 10:10:41 +02:00
meisl
19bb56df47
* no more scattering magic "@embedded@" all over the place: add SourceCode.isFromResources, *change Module.source from type Path to type SourceCode*
2021-07-09 17:32:33 +02:00
meisl
b0073ac933
* used "@embedded@" convention instead of "<res:...>", put it into SourceCode
2021-07-09 16:28:04 +02:00
meisl
137a89da15
* fix (hack) .name, .source and .position of Modules from the parser (via temp. subclass ParsedModule)
...
The temporary subclass ParsedModule : Module is introduced to concentrate all the workaround stuff in one place *while still not changing any public signature* such as of the Module ctor.
The convention used to indicate stuff from resources is still "<res:...>" not "@embedded@"- *note that this is caught by 3 tests in compiler*
2021-07-09 15:52:03 +02:00
meisl
44da7a302f
+ temporarily hack together a module name inside Prog8Parser.parseModule, to make the current all-too-simple import resolution work
2021-07-09 14:01:07 +02:00
meisl
4096aae8d4
* SourceCode.toString() now states both, java class and .origin
2021-07-09 13:55:56 +02:00
meisl
fa5ecd6495
* refactor ModuleImporter: throw the proper NoSuchFileException if import isn't found, return SourceCode? from both, tryGetModuleFromResource and tryGetModuleFromFile
2021-07-09 13:44:24 +02:00
meisl
af209ad50e
+ intro SourceCode, tying together source code text with its *origin*; Prog8Parser now only accepts this
2021-07-09 13:24:05 +02:00
meisl
d31a88206c
* importModule(Path): make tests pass (TODO: importLibraryModule with non-existent path)
2021-07-09 13:13:42 +02:00
meisl
cd4ed8765b
+ add tests for importModule(Path) with invalid path (non-existent or directory) - *failing*
2021-07-09 13:10:42 +02:00
meisl
b6f780d70d
* ModuleImporter: make tests pass
2021-07-09 13:02:30 +02:00
meisl
b071a58ca7
+ add tests - 4 failing in TestModuleImporter
2021-07-09 12:51:07 +02:00
meisl
ce554f7718
* rename test file
2021-07-09 12:49:55 +02:00
meisl
99b1cec2e1
*/+ move ParsingFailedError to Prog8Parser.kt, intro ParseError (soon to replace ParsingFailedError), start testing proper error location info
2021-07-09 12:49:30 +02:00
meisl
46911a8905
+ temporarily add PetsciiEncoding (and Petscii.kt copied from compiler) to parser; .linkParents for child nodes of Module
2021-07-09 12:31:46 +02:00
meisl
4eb61529f6
*/+ rename prog8Parser (generated java) to Prog8ANTLRParser; add Kotlin class Prog8Parser to interface with it
2021-07-09 12:24:17 +02:00
Irmen de Jong
a7736d88a9
got rid of Module.isLibraryModule variable, is now function that derives it from source path
2021-07-04 15:44:25 +02:00
Irmen de Jong
7872d20554
rename spelling mistake
2021-07-02 20:58:17 +02:00
meisl
dcc2549574
* fix 47, add tests
2021-06-18 21:55:03 +02:00
meisl
7c1de81861
* #40 : fix mixed line endings test, now intentionally failing (!): also test sole \r AND do not allow any recovery, neither from parser not lexer.
2021-06-14 22:02:26 +02:00
meisl
eddad20acc
Merge remote-tracking branch 'remotes/origin/master' into issue40(EOF,EOL)
2021-06-13 22:56:24 +02:00
meisl
7daad57862
+ #40 : test for mixed (Unix/Win/Mac) line endings - *TODO: test doesn't actually fail with old grammar, but a built jar does - WHY?!*
2021-06-13 22:49:54 +02:00
meisl
1468049fe9
+ #40 : test that (module-level) blocks *before the last* still must have a newline after their closing }
2021-06-13 22:43:27 +02:00
meisl
3b91e59a79
* #40 : refactor tests
2021-06-13 20:28:01 +02:00
meisl
32bad5df15
+/* #40 : add tests; temporarily undo fix for EOL-after-block so we can see that tests actually fail
2021-06-13 20:08:50 +02:00
Irmen de Jong
3f58eca1be
updated gradle scripts (fixed warnings), updated some library dependencies
2021-06-13 18:10:07 +02:00
meisl
2350843d1d
Merge remote-tracking branch 'remotes/origin/master' into issue40(EOF,EOL)
2021-06-13 16:06:50 +02:00
Irmen de Jong
a2588a178c
added some simple unit tests to the ast parser
2021-06-13 14:59:57 +02:00
meisl
3aa3659bc7
* #40 grammar: handle different EOLs (Win, Unix, Mac) purely in grammar
2021-06-12 20:24:15 +02:00
meisl
b8117394c0
* #40 grammar: don't require EOL after blocks, so .p8 files need not end with that
2021-06-12 17:52:44 +02:00
Irmen de Jong
f2844bdf1a
fix crash when using labels in pointerexpression lab+index
2021-06-10 00:44:12 +02:00
Irmen de Jong
19e99204b9
fix asm symbol name scoping bug and add unit tests for this
2021-06-04 22:42:28 +02:00
Irmen de Jong
9fbe1b38a5
fix old block syntax in ast print routine
2021-06-01 22:08:23 +02:00
Irmen de Jong
d4b69ac79c
improved repeat counter vars allocation (re-use var if possible)
2021-05-30 15:30:34 +02:00
Irmen de Jong
e61a2d7083
slightly optimized repeat loop asmgen
2021-05-30 13:10:05 +02:00
Irmen de Jong
572bb38ddb
update to kotlin 1.5.10
2021-05-29 15:25:17 +02:00
Irmen de Jong
0e614ad6fc
added @shared flag to vardecl to mark variable as shared with assembly code elsewhere, to not have it optimized away
2021-05-19 01:19:25 +02:00
Irmen de Jong
ba96a637be
remove strdedup compiler argument again
...
(string deduplication is the default again but only for known-const strings, i.e. string literals)
2021-05-18 23:52:43 +02:00
Irmen de Jong
c2cac772e3
validate string interning
2021-05-18 23:37:52 +02:00
Irmen de Jong
ca61248861
printing 2-letter strings is now only optimized into direct CHROUT if it's a const string literal
2021-05-16 15:00:40 +02:00
Irmen de Jong
ae5d7705bb
allow correct parsing of source files that don't end in a EOL character. Fixes #40
2021-05-14 17:14:44 +02:00
Irmen de Jong
83639c2535
code style
2021-05-13 01:00:19 +02:00
Irmen de Jong
25d80f4df1
added compiler option to choose string literal deduplication yes/no -- default changed to NO
2021-05-13 00:35:22 +02:00
Irmen de Jong
a20efa56eb
print unmappable character in escaped form in errormessage
2021-05-11 18:09:09 +02:00
Irmen de Jong
8736da1a21
strings of 1 and 2 length no longer optimized into one call to CHROUT - also upgrade to kotlin 1.5.0
2021-05-06 23:46:18 +02:00
Irmen de Jong
7bac7bdc3e
more precise
2021-05-01 13:39:02 +02:00
Irmen de Jong
d5214e2505
fix import paths
2021-04-30 00:16:36 +02:00
Irmen de Jong
d906fcea0e
refactor some type checks
2021-04-30 00:09:15 +02:00
Irmen de Jong
8d3d5f726a
removed Datatype.STRUCT
2021-04-29 00:13:17 +02:00
Irmen de Jong
a9a7068818
removed support for structs. It was too much hassle and complexity and subtle bugs.
2021-04-29 00:01:20 +02:00
Irmen de Jong
17068130bb
removed PROG8_LIBDIR env variables and replaced with -libdirs command line option
2021-04-28 20:04:23 +02:00
Irmen de Jong
a086d6e009
allow labels also in blocks instead of only in subroutines
2021-04-18 23:03:18 +02:00
Irmen de Jong
54d92a027a
fix problems with moving vardecls from inner scope to subroutine scope
2021-04-12 22:53:25 +02:00
Irmen de Jong
319ac3a641
preparing optimizations for if statements
2021-04-12 03:34:58 +02:00
Irmen de Jong
0a03c46351
preparing optimization plan for if statements
2021-04-12 02:37:15 +02:00
Irmen de Jong
b1ef09675b
fix compiler crash for some struct/array initialization assignment literals containing not just numbers
2021-04-10 00:28:32 +02:00
Irmen de Jong
1a64cb38d5
fix compiler crash with assigning certain array values as vardecl initializer
2021-04-08 19:21:17 +02:00
Irmen de Jong
e5ff61f201
allow inlining of subroutines with parameters, and fix inlining of subroutines with variables
2021-04-07 23:38:25 +02:00
Irmen de Jong
3e3b0bcd8b
callgraph improved unused node checking
2021-04-05 20:45:18 +02:00
Irmen de Jong
4c1eb1b12a
callgraph
2021-04-05 20:32:30 +02:00
Irmen de Jong
530d03d284
callgraph
2021-04-05 18:50:46 +02:00
Irmen de Jong
619fa9b65e
callgraph
2021-04-05 18:03:36 +02:00
Irmen de Jong
0032235933
tweak to fix for windows line ending (\r\n) parse errors
2021-04-05 01:49:52 +02:00
Irmen de Jong
b4700af2f5
fix windows line ending (\r\n) parse errors
2021-04-05 00:12:04 +02:00
Irmen de Jong
374e2b311d
refactoring unused code removal and noModification
2021-04-04 16:36:33 +02:00
Irmen de Jong
38ccbac97c
stop after a couple of parse errors (it's not useful to continue for long if there are parse errors)
2021-04-04 12:29:56 +02:00
Irmen de Jong
d582d1cc42
fix inlining subroutines multiple times
2021-04-02 21:23:40 +02:00
Irmen de Jong
6fdc733941
inlining subroutines that contain variable declarations is now possible (gives a warning though)
2021-04-02 18:30:32 +02:00
Irmen de Jong
422b390c48
fix ast node duplication/reference bug in certain optimizers
2021-04-02 16:56:52 +02:00
Irmen de Jong
02e12d8575
improvements for inlined subroutines: fix identifier scoping
2021-04-01 23:16:04 +02:00
Irmen de Jong
bf2d8c3f4b
update kotlin plugin to 1.4.32
2021-03-31 20:52:05 +02:00
Irmen de Jong
d840975054
remove unreached error checks
2021-03-25 21:47:05 +01:00
Irmen de Jong
af4de6d2fc
replacing complex array indexer expressions moved to BeforeAsmGeneration + use cx16 virtualregister instead of adding temp variables for this
2021-03-23 23:44:14 +01:00
Irmen de Jong
bd295ffc99
array indexer complexity is now dealt with in the asm-generator only
2021-03-22 19:40:57 +01:00
Irmen de Jong
cbc3e37a89
stuff
2021-03-22 02:29:59 +01:00
Irmen de Jong
3626828ceb
decided
2021-03-22 01:45:19 +01:00
Irmen de Jong
2950d26c8e
array and struct value assignments now via memcopy instead of assignment per element
2021-03-06 22:10:03 +01:00
Irmen de Jong
7e3e18a5c7
deal with 'bra' better on 65c02
2021-02-28 16:20:03 +01:00
Irmen de Jong
8b1e1e68fa
switch to Kotlin's new JVM IR compilation
2021-02-26 01:10:00 +01:00
Irmen de Jong
d14dac3872
got rid of final traces of heapid, fixed compiler warnings
2021-02-24 00:01:04 +01:00
Irmen de Jong
c677f0a875
fixed string interning to also consider the alt-encoding
2021-02-23 23:27:44 +01:00
Irmen de Jong
219d17de34
reduce dependencies on global compilaiontarget
2021-02-19 18:33:54 +01:00
Irmen de Jong
ab544ee965
improved string constant interning; no longer output duplicate strings in the Ast
2021-02-16 23:43:38 +01:00
Irmen de Jong
1e3930aae2
fix bug in evaluating logical expressions if one of the operands was not boolean 1 or 0
2021-02-14 18:29:05 +01:00
Irmen de Jong
cc0f19653e
added peek() and peekw() builtin functions
2021-02-13 22:38:39 +01:00
Irmen de Jong
d6ffb549f6
reducing dependencies
2021-02-09 01:47:05 +01:00
Irmen de Jong
bcd0db984d
reducing ast dependencies - moved ErrorReporter back to compiler module
2021-02-09 01:15:31 +01:00
Irmen de Jong
d9244f22c2
reducing ast dependencies - separate Ast compilation module
2021-02-09 01:06:11 +01:00