tlang-runtime-compiler/ByteCodeTest/Program.cs

16 lines
427 B
C#

using TLang.BytecodeCompiler;
using TLang.Common;
using TLang.Parser;
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));
using(var f = File.Create("app.tvm"))
{
ByteCodeGenerator.GenerateToStream(res,f,new TLangVersion(1,0,0,0),new TLangVersion(1,0,0,0));
}