envlang-csharp/AstGenerator.cs
2020-08-31 20:21:56 +00:00

23 lines
636 B
C#

using static Generator;
public static class AstGenerator {
public static void Main() {
Generate(
"AstGenerated.cs",
"using System.Collections.Generic;",
"namespace Ast {",
"}",
"Ast.",
Types(
Variant("Expr",
Case("int", "Int"),
Case("string", "String")),
Variant("ParserResult",
Case("MixFix.Annotation", "Annotated"),
Case("Lexer.Lexeme", "Terminal"),
Case("IEnumerable<ParserResult>", "Productions")),
Variant("AstNode",
Case("Expr", "Terminal"),
Case("IEnumerable<AstNode>", "Operator"))));
}
}