From 7d409ba27c86e9a2a719c4376476b506380702da Mon Sep 17 00:00:00 2001 From: Matt Fenwick Date: Fri, 25 Jan 2013 14:44:02 +0100 Subject: [PATCH] derived BNF-like grammar to specify syntax --- grammar.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 grammar.md diff --git a/grammar.md b/grammar.md new file mode 100644 index 0000000..5928ea2 --- /dev/null +++ b/grammar.md @@ -0,0 +1,47 @@ +## Lexical syntax ## + + OPEN-PAREN := '(' + + CLOSE-PAREN := ')' + + OPEN-SQUARE := '[' + + CLOSE-SQUARE := ']' + + OPEN-CURLY := '{' + + CLOSE-CURLY := '}' + + WHITESPACE := ' ' | '\t' | '\n' | '\r' + + COMMENT := ';' ??? + + STRING := '"' ??? '"' + + CONSTANT := '*' ??? '*' + + BOOLEAN := 'true' | 'false' + + SYMBOL := ??? + + NUMBER := ??? + + HASH := '#!' ??? + + +## Grammar ## ([example](http://docs.python.org/2/reference/grammar.html)) + + Hy := HASH | COMMENT | WHITESPACE | Expression + + Expression := OPEN-PAREN Operator Args Close-Paren + + Operator := ??? + + Args := Value(*) + + List := OPEN-SQUARE Value(*) CLOSE-SQUARE + + Map := OPEN-CURLY ( Value Value )(*) CLOSE-CURLY + + Value := STRING | CONSTANT | BOOLEAN | SYMBOL | NUMBER | Expression | List | Map + \ No newline at end of file