mirror of
https://github.com/vonhyou/lisp-interpreter.git
synced 2025-06-08 02:02:01 +00:00
format
This commit is contained in:
parent
6e5d36a823
commit
3cb684840a
1 changed files with 4 additions and 5 deletions
|
@ -44,17 +44,16 @@ end
|
||||||
|
|
||||||
def atom(token)
|
def atom(token)
|
||||||
# Analyse numbers and symbols
|
# Analyse numbers and symbols
|
||||||
isInteger = ->(atom) { atom.match?(/^-?\d+$/) }
|
is_integer = ->(atom) { atom.match?(/^-?\d+$/) }
|
||||||
isFloat = ->(atom) { atom.match?(/^(-?\d+)(\.\d+)?$/) }
|
is_float = ->(atom) { atom.match?(/^(-?\d+)(\.\d+)?$/) }
|
||||||
return Integer token if isInteger.call token
|
return Integer token if is_integer.call token
|
||||||
return Float token if isFloat.call token
|
return Float token if is_float.call token
|
||||||
|
|
||||||
token.to_sym
|
token.to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
# p parse '(def 1 2 (c 3.3 (r f r) e))'
|
# p parse '(def 1 2 (c 3.3 (r f r) e))'
|
||||||
|
|
||||||
|
|
||||||
##### Environments
|
##### Environments
|
||||||
|
|
||||||
def generate_env
|
def generate_env
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue