Adding negative numbers to the parser, other minor changes

db4
James Cash 2008-04-30 17:00:20 -04:00
parent 598bb166de
commit dcab546b97
1 changed files with 9 additions and 8 deletions

View File

@ -18,8 +18,8 @@ RPAREN = ")"
dquote = '"'
squote = "'"
digit = [0-9]
integer = (digit)+ => [[ string>number ]]
float = (digit)+ "." (digit)* => [[ first3 >string [ >string ] dipd 3append string>number ]]
integer = ("-")? (digit)+ => [[ string>number ]]
float = ("-")? (digit)+ "." (digit)* => [[ first3 >string [ >string ] dipd 3append string>number ]]
number = float
| integer
id-specials = "!" | "$" | "%" | "&" | "*" | "/" | ":" | "<"
@ -29,7 +29,8 @@ initials = letters | id-specials
numbers = [0-9] => [[ 1array >string ]]
subsequents = initials | numbers
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
| identifier
| string