-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
43 lines (36 loc) · 1.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
// command line to release
// dotnet publish -o "publish" Norma.csproj -r win-x64 -c Release -p:PublishReadyToRun=true -p:PublishSingleFile=true --self-contained
namespace NormaLang
{
public static class Program
{
public static void Main(string[] args)
{
if (args.Length == 0 && false)
{
Console.WriteLine("No file specified. Please use 'Open with' in the file explorer or pass the file as an argument in the command prompt to run this file.");
return;
}
string filePath = "D:\\Norma\\Bear Bootstrap\\Main.norm";
string contents = "";
if (!File.Exists(filePath))
{
Console.WriteLine($"The file '{filePath}' does not exist.");
return;
}
try
{
contents = File.ReadAllText(filePath);
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred while reading the file: {ex.Message}");
}
//System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
var code = contents;
Interprete.RunCode("var amount = 5\r\nvar amoney = 0.125\r\n\r\nif $amoney$ > $amount$ {\r\n var enemy = getEnemy \"first\", $this$\r\n rotateTo $enemy$, $this$\r\n shoot 100, $this$\r\n}", filePath);
// To time how fast Norm is
//Console.WriteLine("------------------\nMiliseconds: " + sw.ElapsedMilliseconds.ToString());
}
}
}