-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
39 lines (34 loc) · 1.21 KB
/
Program.cs
File metadata and controls
39 lines (34 loc) · 1.21 KB
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
using Interpreter;
using Funcs;
namespace Program{
class Program{
static int i = 0;
static void Main(string[] args){
if(args.Length == 0){
Funcs.Sys.Exit(1, "Error: No input file location provided");
}
if(args.Length == 1){
Funcs.Sys.Exit(1, "Error: No output file location provided");
}
string fileLocation = args[0];
string outputDestination = args[1];
if(File.Exists(fileLocation)){
Dictionary<int, int> storage = new Dictionary<int, int>(){
{0, 0}
};
File.Create(outputDestination).Close();
string data = File.ReadAllText(fileLocation);
char[] paras = data.ToCharArray();
while(i<paras.Length){
char param = paras[i];
Interpreter.Interpreter.Interpret(param, storage, paras, i);
i++;
}
File.WriteAllText(outputDestination, Interpreter.Interpreter.GetOutput());
}
}
public static void SetI(int value){
i = value;
}
}
}