Adding negative numbers to the parser, other minor changes
parent
598bb166de
commit
dcab546b97
|
@ -18,21 +18,22 @@ RPAREN = ")"
|
||||||
dquote = '"'
|
dquote = '"'
|
||||||
squote = "'"
|
squote = "'"
|
||||||
digit = [0-9]
|
digit = [0-9]
|
||||||
integer = (digit)+ => [[ string>number ]]
|
integer = ("-")? (digit)+ => [[ string>number ]]
|
||||||
float = (digit)+ "." (digit)* => [[ first3 >string [ >string ] dipd 3append string>number ]]
|
float = ("-")? (digit)+ "." (digit)* => [[ first3 >string [ >string ] dipd 3append string>number ]]
|
||||||
number = float
|
number = float
|
||||||
| integer
|
| integer
|
||||||
id-specials = "!" | "$" | "%" | "&" | "*" | "/" | ":" | "<"
|
id-specials = "!" | "$" | "%" | "&" | "*" | "/" | ":" | "<"
|
||||||
| " =" | ">" | "?" | "^" | "_" | "~" | "+" | "-" | "." | "@"
|
| " =" | ">" | "?" | "^" | "_" | "~" | "+" | "-" | "." | "@"
|
||||||
letters = [a-zA-Z] => [[ 1array >string ]]
|
letters = [a-zA-Z] => [[ 1array >string ]]
|
||||||
initials = letters | id-specials
|
initials = letters | id-specials
|
||||||
numbers = [0-9] => [[ 1array >string ]]
|
numbers = [0-9] => [[ 1array >string ]]
|
||||||
subsequents = initials | numbers
|
subsequents = initials | numbers
|
||||||
identifier = initials (subsequents)* => [[ first2 concat append <lisp-symbol> ]]
|
identifier = initials (subsequents)* => [[ first2 concat append <lisp-symbol> ]]
|
||||||
string = dquote ("\" . | !(dquote) . )* dquote => [[ second >string ]]
|
escaped = "\" . => [[ second ]]
|
||||||
|
string = dquote ( escaped | !(dquote) . )* dquote => [[ second >string ]]
|
||||||
atom = number
|
atom = number
|
||||||
| identifier
|
| identifier
|
||||||
| string
|
| string
|
||||||
list-item = _ (atom|s-expression) _ => [[ second ]]
|
list-item = _ (atom|s-expression) _ => [[ second ]]
|
||||||
s-expression = LPAREN (list-item)* RPAREN => [[ second <s-exp> ]]
|
s-expression = LPAREN (list-item)* RPAREN => [[ second <s-exp> ]]
|
||||||
;EBNF
|
;EBNF
|
Loading…
Reference in New Issue