I've finally checked in the first feature to take advantage of the new parser. Now macros can use backticks just about anywhere, which means you can generate most ast without resorting to writing ruby code. We should be able to use this to really clean up a lot of the current code base. Here's an example of how to implement something like ruby's attr_accessor:
import duby.lang.compiler.StringNode
class Foo
macro def attr_accessor(name_node, type)
name = StringNode(name_node).literal
quote do
def `name`
@`name`
end
def `"#{name}_set"`(`name`:`type`)
@`name` = `name`
end
end
end
make_attr :foo, :int
end
x = Foo.new
puts x.foo
x.foo = 3
puts x.foo