TFWR.Compiler
1.0.3
dotnet add package TFWR.Compiler --version 1.0.3
NuGet\Install-Package TFWR.Compiler -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TFWR.Compiler" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TFWR.Compiler" Version="1.0.3" />
<PackageReference Include="TFWR.Compiler" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TFWR.Compiler --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TFWR.Compiler, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TFWR.Compiler@1.0.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TFWR.Compiler&version=1.0.3
#tool nuget:?package=TFWR.Compiler&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TFWR.Compiler
The Farmer Was Replaced용 C# / TypeScript 소스를 인게임 DSL(.py)로 번역하는 컴파일러 라이브러리입니다.
- C#: Roslyn 파싱 → IR lowering → Python emit
- TypeScript: Node
TsFrontendbridge → IR JSON → deserialize → 동일 Emitter
CLI는 tfwrc가 이 라이브러리를 호출합니다. C# 스텁은 TFWR.Api, TS typings는 TFWR.Api.Ts입니다.
파이프라인
C# (.cs) → Roslyn → LoweringContext ─┐
├─► IR → TfwrEmitter → .py
TS (.ts) → Node bridge → IR JSON ───────┘
| 단계 | 구성 | 설명 |
|---|---|---|
| 진입 | TfwrCompiler |
--lang cs\|ts 분기, emit 조율 |
| C# Lowering | LoweringContext |
C# AST → TFWR IR |
| TS Lowering | TsFrontend/lower.mjs |
TS AST → IR JSON |
| JSON | IrJsonDeserializer |
IR JSON → CLR IR |
| Emit | TfwrEmitter |
IR → Python 소스 |
공개 API
var result = TfwrCompiler.Compile(new CompileOptions
{
InputFiles = [@"D:\farm\Program.cs"], // or .ts with Language = "ts"
OutputDirectory = @"D:\farm\out",
Language = "cs", // or "ts"
EmitTopLevelEntry = false
});
var result = TfwrCompiler.CompileToMemory(new Dictionary<string, string>
{
["Program.ts"] = source
}, emitTopLevelEntry: true, language: "ts");
--lang ts는 Node.js 20+와 TsFrontend/node_modules(npm ci)가 필요합니다.
v1 지원 범위
C#과 TS 공통으로 IR 계약을 맞춥니다. 상세는 기존 C# README 범위와 동일합니다(클래스→dict, 제어흐름, 컬렉션, Game API; try/async/lambda 거부).
패키지 정보
- 대상 프레임워크:
net10.0 - 의존성:
Microsoft.CodeAnalysis.CSharp,TFWR.Api, (ts) Node +typescript
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Basic.Reference.Assemblies.Net100 (>= 1.8.11)
- Microsoft.CodeAnalysis.CSharp (>= 5.9.0)
- TFWR.Api (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.