Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorickpeterse/5369ccf26b569068a6948f32fcdfabe0 to your computer and use it in GitHub Desktop.
Save yorickpeterse/5369ccf26b569068a6948f32fcdfabe0 to your computer and use it in GitHub Desktop.
aeon $ cat -n /tmp/test.aeon
1 def add(Integer left, Integer right) -> Integer:
2 __get_local(0, 0)
3 __get_local(1, 1)
4 __integer_add(2, 0, 1)
5 __return(2)
6
7 def print(String message) -> Integer:
8 __get_local(0, 0)
9 __stdout_write(1, 0)
10 __return(1)
11
12 def int_to_string(Integer int) -> String:
13 __get_local(0, 0)
14 __integer_to_string(1, 0)
15 __return(1)
16
17 let a = 10
18 let b = 20
19 let sum = add(a, b)
20 let bytes = print(int_to_string(sum))
21
22 # TODO: support \n, \t, \r, etc
23 print('
24 ')
25
26 print(int_to_string(bytes))
27
28 # vim: set ft=aeon sts=2 sw=2 ts=2:
aeon $ ruby bootstrap/bin/compile /tmp/test.aeon
aeon $ cargo run -- /tmp/test.aeonc
Running `target/debug/aeonvm /tmp/test.aeonc`
30
2⏎
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment