aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorc+12023-05-22 22:38:39 -0400
committerc+12023-05-22 22:38:39 -0400
commit9f479d2d093f5656f887c246201ed2fa4a2f1f4b (patch)
treeffd569b1e7886bf06f40ec8e0a5d46b5e300f92f
parentd83d37ecd5682252f85af099c3353525f1cb1394 (diff)
man.txt
-rw-r--r--examples/hello.halk25
-rw-r--r--man.txt38
2 files changed, 57 insertions, 6 deletions
diff --git a/examples/hello.halk b/examples/hello.halk
index 719ba93..7ec14b8 100644
--- a/examples/hello.halk
+++ b/examples/hello.halk
@@ -1,14 +1,14 @@
` comments in backticks `
` preprocessor directives `
-#INCLUDE##math#
-#INCLUDE##io#
+#MACRO##PI##3.14159#
+#IFNDEF##HELLO#
+ #DEF##HELLO#
+#ENDIF#
` source code begins here `
str:hello = 'hello, '; ` variables must be given a value at declaration `
-int:PI = math/PI; ` namespaces are accessed with a '/'' `
-
void:greeting. str:to = { ` functions declared the same way as variables, but with a . after
the name, followed by arguments `
@@ -18,11 +18,24 @@ void:greeting. str:to = { ` functions declared th
do not prefix it with a namespace/ `
}
-int:sum_all. any[]:_ = { ` variadic functions are possible with the reserved '_' argument,
+int:sum_all. int[]:_ = { ` variadic functions are possible with the reserved '_' argument,
which is treated as an array `
return.foldl.sum, 0, _;
}
+namespace:new_namespace = { ` create a new namespace `
+ int:value = 1;
+
+ int:sum_all. int[]:_ = {
+ return.foldl.sum,0,_;
+ }
+}
+
+check_expect.(sum_all. 1, 2, 3, 4), 10; ` tests `
+check_expect.
+ (sum_all. 1, 2, 3, 4),
+ (new_namespace/sum_all. 1, 2, 3, 4);
+
int:fibonacci. int:n = {
if.(eq.n, 0), {
return.1;
@@ -34,7 +47,7 @@ int:fibonacci. int:n = {
}
int:main. str[]:args = { ` where code will begin executing `
- greeting.` comments can be placed *anywhere* `'world.';
+ greeting.'world.'; ` returns 'hello, world.' `
return.0;
}
diff --git a/man.txt b/man.txt
new file mode 100644
index 0000000..3c31517
--- /dev/null
+++ b/man.txt
@@ -0,0 +1,38 @@
+The HALK Programming Language
+====================================================================================================
+
+*version 0.0.1*
+*2023-05-22*
+
+Syntax
+====================================================================================================
+
+Definitions
+----------------------------------------------------------------------------------------------------
+
+Calls
+----------------------------------------------------------------------------------------------------
+
+Data Structures
+====================================================================================================
+
+Namespaces
+----------------------------------------------------------------------------------------------------
+
+Structs
+----------------------------------------------------------------------------------------------------
+
+Logic & Program Flow
+====================================================================================================
+
+If / Else
+----------------------------------------------------------------------------------------------------
+
+For / While
+----------------------------------------------------------------------------------------------------
+
+Cond
+----------------------------------------------------------------------------------------------------
+
+Style
+====================================================================================================