Ejemplo n.º 1
0
 public LexerTests()
 {
     var memStream = new MemoryStream(Encoding.UTF8.GetBytes(_data));
     var reader = new StreamReader(memStream);
     var source = new Source(reader);
     _sys = new LexicalAnalyzer(source);
 }
Ejemplo n.º 2
0
        public Compilation Compile(string filePath)
        {
            var streamReader = File.OpenText(filePath);
            var compileSource = new Source(streamReader);
            var lexicalAnalyzer = new LexicalAnalyzer(compileSource);

            lexicalAnalyzer.Tokenize();

            var syntaxAnalyzer = new SyntaxAnalyzer(lexicalAnalyzer.TokenStream);

            var rootNode = syntaxAnalyzer.Analyze();

            var builderVisitor = new BuilderVisitor();
            builderVisitor.Visit(rootNode);

            return new Compilation
            {
                FileDescriptor = builderVisitor.FileDescriptor,
                Errors = rootNode.Errors
            };
        }
Ejemplo n.º 3
0
 public SourceTests()
 {
     var memStream = new MemoryStream(Encoding.UTF8.GetBytes(Data));
     var reader = new StreamReader(memStream);
     _sys = new Source(reader);
 }