diff options
author | c+1 | 2023-05-04 13:25:41 -0400 |
---|---|---|
committer | c+1 | 2023-05-04 13:25:41 -0400 |
commit | 165e368e4b6bbaf31c1bfb13d48cda4b4501069e (patch) | |
tree | ef89d656dfccb3788a3bc66daa5d6711442f54ac | |
parent | e4b3f7ebeb905ed9581bec6c4ce13cb55570e8cb (diff) |
make the
-rw-r--r-- | examples/hello.halk | 29 | ||||
-rw-r--r-- | src/lexer.c | 1 |
2 files changed, 27 insertions, 3 deletions
diff --git a/examples/hello.halk b/examples/hello.halk index 69967a4..47c6979 100644 --- a/examples/hello.halk +++ b/examples/hello.halk @@ -1,6 +1,29 @@ -USE."io"; +[comments are in square brackets] -message._="Hello, World!"; +[begin list with /] +[end list with \] +[items in list separated by &] -io~o.message._; +[lines terminated by ;] +[arguments given as a list after the .] + +[USE brings a module into scope] +USE./"base"&"io"\; + +[all variables are mutable at all times] +message="Hello, World!"; + +[new functions defined with = followed by a list of procedures, which are called procedurally when called] +say.msg=/ + +[functions/variables in a module are accessed through a ~ (analogous to dot notation)] +msg=io~escape.msg& +io~o.msg +\; + +for_each./ build_list./5\ & + +say.message + +\ diff --git a/src/lexer.c b/src/lexer.c index 24b035d..a44e24f 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -1,5 +1,6 @@ #include "include/lexer.h" #include "include/token.h" + #include <stdlib.h> #include <string.h> #include <ctype.h> |