refact: 将编译中各个阶段接口化 (#35)

Reviewed-on: PostGuard/Canon#35
This commit is contained in:
2024-04-12 19:01:37 +08:00
parent f1c569ee0e
commit 67deb0aa2c
15 changed files with 748 additions and 615 deletions

View File

@@ -0,0 +1,22 @@
using System.Text;
namespace Canon.Core.CodeGenerators;
/// <summary>
/// 构建C语言代码
/// </summary>
public class CCodeBuilder
{
private readonly StringBuilder _builder = new();
public void AddString(string code)
{
_builder.Append(code);
}
public string Build()
{
return _builder.ToString();
}
}