Irmen de Jong
d9bf6f090e
antlr4 parser tweaks
2026-10-19 22:57:49 +02:00
Irmen de Jong
264b894909
Add linked-list for-loop iteration with via/until syntax
2026-10-19 21:59:56 +02:00
Irmen de Jong
38c60a2d75
harden AstWalker detached-subtree skipping and extract shared canSkipExplicitCmpi helper
2026-10-17 01:46:35 +02:00
Irmen de Jong
99ff5768c5
fix compiler crash on 'not' combined with or/and in one expression
...
cherry-picked from v12 maintenance b71787a929
2026-10-17 01:18:09 +02:00
Irmen de Jong
06d2f9ebbe
when->on..goto: calibrate the jump-table sizeLimit per target
2026-10-15 22:10:52 +02:00
Irmen de Jong
3a5f2c33ab
when->on..goto: allow arbitrary choice bodies by generating labels and jump tables
2026-10-15 20:23:02 +02:00
Irmen de Jong
d523ecd1e1
when->on..goto: synthesize a gap label so gapped value ranges also use jumpi tables instead of the compare chain
2026-10-15 04:57:02 +02:00
Irmen de Jong
55dcb45230
when->on..goto: let the else part be any body, not just a single goto
...
Only the value choices have to be goto's, since those become entries in the
jump table. The else is taken over verbatim as the on..goto's else part, so a
common `else -> { ... }` body no longer disqualifies the whole when.
2026-10-15 04:05:45 +02:00
Irmen de Jong
de75342198
fix when->on..goto rewrite for signed-byte conditions and non-zero-based values. Also made it smarter to allow a nonzero start value index
2026-10-15 03:29:02 +02:00
Irmen de Jong
6cac707fd1
code cleanups
2026-10-13 22:40:19 +02:00
Irmen de Jong
460adb9e02
Remove Exec-specific for-loop over linked lists, disallow pointer as struct field name
2026-10-13 01:01:24 +02:00
Irmen de Jong
e515dee561
m68k: suggest @shared for locals referenced from inline assembly
2026-10-08 19:08:27 +02:00
Irmen de Jong
09737187ad
fix %jmptable crashes on expression and unqualified entries
2026-10-07 22:25:23 +02:00
Irmen de Jong
329b3df4a3
slice 3 for m68k stack memory model
2026-10-07 19:06:16 +02:00
Irmen de Jong
0807d07ee5
cleanups
2026-10-07 02:00:31 +02:00
Irmen de Jong
b1a9ba929d
remove ARRAY_POINTER and make pointer arrays target-independent
2026-09-25 01:18:32 +02:00
Irmen de Jong
976b64185d
fix struct size truncation to 256 bytes on targets that allow larger structs (m68k)
2026-09-24 00:22:23 +02:00
Irmen de Jong
f086918e6f
add union types: structs where every field is at offset 0, thus saving memory
2026-09-23 00:07:44 +02:00
Irmen de Jong
ef64e2f9a4
fix typed pointer arithmetic p2-p1 to yield the number of elements. fixes #244
2026-09-18 21:22:07 +02:00
Irmen de Jong
7ba2ee9857
added named struct field initializers
2026-09-14 00:56:22 +02:00
Irmen de Jong
a025d68291
added %assert expression, "message"
2026-09-13 23:04:56 +02:00
Irmen de Jong
20374f4059
Merge branch 'v12maintenance'
...
# Conflicts:
# compilerAst/src/prog8/ast/antlr/Antlr2KotlinVisitor.kt
# compilerAst/src/prog8/ast/statements/AstStatements.kt
# examples/test.p8
2026-09-11 19:37:10 +02:00
Irmen de Jong
af14562e2b
allow struct field array sizes to be constant expressions
...
fixes #240
2026-09-11 01:38:18 +02:00
Irmen de Jong
dbba6a94fa
Merge branch 'v12maintenance'
...
# Conflicts:
# codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt
# compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt
# compiler/test/ast/TestVariousCompilerAst.kt
# compiler/test/codegeneration/TestExecution6502.kt
# examples/test.p8
# gradle.properties
2026-09-10 21:45:47 +02:00
Irmen de Jong
3d5a7795d0
make set of keywords (for name restriction test) dynamic
2026-09-10 19:20:02 +02:00
Irmen de Jong
9ac60eec40
fix some more pointer syntax related issues
2026-09-09 01:33:43 +02:00
Irmen de Jong
bd0457f262
Allow const expressions for 2D array dimensions (not just numeric literals)
2026-09-08 23:13:54 +02:00
Irmen de Jong
9bf8318b1c
Support arrays of struct instances
...
- Parser: parse `StructType[N] var` via elementToArray() for
STRUCT_INSTANCE (Prog8ANTLR.g4, Antlr2KotlinVisitor)
- Desugar: struct-instance bases via addressOfStructInstance(),
whole-struct `a[i]=a[j]` -> sys.memcopy, inferred `[[...]]`
and explicit `Struct : [...]` (without ^^) for value arrays;
reject `^^Struct : [...]` in instance arrays
- 6502: computeStructArrayElementAddress() with 16-bit
index*structSize scaling (AssignmentAsmGen, AsmGen)
- IR/VM/m68k/new6502: STRUCTDEFS round-trip, loaders, gens
- AstChecker/IdentifiersChecker: reject struct fields that are
arrays of structs; fix isArray guards
- Docs: structpointers.rst/variables.rst, todo.rst, examples/test.p8
- Tests: TestArraysOfStructs (pointer vs value init, IR round-trip,
16-bit strides)
2026-08-30 18:24:14 +02:00
Irmen de Jong
94822b8662
Add arrays of struct instances (StructType[N] vars)
...
Parser: accept `Type[N] name` between type and identifier
(Prog8ANTLR.g4, Antlr2KotlinVisitor) via elementToArray()
for STRUCT_INSTANCE; CodeDesugarer: handle struct-instance
bases, addressOfStructInstance(), whole-struct memcopy
(points[a]=points[b]), and fix variable-index 16-bit scaling
in 6502 AssignmentAsmGen.computeStructArrayElementAddress();
IR: preserve STRUCTDEFS round-trip, VM loader support;
m68k/new6502/intermediate backends; docs + todo updated.
Limitations: not as struct fields (AstChecker/
AstIdentifiersChecker error) nor as sub params.
2026-08-30 14:14:49 +02:00
Irmen de Jong
b0d50c2a68
preserve block comments in compiler AST and AST output
2026-08-30 02:33:30 +02:00
Irmen de Jong
deae2e6422
Unify variable and memory slab relocation with vars address configuration
2026-08-29 01:17:44 +02:00
Irmen de Jong
02a118ec0e
deref assignment targets: use target pointer width for address temps and IR casts
2026-08-24 23:38:45 +02:00
Irmen de Jong
561f31329d
support pointer assignment targets like (expr as ^^Struct).field = v and func().field = v (grammar + CodeDesugarer poke desugar, IR pointer-cast widening, tests/docs)
2026-08-24 23:00:23 +02:00
Irmen de Jong
5857382242
add %bssaddress and %slabsaddress directives to directly control the addresses of those segments
2026-08-23 14:16:06 +02:00
Irmen de Jong
4b320013cf
Merge branch 'master' into new-codegens
...
# Conflicts:
# codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/PointerAssignmentsGen.kt
# compiler/test/TestPointers.kt
# docs/source/todo.rst
# examples/test.p8
2026-08-21 19:14:29 +02:00
Irmen de Jong
f3de26bf6c
for-loop support for list/node iteration, and reverse str/array iteration using step -1
2026-08-21 07:28:39 +02:00
Irmen de Jong
ba6179a4d3
fix crash and errors on parenthesized/casted struct pointer field access (e.g. (t.next).flag, (t.port as ^^Thing).flag)
2026-08-21 00:48:19 +02:00
Irmen de Jong
df659d285b
optimize imports
2026-08-18 01:28:35 +02:00
Irmen de Jong
e0147a4a7e
fix hardcoded uword pointer-size assumptions for 32-bit targets
2026-08-18 00:09:10 +02:00
Irmen de Jong
9d57cbe263
m68k: fix float sgn instruction format
2026-08-17 20:06:52 +02:00
Irmen de Jong
34f0bea4e8
fix pointer unit tests, consolidate pointer type selection for target
2026-08-17 03:30:17 +02:00
Irmen de Jong
cc4f27d121
vm: making VM 32 bit
...
work in progress: see vm32.md there are failing tests still
2026-08-16 19:49:28 +02:00
Irmen de Jong
295dfada61
amiga: add custom.filter_on() and filter_off()
2026-08-15 22:56:42 +02:00
Irmen de Jong
f011d3f100
new language feature: %option private_symbols, and public keyword - to manage visibility
2026-08-13 22:05:58 +02:00
Irmen de Jong
3514bd61ab
new syntax feature: const type can be omitted (defaults to long for integers now)
2026-08-11 21:27:07 +02:00
Irmen de Jong
f11da0488a
fix false recursion message
2026-08-10 21:49:41 +02:00
Irmen de Jong
ed1abe7e6b
allow (optional) explicit for loop variable type to override the inferred type
2026-08-10 21:20:37 +02:00
Irmen de Jong
b3b983c7ec
fix untyped pointer indexing on 32 bits targets (long vs uword)
2026-08-08 16:01:28 +02:00
Irmen de Jong
a5978a913b
m68k: added coroutines module
2026-08-06 22:08:59 +02:00
Irmen de Jong
3d3c567ea6
fix memory-byte read sign extension error when the byte was signed
2026-08-05 02:54:59 +02:00