diff options
| author | Nic Gaffney <gaffney_nic@protonmail.com> | 2026-01-30 21:11:06 -0600 |
|---|---|---|
| committer | Nic Gaffney <gaffney_nic@protonmail.com> | 2026-01-30 21:11:06 -0600 |
| commit | 0a286901b4b91a61401cd9db3bf21353e9608725 (patch) | |
| tree | 2d3c9e81b9f96b4f5c6223bb026a859b41305677 /examples | |
| parent | 117be1e9f9c2e353694b40e0eb686b2621317063 (diff) | |
| download | gren-0a286901b4b91a61401cd9db3bf21353e9608725.tar.gz | |
begin on parser
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/basics.gn | 0 | ||||
| -rw-r--r-- | examples/test.gn | 21 | ||||
| -rw-r--r-- | examples/usage.gn | 8 |
3 files changed, 21 insertions, 8 deletions
diff --git a/examples/basics.gn b/examples/basics.gn new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/examples/basics.gn diff --git a/examples/test.gn b/examples/test.gn index 99e7ef6..5147097 100644 --- a/examples/test.gn +++ b/examples/test.gn @@ -1,11 +1,16 @@ -!use defaults -> io -> println. -!use defaults -> effects. -!use defaults -> math -> +. -!use builtin -> block. -!use builtin -> return. +?? Comments begin with a ? +!insert "usage.gn". +!insert "math.gn". + !entrypoint <- main. + +?? Type definitions begin with the name wrapped in () +(add <- Int <- Int) -> Int. +add a b -> a + b. + (main) -> Int ? (effects -> IO). +?? Function definitions begin with the name and have an -> main -> match (x <- println "Hello World") ( - (x >= 0) -> 0, - (x < 0)-> 1, -) + (x >= 0) -> x, + (x < 0)-> add x 10, +). diff --git a/examples/usage.gn b/examples/usage.gn new file mode 100644 index 0000000..0f8ffc3 --- /dev/null +++ b/examples/usage.gn @@ -0,0 +1,8 @@ +!use builtin -> types -> Int. +!use builtin -> operators -> +. +!use builtin -> operators -> >=. +!use builtin -> operators -> <. +!use builtin -> match. + +!use defaults -> io -> println. +!use defaults -> effects. |
