thinking about some new stuff.

This commit is contained in:
Paul R. Tagliamonte 2013-03-08 23:07:21 -05:00
parent 7c7a613c9c
commit 8c07829ff9
3 changed files with 12 additions and 2 deletions

View File

@ -82,6 +82,10 @@ class HyASTCompiler(object):
def compile_raw_list(self, entries): def compile_raw_list(self, entries):
return [self.compile(x) for x in entries] return [self.compile(x) for x in entries]
#@builds("do")
#def compile_do_expression(self, expr):
# return [self.compile(x) for x in expr[1:]]
@builds("assert") @builds("assert")
def compile_assert_expression(self, expr): def compile_assert_expression(self, expr):
expr.pop(0) # assert expr.pop(0) # assert

View File

@ -26,7 +26,5 @@ from hy.models.symbol import HySymbol
@macro("defn") @macro("defn")
def defn_macro(tree): def defn_macro(tree):
# (defn foo [x] ...)
# (def foo (fn [x] ...))
return HyExpression([HySymbol("def"), return HyExpression([HySymbol("def"),
tree[1], HyExpression([HySymbol("fn")] + tree[2:])]) tree[1], HyExpression([HySymbol("fn")] + tree[2:])])

View File

@ -52,6 +52,14 @@ def _resolve_atom(obj):
except ValueError: except ValueError:
pass pass
table = {
"true": "True",
"false": "False",
"null": "None",
}
if obj in table:
return HySymbol(table[obj])
return HySymbol(obj) return HySymbol(obj)