Documentation
¶
Overview ¶
Copyright (c) 2026 Tarek Wasfy Package codetranspiler exposes the stable many-to-many Code Transpiler API.
Import path: github.com/tarekwasfy01/Code-Transpiler
Index ¶
- func BinarySemanticJSON(data []byte, options CompileOptions) ([]byte, error)
- func CapabilityMatrixJSON(features []string) ([]byte, error)
- func CopyImportedPackageLicenses(storeRoot, outputPath string) (int, error)
- func DecompileSemanticJSON(data []byte, options CompileOptions) ([]byte, error)
- func ImplementationMatrixJSON() ([]byte, error)
- func LanguagesJSON() ([]byte, error)
- func LinkSemanticProgramModules(program *SemanticProgram, options SemanticModuleLinkOptions) error
- func MarshalSemanticSE(program *SemanticProgram) ([]byte, error)
- func MarshalSemanticSP(program *SemanticProgram) ([]byte, error)
- func MarshalSemanticSPZ(program *SemanticProgram) ([]byte, error)
- func NativeAnalysisJSON(source, filename, code string) ([]byte, error)
- func NativeSemanticJSON(source, filename, code string) ([]byte, error)
- func SemanticJSON(source, code string) ([]byte, error)
- func SemanticSE(source, code string) ([]byte, error)
- func SemanticSP(source, code string) ([]byte, error)
- func Transpile(source, target, code string) (string, error)
- func TranspileSemanticJSON(target string, data []byte) (string, error)
- func TranspileSemanticSE(target string, data []byte) (string, error)
- func TranspileSemanticSP(target string, data []byte) (string, error)
- type Capability
- type CompileInputKind
- type CompileOptions
- type CompileOutputKind
- type CompileResult
- type ExternalCCompileOptions
- type ExternalCCompileResult
- type ExternalCompilerAvailability
- type ExternalCompilerFamily
- type LLVMCompileOptions
- type LLVMCompileResult
- type LLVMOutputKind
- type LLVMProjectResult
- type LLVMProjectionCell
- type LLVMProjectionPlan
- type LLVMTechnicalEvidenceProfile
- type Language
- type SemanticModuleEmbeddingMode
- type SemanticModuleLinkOptions
- type SemanticProgram
- type SemanticProject
- type TranspileRequest
- type TranspileTrace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinarySemanticJSON ¶ added in v1.2.8
func BinarySemanticJSON(data []byte, options CompileOptions) ([]byte, error)
BinarySemanticJSON lifts an x86-64 assembly, machine-code, COFF, or PE32+ input through the structured machine frontend and returns the same SemanticProgram JSON used by source-language inputs. Unsupported or ambiguous instructions fail closed instead of being guessed as source.
func CapabilityMatrixJSON ¶ added in v1.0.5
CapabilityMatrixJSON returns status matrices for semantic requirements across all registered targets. Unknown requested features are unsupported.
func CopyImportedPackageLicenses ¶ added in v1.3.2
CopyImportedPackageLicenses exports the licenses recorded by semantic module manifests into a sibling `licenses` directory beside outputPath. It is the API counterpart of the CLI -license/-l option.
func DecompileSemanticJSON ¶ added in v1.2.8
func DecompileSemanticJSON(data []byte, options CompileOptions) ([]byte, error)
DecompileSemanticJSON is the public decompilation entry point for binary and assembly inputs. It returns the canonical SemanticProgram JSON emitted by the structured machine frontend, without routing through a source parser.
func ImplementationMatrixJSON ¶ added in v1.0.5
ImplementationMatrixJSON returns typed operations by frontend, JSON, runtime and target implementation stages. Declarations are not execution test results.
func LanguagesJSON ¶
func LinkSemanticProgramModules ¶ added in v1.3.2
func LinkSemanticProgramModules(program *SemanticProgram, options SemanticModuleLinkOptions) error
LinkSemanticProgramModules makes module linking available to API clients before emission. With EmbedAll false it obeys the program's serialized semantic_module_link_roots selection. With EmbedAll true it materializes all declared modules into one canonical SemanticProgram.
func MarshalSemanticSE ¶ added in v1.2.9
func MarshalSemanticSE(program *SemanticProgram) ([]byte, error)
func MarshalSemanticSP ¶ added in v1.2.8
func MarshalSemanticSP(program *SemanticProgram) ([]byte, error)
MarshalSemanticSP serializes a canonical program as readable SP.
func MarshalSemanticSPZ ¶ added in v1.2.8
func MarshalSemanticSPZ(program *SemanticProgram) ([]byte, error)
MarshalSemanticSPZ returns the optional compressed SP transport.
func NativeAnalysisJSON ¶ added in v1.0.5
NativeAnalysisJSON extracts native types, source spans and symbol relations. Currently supports import-free Go files. This is an analysis artifact, not an executable SemanticProgram; TranspileSemanticJSON intentionally rejects it.
func NativeSemanticJSON ¶ added in v1.0.5
NativeSemanticJSON converts a supported native source subset directly to an executable SemanticProgram. It never retries the legacy textual frontend. Accepts a bounded Go scalar/function subset, including fixed-width integers.
func SemanticJSON ¶
func SemanticSE ¶ added in v1.2.9
SemanticSE is the .se-named alias of the lossless SemanticProgram format.
func SemanticSP ¶ added in v1.2.8
SemanticSP exports a source program as the readable, lossless Semantic Programming transport format.
func TranspileSemanticSE ¶ added in v1.2.9
Types ¶
type Capability ¶
type Capability struct {
Feature string `json:"feature"`
Backend string `json:"backend"`
Status string `json:"status"`
Reason string `json:"reason,omitempty"`
}
func BackendCapability ¶
func BackendCapability(feature, target string) Capability
type CompileInputKind ¶ added in v1.2.1
type CompileInputKind = backend.CompileInputKind
const ( InputSource CompileInputKind = backend.CompileInputSource InputAssembly CompileInputKind = backend.CompileInputAssembly InputMachine CompileInputKind = backend.CompileInputMachine InputObject CompileInputKind = backend.CompileInputObject InputExecutable CompileInputKind = backend.CompileInputExecutable )
type CompileOptions ¶ added in v1.2.1
type CompileOptions = backend.CompileOptions
type CompileOutputKind ¶ added in v1.2.1
type CompileOutputKind = backend.CompileOutputKind
const ( Source CompileOutputKind = backend.CompileSource Assembly CompileOutputKind = backend.CompileAssembly MachineCode CompileOutputKind = backend.CompileMachineCode Object CompileOutputKind = backend.CompileObject Executable CompileOutputKind = backend.CompileExecutable )
type CompileResult ¶ added in v1.2.1
type CompileResult = backend.CompileResult
func Compile ¶ added in v1.2.1
func Compile(source string, options CompileOptions) (CompileResult, error)
Compile uses the same ModernFrontend and canonical UAST as Transpile. Native outputs are encoded in-process; Assembly is an optional rendering.
func CompileSemanticProgram ¶ added in v1.3.2
func CompileSemanticProgram(program *SemanticProgram, options CompileOptions) (CompileResult, error)
CompileSemanticProgram compiles an already linked canonical program. It is used by directory/module compilation so all units share one semantic root.
func CompileSemanticProject ¶ added in v1.3.2
func CompileSemanticProject(project *SemanticProject, options CompileOptions) (CompileResult, error)
CompileSemanticProject compiles directory units independently and links only their target fragments. It never materializes a merged SemanticProgram.
type ExternalCCompileOptions ¶ added in v1.3.2
type ExternalCCompileOptions = backend.ExternalCCompileOptions
type ExternalCCompileResult ¶ added in v1.3.2
type ExternalCCompileResult = backend.ExternalCCompileResult
func CompileExternalC ¶ added in v1.3.2
func CompileExternalC(program *SemanticProgram, options ExternalCCompileOptions) (ExternalCCompileResult, error)
CompileExternalC projects the canonical UAST through the existing C target and uses GCC/MinGW or MSVC only for final native object/executable creation.
type ExternalCompilerAvailability ¶ added in v1.3.2
type ExternalCompilerAvailability = backend.ExternalCompilerAvailability
func DiscoverExternalCompilers ¶ added in v1.3.2
func DiscoverExternalCompilers() []ExternalCompilerAvailability
DiscoverExternalCompilers is the shared CLI/GUI/API availability contract.
type ExternalCompilerFamily ¶ added in v1.3.2
type ExternalCompilerFamily = backend.ExternalCompilerFamily
const ( ExternalCompilerAuto ExternalCompilerFamily = backend.ExternalCompilerAuto ExternalCompilerGCC ExternalCompilerFamily = backend.ExternalCompilerGCC ExternalCompilerMSVC ExternalCompilerFamily = backend.ExternalCompilerMSVC )
type LLVMCompileOptions ¶ added in v1.3.2
type LLVMCompileOptions = backend.LLVMCompileOptions
type LLVMCompileResult ¶ added in v1.3.2
type LLVMCompileResult = backend.LLVMCompileResult
func CompileLLVM ¶ added in v1.3.2
func CompileLLVM(program *SemanticProgram, options LLVMCompileOptions) (LLVMCompileResult, error)
CompileLLVM projects an already linked canonical UAST to LLVM IR and, when requested, uses the installed LLVM toolchain for native emission. It is an optional route; the established native compiler remains unchanged.
type LLVMOutputKind ¶ added in v1.3.2
type LLVMOutputKind = backend.LLVMOutputKind
const ( LLVMIR LLVMOutputKind = backend.LLVMIR LLVMAssembly LLVMOutputKind = backend.LLVMAssembly LLVMObject LLVMOutputKind = backend.LLVMObject LLVMExecutable LLVMOutputKind = backend.LLVMExecutable )
type LLVMProjectResult ¶ added in v1.3.2
type LLVMProjectResult = backend.LLVMProjectResult
func CompileLLVMProject ¶ added in v1.3.2
func CompileLLVMProject(project *SemanticProject, options LLVMCompileOptions) (LLVMProjectResult, error)
CompileLLVMProject compiles every SemanticCompilationUnit independently to an LLVM/COFF fragment and, for LLVMExecutable, links those fragments into a single PE image. Semantic bodies never cross the unit boundary.
type LLVMProjectionCell ¶ added in v1.3.2
type LLVMProjectionCell = backend.LLVMProjectionCell
type LLVMProjectionPlan ¶ added in v1.3.2
type LLVMProjectionPlan = backend.LLVMProjectionPlan
func BuildLLVMProjectionPlan ¶ added in v1.3.2
func BuildLLVMProjectionPlan(program *SemanticProgram) (LLVMProjectionPlan, error)
BuildLLVMProjectionPlan exposes the matrix-derived UAST-to-LLVM contract without emitting an artifact. It is useful for capability reports and preflight diagnostics in clients embedding the package.
type LLVMTechnicalEvidenceProfile ¶ added in v1.3.2
type LLVMTechnicalEvidenceProfile = backend.LLVMTechnicalEvidenceProfile
func LLVMTechnicalEvidence ¶ added in v1.3.2
func LLVMTechnicalEvidence() LLVMTechnicalEvidenceProfile
type Language ¶
type SemanticModuleEmbeddingMode ¶ added in v1.3.2
type SemanticModuleEmbeddingMode = backend.SemanticModuleEmbeddingMode
const ( SemanticModulesNeeded SemanticModuleEmbeddingMode = backend.SemanticModulesNeeded SemanticModulesReference SemanticModuleEmbeddingMode = backend.SemanticModulesReference SemanticModulesAll SemanticModuleEmbeddingMode = backend.SemanticModulesAll )
type SemanticModuleLinkOptions ¶ added in v1.3.2
type SemanticModuleLinkOptions = backend.SemanticModuleLinkOptions
type SemanticProgram ¶ added in v1.2.8
type SemanticProgram = backend.SemanticProgram
func ParseSemanticSE ¶ added in v1.2.9
func ParseSemanticSE(data []byte) (*SemanticProgram, error)
func ParseSemanticSP ¶ added in v1.2.8
func ParseSemanticSP(data []byte) (*SemanticProgram, error)
ParseSemanticSP imports a readable SP document into the canonical program.
func ParseSemanticSPZ ¶ added in v1.2.8
func ParseSemanticSPZ(data []byte) (*SemanticProgram, error)
ParseSemanticSPZ imports the optional compressed SP transport.
type SemanticProject ¶ added in v1.3.2
type SemanticProject = backend.SemanticProject
func LoadSemanticProject ¶ added in v1.3.2
func LoadSemanticProject(dir, entry string) (*SemanticProject, error)
type TranspileRequest ¶ added in v1.0.6
type TranspileRequest = manytomany.TranspileRequest
TranspileRequest and TranspileTrace expose the same immutable diagnostic boundary used by the bundled GUI and CLI.
type TranspileTrace ¶ added in v1.0.6
type TranspileTrace = manytomany.TranspileTrace
func TranspileWithTrace ¶ added in v1.0.6
func TranspileWithTrace(request TranspileRequest) (string, TranspileTrace, error)
TranspileWithTrace is useful for differential diagnostics: it returns the exact hashes and native/runtime decision made by the common TranspileCore.