aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-10-20 18:54:50 +0200
committerHimbeer <himbeer@disroot.org>2024-10-20 18:54:50 +0200
commit43c27d28f13c6c2ab493565f41ff6bd6aedf273d (patch)
tree52c8d6d31a65b9d161189f065c0982a9df78fcea
parentd8397304ba277bbf0e3780c46400f9abca6adc47 (diff)
Separate types from values
Types can no longer be stored in constants. A runtime reflection mechanism may be provided in the future, but the language does not aim to implement a compile-time programming environment.
-rw-r--r--doc/grammar.txt6
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/grammar.txt b/doc/grammar.txt
index d3c9829..0e2f002 100644
--- a/doc/grammar.txt
+++ b/doc/grammar.txt
@@ -1,5 +1,5 @@
root := import* toplevel*
-toplevel := externfunc | function | constant
+toplevel := externfunc | function | constant | typedef
import := "import" path [ NAME ] ";"
@@ -12,7 +12,9 @@ param := NAME type
externfunc := "extern" "func" NAME "(" ( type ), ")" [ type ] ";"
constant := [ COMMENT ]
- "const" NAME "=" ( NUMBER | bool | STRING* | type ) ";"
+ "const" NAME "=" ( NUMBER | bool | STRING* ) ";"
+
+typedef := [ COMMENT ] "type" NAME type
block := [ ":" NAME ] "{" command* "}"