Commit Graph

35 Commits

Author SHA1 Message Date
4386965cd9 lang: update bluelib api usage 2025-11-06 10:38:32 +00:00
6e65349d70 lang: ast: fix some source formatting 2025-09-08 16:01:02 +01:00
59a85e9c47 lang: ast: fix parsing of unlabelled complex msg args 2025-09-08 16:00:07 +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
d746ea5234 lang: ast: fix nullptr deref in expr_finalise_arith when calculating ast node bounds 2025-05-12 15:53:06 +01:00
5f560d28a7 lang: ast: update arith parser to set ast node bounds 2025-05-08 22:31:37 +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
f220fc2f4b lang: ast: fix nested lambdas not parsing correctly 2025-04-20 21:25:28 +01:00
51e07522e8 lang: ast: fix parens not allowing sub-keyword messages
previously, an expression like:

	x arg1:a arg2:(c subArg:d).

were being parsed incorrectly. This expression was parsed
as single -arg1:arg2:subArg: message being sent to x. the
parentheses around the `c subArg:d` sub-expression were
being ignored.

now, this expression is correcly parsed as the value
of `c subArg:d` being passed as a parameter to the message
-arg1:arg2:
2025-04-17 21:38:31 +01:00
e430b7b2f1 lang: add var keyword for variable declarations
the var keyword allows greater control over what scope a
particular variable exists in. it clarifies whether a new
variable is being defined or an existing variable is being
assigned to. it will also facilitate the implementation of
global variables.
2025-04-15 11:02:47 +01:00
df8d9689d1 lang: add null pointer check to arith_parse_left_paren
this fixes a crash that occurred when the call-operator was used on a lone ident in an expression.
2025-04-03 10:48:56 +01:00
78b2eb23c3 lang: ast: implement () operator parsing
the () operator can be used to call lambdas in a more functional way than the standard
message-send syntax

for example, with a lambda stored in variable `x`:

	x(a:2 b:6).

is equivalent to

	x call(a:2 b:6).
2025-03-26 21:10:12 +00:00
8b8a97c9a6 lang: ast: implement parsing of subscript operator 2024-12-08 17:08:29 +00:00
753afd7d87 lang: ast: implement parsing of tuples 2024-12-08 12:28:47 +00:00
e8c30b65b5 lang: ast: implement support for multiple expression terminator tokens 2024-12-07 21:28:25 +00:00
209c47da68 lang: ast: implement parsing of static and dynamic package initialisers 2024-12-07 20:56:57 +00:00
504fea6d9e lang: ast: fix expr type not being set when parsing a lambda 2024-12-06 22:46:24 +00:00
dba4f123d6 lang: ast: implement parsing of lambdas 2024-12-06 22:26:06 +00:00
1f7319458e lang: ast: implement parsing of properties 2024-12-06 19:47:27 +00:00
94c10dfbb2 lang: ast: implement parsing of f-strings 2024-12-06 13:46:58 +00:00
2bd3e96427 lang: ast: implement parsing of atoms 2024-12-06 13:46:41 +00:00
d3813dc514 lang: ast: treat bang (!) as an unconsumed expression terminator 2024-12-06 13:22:33 +00:00
d88d58be70 lang: ast: implement for-loop parsing 2024-12-06 10:02:31 +00:00
f3cd89c72a lang: ast: implement caret (return) parsing 2024-12-06 10:01:56 +00:00
d1855afc05 lang: add missing includes; misc formatting cleanup 2024-12-06 09:59:57 +00:00
9a4b074381 lang: ast: suppress debug output by default 2024-12-05 19:37:58 +00:00
e23cd801c9 lang: ast: fix keyword arg parser not inheriting subexpr depth correctly 2024-12-05 16:55:53 +00:00
fc0a943ae8 lang: ast: improve cascade operator recipient resolution
the cascade operator now uses the precedence of the last message parsed
to determine the recipient of the subsequent messages, reducing the need
for parentheses and making the semantics of the operator more
predictable.

all messages in a cascade now inherit the precedence of the first
message in the cascade.
2024-12-05 16:53:59 +00:00
7acf80f930 lang: ast: implement parsing of match statements 2024-12-04 22:22:25 +00:00
a34b9c3710 lang: ast: fix expr_finalise not consuming the right-paren of a parenthesised expression 2024-12-04 20:18:40 +00:00
84f3704db0 lang: ast: fix expr_finalise not handling complex message terminator 2024-12-04 16:41:18 +00:00
c23523ce14 lang: ast: implement parsing of inline and standalone if-else statements 2024-12-04 16:35:19 +00:00
051cb1d2c2 lang: ast: implement cascade operator parsing 2024-12-03 21:57:44 +00:00
16ab13d738 lang: ast: re-factor expression parser into multiple files 2024-12-03 13:26:55 +00:00