tlang-runtime-compiler/ByteCodeTest/Program.cs

16 lines
427 B
C#
Raw Normal View History

2023-07-29 00:11:09 +00:00
using TLang.BytecodeCompiler;
using TLang.Common;
using TLang.Parser;
2023-07-30 07:55:10 +00:00
using TLang.Lexer;
using Newtonsoft.Json;
var ctx=Lex.GetTokensFromFile("app.tlang");
var res=Parse.ParseFromLexContext(ctx);
File.WriteAllText("ast.json",JsonConvert.SerializeObject(res,Formatting.Indented));
2023-07-29 00:11:09 +00:00
using(var f = File.Create("app.tvm"))
{
ByteCodeGenerator.GenerateToStream(res,f,new TLangVersion(1,0,0,0),new TLangVersion(1,0,0,0));
}