Commit Graph

184 Commits

Author SHA1 Message Date
42dd3ffffc lang: codegen: cond: fix gen_block not repeating the block node 2025-09-08 16:24:03 +01:00
84e6d4f2ed lang: codegen: expr: implement assignment and arithmetic-and-assign operator support 2025-09-08 16:22:37 +01:00
97f7782968 lang: codegen: expr: implement generating true/false/null constants 2025-09-08 16:22:06 +01:00
312e737f9f lang: codegen: implement returning the last value evaluated in a block 2025-09-08 16:21:05 +01:00
168310033d lang: codegen: implement variable declaration/resolution support in block generator 2025-09-08 16:20:41 +01:00
6844f498c5 lang: codegen: replace codegen_value with a new system for passing different types of values between code generators 2025-09-08 16:17:29 +01:00
7ee2e9dd81 lang: codegen: fix block code generator using unit_codegen_state 2025-09-08 16:10:47 +01:00
e5ea7b1134 lang: codegen: remove old var declaration generator 2025-09-08 16:10:11 +01:00
ee402fb437 lang: move IVY_OP_ASSIGN operator id to be with the other assignment operators 2025-09-08 16:03:45 +01:00
3b5f08b1ea lang: ast: add new ast node type ids 2025-09-08 16:03:39 +01:00
7d1b7c5d68 lang: lex: add new lex token type ids 2025-09-08 16:03:26 +01:00
6e65349d70 lang: ast: fix some source formatting 2025-09-08 16:01:02 +01:00
d95a544ff2 lang: ast: fix parsing of tuple iterator declaration in for-loops 2025-09-08 16:00:42 +01:00
59a85e9c47 lang: ast: fix parsing of unlabelled complex msg args 2025-09-08 16:00:07 +01:00
6dfa0c7e17 lang: ast: add function to signal the end of token input to the parser 2025-09-08 15:58:14 +01:00
3c72527204 lang: ast: fix parsing of inline-if expressions that immediately precede an end keyword 2025-09-08 15:57:04 +01:00
8ab377b3ab lang: ast: implement parsing of true/false/null keyword constants 2025-09-08 15:56:03 +01:00
bf250179da lang: ast: implement parsing of break/continue loop-control statements 2025-09-08 15:55:12 +01:00
84e52b1649 lang: ast: replace var keyword with global
local variables are now created automatically when they are first assigned to.

the global keyword can be used to declare that a name refers to a global variable instead,
at which point, assigning to the name results in the assignment referencing the global variable
instead of allocating a new global variable.
2025-09-08 15:52:29 +01:00
5ea544692b lang: diag: add some new diag codes and messages 2025-09-08 15:48:38 +01:00
d532d9cff3 lang: codegen: fix free of mie_ctx that isn't allocated by ivy_codegen 2025-08-16 21:11:46 +01:00
adb326c795 lang: codegen: fix instr gen duplicating left operand 2025-08-16 21:00:50 +01:00
bda10b1166 lang: codegen: update mie_ctx include path 2025-08-16 21:00:22 +01:00
9f83929600 lang: update mie ir api usage 2025-06-02 11:31:35 +01:00
d746ea5234 lang: ast: fix nullptr deref in expr_finalise_arith when calculating ast node bounds 2025-05-12 15:53:06 +01:00
661014f49f lang: adjust for-loop diagnostic wording 2025-05-09 13:39:02 +01:00
1d4661f7a4 lang: ast: fix parser_push_diag not setting diag location 2025-05-09 13:38:38 +01:00
b89c3bedc5 lang: ast: add diag for do keyword in inline for-loop 2025-05-08 22:32:23 +01:00
5f560d28a7 lang: ast: update arith parser to set ast node bounds 2025-05-08 22:31:37 +01:00
c12371f0ec lang: ast: add diag support to parser 2025-05-08 22:30:23 +01:00
a0f1931c00 lang: lex: update ivy_token to use ivy_char_cell 2025-05-08 22:27:13 +01:00
a28874145c lang: lex: add diagnostic support 2025-05-08 20:31:55 +01:00
cc99e7440e lang: add diagnostic definitions 2025-05-08 20:31:40 +01:00
475575f76f lang: codegen: add for-loop generator 2025-05-08 10:53:00 +01:00
1c3aff9ad3 lang: add start/end coordinates to lexer tokens 2025-04-28 22:53:21 +01:00
de7d5c44cd lang: codegen: add missing ctx parameter to ivy_codegen_create prototype 2025-04-28 15:50:54 +01:00
64d1015a3c lang: codegen: implement cond-group code generation 2025-04-28 15:44:44 +01:00
cbec21b90f lang: implement elif keyword for more complex if-statements 2025-04-24 09:45:26 +01:00
d37c07e5e4 lang: codegen: implement return generation 2025-04-24 09:25:36 +01:00
da4aa7df78 lang: codegen: function load now uses func type instead of id 2025-04-24 09:25:21 +01:00
614329091c lang: codegen: implement unit-package and unit-import generation 2025-04-23 15:44:01 +01:00
4ea9683880 lang: codegen: lambda s_outer_block is now only initialised once 2025-04-23 11:02:47 +01:00
2062ee631c lang: codegen: fix pop_generator_recurse only popping generators with a value_received callback defined 2025-04-23 11:01:12 +01:00
2eb358457c lang: codegen: fix serialisation of selectors with unnamed args 2025-04-23 11:00:57 +01:00
857d99ea34 lang: codegen: codegen_load_variable now supports loading non-ptr variables 2025-04-23 11:00:16 +01:00
3af786b32c lang: ast: fix selector, unit-package, and unit-import string conversion
stringifying selectors with unnamed args no longer causes a segfault,
and unit-package and unit-import node strings are now formatted correctly.
2025-04-23 10:58:22 +01:00
c7aa3b422d lang: ast: fix lambdas starting with var declaration not being parsed correctly
IVY_KW_VAR is not treated as an expression start token (as variable declarations are not
strictly expressions). so the lambda parser did not create a block parser context
when it encountered this keyword.
2025-04-23 10:57:17 +01:00
279b387b69 lang: ast: complex-msg args are now separated by commas
additionally, unnamed complex-msg args no longer need to be prefixed
with a colon. this allows complex-msgs to more closely emulate
traditional function calls. this also applies to the call-operator.

for example, take the following lambda:

	var f = [ :x :y | ^x * 2 + y ].

before, this lambda would be invoked using the following syntax:

	f(:2 :4).

now, this syntax is used instead:

	f(2, 4).
2025-04-23 10:53:34 +01:00
07d16e7454 lang: codegen: fix segfault when serialising selector with unnamed args 2025-04-22 21:31:44 +01:00
b8459f9390 lang: codegen: implement lambda variable capture 2025-04-22 15:31:23 +01:00