In preparation for some of the more ambitious code generation we've been talking about, it would be nice to have a class for building AST nodes from text, rather than extremely verbose calls to the new operator.
So rather than this:
auto* md = new ModuleDeclaration(new Attributes(), new Identifier("m"));
You could just do this:
AstBuilder() << "module m(); endmodule";
While we're at it, we'll probably want to pass exisiting ast nodes to operator<<, which means we'll finally want to wrap TextPrinter and TermPrinter in something more user friendly like this:
cout << text << md << endl; // Invokes TextPrinter
cout << color << md << endl; // Invokes TermPrinter
Overview
In preparation for some of the more ambitious code generation we've been talking about, it would be nice to have a class for building AST nodes from text, rather than extremely verbose calls to the new operator.
So rather than this:
You could just do this:
While we're at it, we'll probably want to pass exisiting ast nodes to operator<<, which means we'll finally want to wrap TextPrinter and TermPrinter in something more user friendly like this:
Deliverables