derived BNF-like grammar to specify syntax

This commit is contained in:
Matt Fenwick 2013-01-25 14:44:02 +01:00
parent 56c4091a5b
commit 7d409ba27c

47
grammar.md Normal file
View File

@ -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