Implement Control Flow Statements in Kym #37

Merged
kayomn merged 8 commits from kym-control-flow into main 2023-08-26 00:01:25 +02:00
Owner

Introduces basic while loop and if / elif / else control flow.

To be expanded on in the future, however this is enough to get started.

while i < 5:
	@print("hello, world")

	i = i + 1
end

if i > 6:
	@print("`i` greater than `6`")
elif i == 4:
	@print("`i` is equal to `4`")
else:
	@print("i'unno")
end

Closes #23.

Currently blocked by a miscompilation in the Zig compiler and pending a resolution for that before work this can proceed any further.

Introduces basic `while` loop and `if` / `elif` / `else` control flow. To be expanded on in the future, however this is enough to get started. ```rb while i < 5: @print("hello, world") i = i + 1 end if i > 6: @print("`i` greater than `6`") elif i == 4: @print("`i` is equal to `4`") else: @print("i'unno") end ``` Closes #23. ~~Currently blocked by a miscompilation in the Zig compiler and pending a resolution for that before work this can proceed any further.~~
kayomn added this to the (deleted) milestone 2023-08-20 18:43:47 +02:00
kayomn self-assigned this 2023-08-20 18:43:47 +02:00
kayomn added 1 commit 2023-08-20 18:43:48 +02:00
Implement if statements in AST and jumps in the VM
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2d016dc085
kayomn added 1 commit 2023-08-20 23:25:42 +02:00
Refactor Kym AST
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
0d6e5250c7
kayomn added 2 commits 2023-08-22 00:51:55 +02:00
Fix off-by-one if statement jump error
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
eca2cfffb8
kayomn added 1 commit 2023-08-23 00:49:28 +02:00
Add while loops
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
bb1e689c5a
kayomn added 3 commits 2023-08-25 23:57:40 +02:00
Fix > and == operators being miscompiled
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
77af4d067b
kayomn changed title from WIP: Implement Control Flow Statements in Kym to Implement Control Flow Statements in Kym 2023-08-26 00:01:12 +02:00
kayomn merged commit 1e3f676698 into main 2023-08-26 00:01:25 +02:00
Sign in to join this conversation.
No description provided.