public void Setup()
 {
     lexer  = new PascalLexer();
     ast    = new PascalAst();
     table  = new PascalSemanticAnalyzer();
     cSharp = new PascalToCSharp();
 }
 public void Setup()
 {
     lexer        = new PascalLexer();
     ast          = new PascalAst();
     analyzer     = new PascalSemanticAnalyzer();
     threeAddress = new PascalToThreeAddress();
 }
        protected override async Task OnInitializedAsync()
        {
            lexer       = new PascalLexer(this);
            ast         = new PascalAst(this);
            analyzer    = new PascalSemanticAnalyzer(this);
            csharp      = new PascalToCSharp();
            con         = new ConsoleModel();
            interpreter = new PascalInterpreter(console: con);
            Examples.Add("Hello World", @"program hello;
begin
    writeln('hello world!');
end.");

            Examples.Add("Simple Program", @"program test;
begin
end.");
            Examples.Add("Math", @"program math;
var a,b,c : integer;
begin
    a := 10;
    b := 20;
    c := 30;
    writeln(a + c - b);
end.");
            //Compile();
            base.OnInitialized();
        }
Beispiel #4
0
 public void Setup()
 {
     console     = new ConsoleModel();
     interpreter = new PascalInterpreter(null, console);
     lexer       = new PascalLexer();
     ast         = new PascalAst();
     analyzer    = new PascalSemanticAnalyzer();
 }
Beispiel #5
0
 public void Setup()
 {
     logger      = new LoggerMock();
     interpreter = new PascalInterpreter(logger);
     lexer       = new PascalLexer();
     ast         = new PascalAst();
     analyzer    = new PascalSemanticAnalyzer(logger);
 }
        public override bool Execute()
        {
            try
            {
                var text = File.ReadAllText(FileName);

                var lexer  = new PascalLexer();
                var tokens = lexer.Tokenize(text);

                var ast = new PascalAst();

                var node = ast.Evaluate(tokens);

                var syntaxChecker = new PascalSemanticAnalyzer();
                syntaxChecker.CheckSyntax(node);

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
            //System.Diagnostics.Debugger.Launch();
        }
 public void Setup()
 {
     lexer = new PascalLexer();
     ast   = new PascalAst();
 }
 public PascalSourceToSourceCompiler(ILogger logger)
 {
     lexer = new PascalLexer();
     ast   = new PascalAst();
     table = new PascalSemanticAnalyzer(logger);
 }