summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-08-07 18:37:36 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-08-07 18:37:36 +0200
commit7e634a3581caa1cc9d7c53314c6c8242f1792f27 (patch)
treecb652653d48673bce63968caa5499644c2838dbe /doc
parent2408182c56bdf57839bc25d00688ff128b5a1f29 (diff)
Add formal language spec for the first iteration
Diffstat (limited to 'doc')
-rw-r--r--doc/language.txt88
1 files changed, 88 insertions, 0 deletions
diff --git a/doc/language.txt b/doc/language.txt
new file mode 100644
index 0000000..6000925
--- /dev/null
+++ b/doc/language.txt
@@ -0,0 +1,88 @@
+@@ No support for template ids
+@@ No support for expressions (e.g., 2*2)
+
+Token types:
+ keyword
+ identifier
+ punctuation (";" "{" "}" "(" ")" "," "|" "=" ":")
+ bracket-literal
+ string-literal
+ bool-literal
+ int-literal
+ float-literal
+ end-of-stream
+
+def-unit:
+ include-decl-seq(opt) decl-seq(opt)
+
+include-decl-seq:
+ include-decl
+ include-decl-seq include-decl;
+
+include-decl:
+ "include" path ";"
+
+path:
+ string-literal
+ bracket-literal
+
+decl-seq:
+ decl
+ decl-seq decl
+
+decl:
+ namespace-def
+ class-def
+
+namespace-def:
+ "namespace" identifier "{" namespace-body "}"
+
+namespace-body:
+ decl-seq(opt)
+
+class-def:
+ "class" identifier "{" option-def-seq(opt) "};"
+
+option-def-seq:
+ option-def
+ option-def-seq option-def
+
+option-def:
+ type-spec option-name-seq initializer(opt) ";"
+
+type-spec:
+ fundamental-type-spec
+ qualified-name
+
+option-name-seq:
+ option-name
+ option-name-seq "|" option-name;
+
+option-name:
+ identifier
+ string-literal
+
+initializer:
+ "=" argument-expr
+ "(" argument-seq(opt) ")"
+
+argument-seq:
+ argument-expr
+ argument-seq "," argument-expr
+
+argument-expr
+ bool-literal
+ int-literal
+ float-literal
+ string-literal
+ qualified-name
+
+qualified-name:
+ identifier
+ qualified-name "::" identifier
+
+fundamental-type-spec
+ "bool"
+ ...
+ "long double"
+