This repository has been archived by the owner on Oct 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
77 lines (69 loc) · 2.56 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using AbisInterpreter;
namespace InterpretadorAbis
{
internal class Program
{
static void Main(string[] args)
{
if (args.Any())
{
var path = args[0];
if (File.Exists(path))
{
do
{
//Recives and reads the file
StreamReader input = File.OpenText(path);
string comandos = input.ReadToEnd();
input.Close();
//Console.WriteLine(comandos);
try
{
Interpreter.Intepretar(comandos);
}
catch (Interpreter.InterpretationException ex)
{
//System.Console.WriteLine("Program finished with errors!");
System.Console.WriteLine(ex.Message);
}
catch(System.Exception ex){
System.Console.WriteLine(
"\n-----------------<ERROR>----------------\n"+
"Caught Unhandled Error:"+ ex.Message+
"\n-----------------<ERROR>----------------"
);
//System.Console.WriteLine(ex.StackTrace);
}
System.Console.WriteLine("############################################################################");
if(Console.ReadLine() == "e") break;
} while (true);
//Outputs
Console.WriteLine("\n\nProgram Closed.");
}
else
{
Console.WriteLine("File not found.");
}
}
else
{
Console.WriteLine("No File Expecified!");
}
}
static void Tabuda_Csharp(){
int numero;
do {
Console.WriteLine("Digite o numero para ver a tabuada");
if(int.TryParse(Console.ReadLine(), out int result)){
numero = result;
break;
}
} while(true);
for(int i = 1; i <= 10; i++)
{
Console.WriteLine("{0} * {1} = {2}", numero, i, (numero * i));
}
}
}
}