d6bdd08002
the typechecker project can collect all the top level types from a file, which is pretty cool I think (except for pointers, those aren't implemented yet...)
17 lines
600 B
C#
17 lines
600 B
C#
using System.Linq.Expressions;
|
|
using System.Reflection.Metadata;
|
|
using System.Text;
|
|
using meowlang.parser.antlr;
|
|
|
|
namespace meowlang.parser;
|
|
|
|
public class VisitorNya : MeowBaseVisitorNya<Model>
|
|
{
|
|
public override Model VisitFile(MeowParser.FileContext context)
|
|
{
|
|
var imports = context.importStatement().Select(x => new ImportVisitorNya().Visit(x)).ToList();
|
|
var declarations = context.topLevelDeclaration().Select(x => new DeclarationVisitorNya().Visit(x.unterminatedTopLevelDeclaration())).ToList();
|
|
|
|
return new Model(context.GetSpan(), imports, declarations);
|
|
}
|
|
} |