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
a9b0400d13
fixed 'not' operator priority: it now has higher priority as or/and/xor.
2021-11-08 18:38:04 +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
7e8db16e18
moved to kotest assertions in compilerAst module tests
2021-11-07 21:18:18 +01:00
Irmen de Jong
984272beb4
migrated compilerAst module to KoTest (but not finished with the assertions yet)
2021-11-07 17:25:53 +01:00
Irmen de Jong
23961f695d
fixed some parse tree node position end-columns. cleanup some todo's
2021-11-05 22:48:28 +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
1b576f826d
remove unneeded sibling methods
2021-10-31 16:50:15 +01:00
Irmen de Jong
dfbef8495d
got rid of ParsingFailedError
2021-10-30 17:05:23 +02:00
Irmen de Jong
97836e18b2
simplified gradle config, automatically run installDist task after build
2021-10-30 12:01:52 +02:00
Irmen de Jong
7b69df4db2
todos
2021-10-30 00:38:48 +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
3da9404c2d
removed memsizer arg from all builtin functions
2021-10-29 23:38:31 +02:00
Irmen de Jong
495a18805c
move asmgen test to codeGeneration module
2021-10-29 16:20:53 +02:00
Irmen de Jong
0b5ddcdc9b
split out the code generator into own project submodule
2021-10-29 05:00:30 +02:00
Irmen de Jong
5ff481ce3c
make sure tmp folders exist for unit tests
2021-10-29 03:04:16 +02:00
Irmen de Jong
f21dcaa6fb
split out the code optimizers into own project submodule
2021-10-29 02:42:10 +02:00
Irmen de Jong
2c940de598
better name
2021-10-29 01:06:01 +02:00
Irmen de Jong
ce75b776bb
refactor loadAsmIncludeFile response
2021-10-29 01:01:24 +02:00
Irmen de Jong
7d22b9b9f9
simplified name conflict check for sub params
2021-10-29 00:20:33 +02:00
Irmen de Jong
6cb8b3b5cd
removed unneeded scope param from lookup()
2021-10-29 00:01:28 +02:00
Irmen de Jong
2bf4017f2b
fix nested label lookups in anon scopes
...
fixed non-global qualified names lookup
2021-10-28 23:48:01 +02:00
Irmen de Jong
08d2f8568b
refactoring symbol lookups
2021-10-27 23:48:12 +02:00
Irmen de Jong
ac5f45d2d4
fix nested label lookups in anon scopes (partly)
2021-10-27 02:41:24 +02:00
Irmen de Jong
9684f4e42a
add unit tests for AnonScope refactoring, cleaned up imports
2021-10-27 00:05:46 +02:00
Irmen de Jong
141689e697
change many uses of .definingScope to just the parent node
2021-10-26 23:25:16 +02:00
Irmen de Jong
743c8b44a2
AnonymousScope refactor: it's no longer a INameScope
...
because it doesn't contain scoped variables (these are moved to the subroutine's scope)
2021-10-26 23:01:51 +02:00
Irmen de Jong
69a8813a3d
first steps to add support for str parameter type
2021-10-24 20:57:10 +02:00
Irmen de Jong
35e88dd529
(7.2) correctly parse datatype of array parameters
2021-10-21 22:06:21 +02:00
Irmen de Jong
4d5094a517
(7.2) cleanup Petscii converter errorhandling, add unit tests for error scenarios
2021-10-20 23:48:20 +02:00
Irmen de Jong
dd5abae721
move testcase to proper location
2021-10-20 23:08:40 +02:00
Irmen de Jong
82d3d81bb2
don't want to complicate things by introducing a boolean literal
2021-10-19 23:58:50 +02:00
Irmen de Jong
82d20dea39
a few comment and TODO cleanups.
...
remove remark about chars UBYTE type, kotlin's closest native type that can contain 0-255 is a short.
2021-10-19 23:20:34 +02:00
Irmen de Jong
5afa7e53f8
got rid of program arg for isInRegularRAM
2021-10-19 22:30:30 +02:00
Irmen de Jong
7f15b7b716
remove unneeded check for duplicate module names as this is now caught by the logic in Program.addModule itself
2021-10-19 22:12:54 +02:00
Irmen de Jong
552e0c2248
rename mainModule to toplevelModule.
...
failed module no longer retains in the Ast.
improved some tests on that.
2021-10-19 21:49:05 +02:00
Irmen de Jong
e5b9e1f5e7
string object identity hashcode can be negative sometimes, so allow a '-' character.
2021-10-19 21:08:15 +02:00
Irmen de Jong
502bf90007
comments
2021-10-19 01:12:28 +02:00
Irmen de Jong
40bf117497
avoid crash when parser doesn't report an offending token for a parse error
2021-10-19 00:44:33 +02:00
Irmen de Jong
4011dce31b
added a few more tests for the file element of Position
2021-10-19 00:26:02 +02:00
Irmen de Jong
cf0e395921
got rid of SourceCode.pathString() and the 'need' to strip < and >
2021-10-16 17:15:22 +02:00
Irmen de Jong
46e4b977a4
another attempt to fix Windows path issues
2021-10-16 15:02:15 +02:00
Irmen de Jong
aea364e43d
paths are now always relative to the current directory. Fixes #64
2021-10-16 14:26:33 +02:00
Irmen de Jong
06defd0cb0
paths are now always relative
2021-10-16 02:43:22 +02:00
Irmen de Jong
57bb1c2c0d
performance optimized checks against short ranges of values
2021-10-15 00:51:45 +02:00
Irmen de Jong
7b35b414e8
tweak check of DataType against multiple values
2021-10-15 00:39:42 +02:00
Irmen de Jong
761aac7a23
replace inferredType.istype() by infix form
2021-10-15 00:28:23 +02:00
Irmen de Jong
15a02d7664
making InferredType easier to use
2021-10-15 00:18:13 +02:00
Irmen de Jong
16ed68c1ec
Module.name is now derived back from the source's origin string
2021-10-14 23:58:14 +02:00
Irmen de Jong
0447b3e4cc
remove testcase that attempted to check invalid %import syntax.
...
we only allow unquoted names, without filename suffix, in %import.
2021-10-13 22:10:35 +02:00
Irmen de Jong
855e18b31c
fix SourceCode to properly set the sourceName of a resource or string as well
2021-10-13 21:46:38 +02:00
Irmen de Jong
d790878af6
enabled test
2021-10-13 20:28:42 +02:00
Irmen de Jong
6070afa6b6
cleanup SourceCode class
2021-10-13 19:16:01 +02:00
Irmen de Jong
66574d058a
renamed InferredType.typeOrElse to getOr()
...
this is closer to the convention of most functional return types
2021-10-13 00:21:38 +02:00
Irmen de Jong
9827ee97ad
better returnvalue/errorhandling for Petscii encoding
2021-10-12 23:26:45 +02:00
Irmen de Jong
71a9a84211
don't throw basic AstException but SyntaxError instead
2021-10-12 22:30:38 +02:00
Irmen de Jong
4f7465ba44
better return types
2021-10-12 21:59:19 +02:00
Irmen de Jong
f891fc698c
switched to more featureful Result library
2021-10-12 21:35:27 +02:00
Irmen de Jong
51b2e41879
libs updated to maven
2021-10-12 03:33:52 +02:00
Irmen de Jong
e5a1b37981
simplify
2021-10-12 01:22:17 +02:00
Irmen de Jong
30aa72dc8e
fix unittest and use kotlin.test method to test for exceptions
2021-10-11 21:22:06 +02:00
Irmen de Jong
c55ac0450f
unified @embedded@ and library: into the latter
2021-10-11 19:22:56 +02:00
Irmen de Jong
2d26b9c994
fixed module parent linking mistakes in unit tests: module's parent should always be the GlobalNamespace
2021-10-11 01:34:55 +02:00
Irmen de Jong
f38fe092ee
optimized imports
2021-10-11 00:22:04 +02:00
Irmen de Jong
5db0408b9f
syntactic sugar: turned some functions into read only properties
2021-10-11 00:05:51 +02:00
Irmen de Jong
3557d38ce0
cleanup: fix spelling errors and some compiler warnings/suggestions
2021-10-10 23:35:02 +02:00
Irmen de Jong
7de4e9e66a
exclude some more build folders from the IDE
2021-10-10 23:04:31 +02:00
Irmen de Jong
f4b3d19059
fix merge conflict
2021-10-10 22:26:18 +02:00
Irmen de Jong
f37fb82d53
Merge branch 'v7.1' into testability_steps_1_2_3_again
...
# Conflicts:
# compilerAst/src/prog8/ast/antlr/Antlr2Kotlin.kt
# compilerAst/src/prog8/parser/ModuleParsing.kt
# compilerAst/test/TestAntlrParser.kt
# parser/antlr/Prog8ANTLR.g4
2021-10-10 22:20:08 +02:00
Irmen de Jong
dbe98f3fa5
remove unittest of %target directive, which is removed in 7.1
2021-10-09 18:43:18 +02:00
Irmen de Jong
1625e4eb85
rename prog8Parser (generated java) to Prog8ANTLRParser
2021-10-09 16:56:39 +02:00
Irmen de Jong
e8f308f654
a few more inlinings of trivial return values
2021-10-09 01:36:13 +02:00
Irmen de Jong
2cbf2d2226
fix regression in imported module order (reversed)
...
this caused an error in determining the main module and correct compilation options
2021-09-12 18:16:24 +02:00
Irmen de Jong
fd1f30f92b
removed %target directive (didn't add much, too confusing, only supported single target)
2021-09-04 15:01:16 +02:00
Irmen de Jong
d9ab2f8b90
upgrade to kotlin 1.5.30
2021-09-03 23:00:00 +02:00
meisl
bd6c60cf8a
* improve test method names in helpers_pathsTests by means of backtick syntax
2021-08-02 15:47:42 +02:00
meisl
f0c150d93b
* improve test method names in TestProg8Parser by means of backtick syntax
2021-08-02 15:36:08 +02:00
meisl
c2986eaf47
* structure TestProg8Parser with @Nested
2021-08-02 14:52:46 +02:00
meisl
ef0c4797bb
Merge remote-tracking branch 'remotes/origin/v7.1' into testability_steps_1_2_3_again
2021-08-02 10:26:48 +02:00
meisl
ac02a99934
* move ModuleImporter to prog8.compiler (package & module), together with its tests
2021-08-02 10:07:19 +02:00
meisl
eb46852bb9
* restrict access to Program.modules, add tests
2021-08-02 08:15:20 +02:00
meisl
007d8d2811
* ModuleImporter tests: refactor, more precise assertions about the program's modules
2021-08-01 17:27:41 +02:00
meisl
ebe04fc114
* @Disable ModuleImporter test re importing a faulty module twice - no easy fix for this atm
2021-08-01 16:26:27 +02:00
meisl
d7dd7f70c0
* rename file ModuleParsing.kt to ModuleImporter.kt (nothing else, still in compilerAst)
2021-08-01 15:38:21 +02:00
meisl
f2cb89a128
- ModuleImporter: deduplicate code
2021-08-01 15:37:57 +02:00
meisl
b8fade23de
* (first quick) fix: ModuleImporter should look in given "libdirs" (or better "srcdirs"?) for module file
2021-08-01 15:17:47 +02:00
meisl
3b97a17648
* *little bit* of cleanup in ModuleImporter - *only refactoring*
2021-08-01 11:18:45 +02:00
meisl
0d06e3ff22
*/+ refactor tests of ModuleImporter, add some tests related to libdirs issue
2021-08-01 10:48:28 +02:00
meisl
c914f7bbcf
+ TestCompilerOptionLibdirs.kt: libdirs option doesn't seem to work
2021-08-01 10:16:37 +02:00
meisl
1b451180c1
* test helpers assumeXyz (helpers/paths.kt) return the resulting path (unless they fail, of course); test directories are checked automatically at init, so no sanityCheckDirectories is needed anymore
2021-07-31 14:44:02 +02:00
meisl
ed061b362b
* #53 step6: move IStringEncoding to prog8.compiler (package as well as module)
2021-07-30 19:25:18 +02:00
meisl
e1026584c8
* split up test helpers into separate files, move mapCombinations(..) down to compilerAst/test/helpers since they're generic and don't depend on compiler
2021-07-30 18:37:12 +02:00
meisl
4c615e4fac
* solve problem re shared test helpers: a) don't use the same file name (results in same JVM class name) & b) tell gradle about it (put them in extra dir(s) test/helpers/ and add this to test source set)
2021-07-30 17:19:44 +02:00
Irmen de Jong
b60b195aec
update junit and hamcrest unittest lib versions
2021-07-20 22:42:27 +02:00
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