Commit Graph

238 Commits

Author SHA1 Message Date
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
804bb06859 clarified isInRegularRAM() by making it an extension method on AssignTarget 2021-10-19 22:36:05 +02:00
Irmen de Jong
5afa7e53f8 got rid of program arg for isInRegularRAM 2021-10-19 22:30:30 +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
502bf90007 comments 2021-10-19 01:12:28 +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
16ed68c1ec Module.name is now derived back from the source's origin string 2021-10-14 23:58:14 +02:00
Irmen de Jong
e63cf660c6 petscii now use Result instead of Either 2021-10-13 23:22:46 +02:00
Irmen de Jong
aaff484306 refactor executeImportDirective 2021-10-13 23:14:27 +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
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
6b8c3ef614 renamed command line option -libdirs to -srcdirs
this more clearly separates this meaning from the internal library modules
2021-10-13 18:16:51 +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
1c7c67060d better result and error handling for importModule() 2021-10-12 23:54:48 +02:00
Irmen de Jong
9827ee97ad better returnvalue/errorhandling for Petscii encoding 2021-10-12 23:26:45 +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
2c2d474059 fix crash when attempting to import non-existing module 2021-10-11 20:37:55 +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
73838ccb8b ref github issue 2021-10-10 23:00:31 +02:00
Irmen de Jong
371d4768e6 fix filename case issue 2021-10-09 17:59:40 +02:00
Irmen de Jong
7241cef7a5 fix char range in float-range test and exclude test.p8 example from tests 2021-09-12 18:59:53 +02:00
Irmen de Jong
5145296486 fix test assertion for float ranges (and re-enable test) 2021-09-12 18:53:12 +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
meisl
ac02a99934 * move ModuleImporter to prog8.compiler (package & module), together with its tests 2021-08-02 10:07:19 +02:00
meisl
fb67d1155f * structure TestCompilerOnImportsAndIncludes, add (@Disabled for now) test re %import with string arg 2021-08-02 08:57:09 +02:00
meisl
eb46852bb9 * restrict access to Program.modules, add tests 2021-08-02 08:15:20 +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
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
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
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
3f6f25e06f * @Disable tests re unsolved #55, "float[] initializer with range and no explicit array size" 2021-07-17 17:12:16 +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
ac37319d20 Merge branch 'bug_asmbinary' into testability_steps_1_2_3_again 2021-07-17 15:08:32 +02:00
meisl
b2c6274f74 * fix #54 / step 3: avoid some (= not all) complaints re the .binary filename 64tass still had/has.
Actually, I don't quite understand why it still says "not the real name of the file". The 64tass docs say:
> -Wno-portable
>   Don't warn about source portability problems.
>   These cross platform development annoyances are checked for:
>   * Case insensitive use of file names or use of short names.
>   * Use of backslashes for path separation instead of forward slashes.
>   * Use of reserved characters in file names.
>   * Absolute paths
2021-07-17 13:03:05 +02:00
meisl
ee115b3337 + expose #54, %asmbinary when outputDir != workingDir; also: refactor compiler tests on examples and add test helpers 2021-07-17 13:02:20 +02:00
meisl
82f5a141ed * reintroduce the conversion of CharLiteral to UBYTE literals, but now *during AST preprocessing*, not in the parser 2021-07-11 22:03:32 +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
cd295228ef + TestCompilerOnImportsAndIncludes.kt: 2 tests, both passing (but see FIXME in asmIncludeFromSameFolder.p8) 2021-07-11 15:33:44 +02:00
meisl
39d5b7edb0 + test examples for both platforms, cx16 and c64; test two more: tehtriz and textelite (the largest ones, 20KB / 36KB) 2021-07-10 21:41:51 +02:00
meisl
ddaef3e5d5 + add tests for SourceCode.fromResources; refactor tests 2021-07-10 20:55:23 +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
81abf29bec
Merge branch 'irmen:v7.1' into v7.1 2021-07-09 11:03:31 +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
meisl
07d8052a57 * fix comments: no more problem with exitProcess 2021-07-02 13:28:19 +02:00
meisl
db9edb477e * less confusing assertion messages (seemingly contradictory in case of failure) 2021-07-02 12:38:24 +02:00
Irmen de Jong
9bd3a6758a improve testability: use error returnvalues instead of using exitProcess() 2021-07-02 00:11:21 +02:00
meisl
006059438f + same warning on the other "TestCompilerXyz" file 2021-06-28 18:49:01 +02:00
meisl
84ea3b9788 + compiler/test/TestCompilerOnExamples.kt: *not actually unit tests - just a kludge!* (but better than nothing) 2021-06-28 18:42:05 +02:00
meisl
b667abde10 + compiler/test/TestCompilerOnCharLit.kt 2021-06-28 18:24:35 +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
3a2498401d working on unit tests for symbol scope bug 2021-06-03 21:21:38 +02:00
Irmen de Jong
53b20ba625 name 2021-06-01 22:22:58 +02:00
Irmen de Jong
e7f6f0950f identified asm symbol name scoping bugs 2021-06-01 22:21:50 +02:00
Irmen de Jong
078485134d split up unittests files 2021-06-01 22:07:39 +02:00
Irmen de Jong
c03f6604af added free words counting method to zeropage 2021-05-30 00:55:11 +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
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
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
2b7b925090 codegen now uses correct machine target's string encoder/decoder. Encoding more robust by checking upper case mapping if lowercase mapping fails. 2021-04-09 23:33:32 +02:00
Irmen de Jong
b29f04ce01 fix unittest 2021-03-31 20:49:35 +02:00
Irmen de Jong
3e286dd14c move test 2021-03-18 19:34:54 +01:00
Irmen de Jong
11247d52b1 fix bugs in word <= and >= comparisons 2021-03-18 19:20:48 +01:00
Irmen de Jong
1dbc902513 fix bugs in uword <= and >= comparisons 2021-03-18 18:41:41 +01:00
Irmen de Jong
b30b8b7368 fix bug in float < and > comparisons 2021-03-18 01:41:54 +01:00
Irmen de Jong
3df182b8c3 created extensive comparison test suite 2021-03-18 00:50:13 +01:00
Irmen de Jong
7f21d89fea moved test programs to test folder in compiler module 2021-03-17 20:15:16 +01:00
Irmen de Jong
6995ee2d17 fix cx16 bresenham line inaccuracy 2021-03-09 22:04:19 +01:00
Irmen de Jong
d23c2eed86 test 2021-02-20 16:58:24 +01:00
Irmen de Jong
2aa39757b4 reduce dependencies on global compilationtarget 2021-02-19 19:02:29 +01:00
Irmen de Jong
219d17de34 reduce dependencies on global compilaiontarget 2021-02-19 18:33:54 +01:00
Irmen de Jong
bc37097df2 reducing dependencies 2021-02-09 18:49:25 +01:00
Irmen de Jong
7d98275763 reducing dependencies 2021-02-09 02:06:27 +01:00
Irmen de Jong
d6ffb549f6 reducing dependencies 2021-02-09 01:47:05 +01:00
Irmen de Jong
ccd1516637 reducing ast dependencies 2021-02-07 18:44:38 +01:00
Irmen de Jong
f1f51a01c6 reducing ast dependencies 2021-02-07 18:34:55 +01:00
Irmen de Jong
e35b739579 reducing ast dependencies 2021-02-07 06:39:08 +01:00
Irmen de Jong
170a0183f8 added 'inline' keyword to force inlining of trivial subroutines 2020-12-26 05:34:14 +01:00
Irmen de Jong
e0c5ccc16b begun with converting builtin functions to new call convention 2020-11-02 23:00:20 +01:00
Irmen de Jong
fdd91170dc allow simple binary expressions as array indexing too, but not more 2020-10-17 22:43:35 +02:00
Irmen de Jong
439761cb67 fixed C64 ZP addresses to allow disk I/O, introduced diskio library module 2020-10-14 01:17:18 +02:00
Irmen de Jong
95e9e1b550 avoid adding unneeded variable initalization assignments. Improved removal of useless double assignments. 2020-10-01 00:39:49 +02:00
Irmen de Jong
1d1fe364d0 added %option no_sysinit to avoid having the system re-initialization code executed at the start of the program 2020-09-23 23:01:47 +02:00
Irmen de Jong
e8679ae03b fixed print_f on cx16. Some more examples are now multi-platform. 2020-09-22 01:45:51 +02:00
Irmen de Jong
de06353194 auto select correct library to import based on target, instead of having c64- and cx16- prefix variants
some programs are now 100% source compatible between C64 and Cx16 targets!
import libraries have been rena;med
2020-09-21 00:50:09 +02:00
Irmen de Jong
49a0584c54 added a %target directive 2020-09-09 22:53:34 +02:00
Irmen de Jong
8d8c066447 made the ZP and compilation target more generic 2020-08-25 19:32:31 +02:00
Irmen de Jong
63c073c93f got rid of the Simulator / AST VM 2020-03-22 02:50:34 +01:00
Irmen de Jong
0ee4d420b1 slight tweaks on the Ast, Program (the top level) is now a Node as well 2020-03-18 22:29:30 +01:00
Irmen de Jong
6bd99d63b4 cleanup of error reporting 2020-03-14 23:47:26 +01:00