-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
50 lines (44 loc) · 2.41 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HVLK;
namespace HVLK
{
class Program
{
public static List<Error> errors=new List<Error>();
public static int MAX_IT = 0;
public static int l=1;
public static void Main(string[] args)
{
Console.Clear();
Console.ForegroundColor = ConsoleColor.Green;
string v2 = "\r\n ) ( ) \r\n ( ( ( ) ( /( )\\ ) ( /( \r\n )\\))( ' ( )\\ ) ( ( /( )\\()) ( (()/( )\\()) \r\n((_)()\\ ) ))\\((_) ( ( ( ))\\ )\\()) ( ((_)\\ )\\ /(_))|((_)\\ \r\n_(())\\_)() /((_)_ )\\ )\\ )\\ ' /((_) (_))/ )\\ _((_) _ ((_)(_)) |_ ((_) \r\n\\ \\((_)/ /(_)) | | ((_)((_) _((_)) (_)) | |_ ((_) | || || | | || | | |/ / \r\n \\ \\/\\/ / / -_)| |/ _|/ _ \\| ' \\()/ -_) | _|/ _ \\ | __ || |_| || |__ ' < \r\n \\_/\\_/ \\___||_|\\__|\\___/|_|_|_| \\___| \\__|\\___/ |_||_| \\___/ |____| _|\\_\\ \r\n \r\n";
Console.WriteLine(v2);
Console.WriteLine("Let's get started---------------:");
while (true)
{
Console.Write(" :) >>>");
string line = Console.ReadLine();
List<Token> tokens = new List<Token>();
tokens = Lexer.Tokenizar(line);
if (errors.Count > 0) {foreach (Error error in errors) { error.Evaluate();}CleanErrors();continue;}
RecursiveParser recursive_parser = new RecursiveParser(tokens);
var AST = recursive_parser.Parse();
if (errors.Count > 0) { foreach (Error error in errors) { error.Evaluate(); } CleanErrors(); continue; }
object result = AST.Evaluate();
if(errors.Count>0&&result==null) { foreach (Error error in errors) { error.Evaluate(); } CleanErrors(); continue; }
else Console.WriteLine(result);
Contexto.Reset();
CleanErrors();
l += 2;
}
}
public static void CleanErrors()
{
errors = new List<Error>();
}
}
}