boxscript-interperter/Program.cs

38 lines
887 B
C#

using langtest;
using Newtonsoft.Json;
/*
var re=new ApplicationState();
if(args.Length == 0)
{
string? text;
while((text=Lexer.Prompt("> ")) != null)
{
var lexed=Lexer.EnumerateTokens(text);
var res=Ast.Parse(lexed.ToList());
res.Execute(re);
}
}else{
string text=File.ReadAllText(args[0]);
var lexed=Lexer.EnumerateTokens(text);
var res=Ast.Parse(lexed.ToList());
res.Execute(re);
}*/
var app = new ApplicationState();
var ast = new ListNode();
foreach(var file in Directory.GetFiles("code/dep","*",SearchOption.AllDirectories))
{
string text=File.ReadAllText(file);
var lexed=Lexer.EnumerateTokens(text);
Ast.Parse(ast,lexed.ToList());
}
string text2=File.ReadAllText("code/app.bs");
var lexed2=Lexer.EnumerateTokens(text2);
Ast.Parse(ast,lexed2.ToList());
ast.Execute(app);