Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (30 sloc) 0.994 kB
use("core")
use("define")
process-arg(`[@~name], as, cs) = as << `[.~name]
process-arg(`(@~name = ~default), as, cs) = as << `[.~name, ~default]
process-arg(`@~name, as, cs) = as << `.~name
process-arg(`(.~name = ~default), as, cs) = cs << `[.~name, ~default]
process-arg(c, as, cs) = cs << c
define-class(root, `(~n { ~*cs })) = define-class(root, `((~n)() { ~*cs }))
define-class(root, x: `((~name)(~*as))) = define-class(root, `(~x {}))
define-class(root, e: Atomy AST Constant) =
`(~e = ~root class:)
define-class(root, `((~name)(~*as): ~*cs)) = do:
children = []
attributes = []
as each [a]:
process-arg(a, attributes, children)
`(do:
~name = ~root class:
children(~*children)
attributes(~*attributes)
~*(cs collect [c]: define-class(name, c)))
macro(ast(~x)):
`(ast: ~x)
macro(ast: ~*nodes):
`(ast(//Atomy AST Node): ~*nodes)
macro(ast(~root): ~*nodes):
`(do:
~*(nodes collect [n]:
define-class(root, n))
nil)
Jump to Line
Something went wrong with that request. Please try again.