derived BNF-like grammar to specify syntax
This commit is contained in:
parent
56c4091a5b
commit
7d409ba27c
47
grammar.md
Normal file
47
grammar.md
Normal 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user