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/v2
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 ¶
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 ¶
CapabilityMatrixJSON returns status matrices for semantic requirements across all registered targets. Unknown requested features are unsupported.
func CopyImportedPackageLicenses ¶
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 ¶
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 ¶
ImplementationMatrixJSON returns typed operations by frontend, JSON, runtime and target implementation stages. Declarations are not execution test results.
func LanguagesJSON ¶
func LinkSemanticProgramModules ¶
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 ¶
func MarshalSemanticSE(program *SemanticProgram) ([]byte, error)
func MarshalSemanticSP ¶
func MarshalSemanticSP(program *SemanticProgram) ([]byte, error)
MarshalSemanticSP serializes a canonical program as readable SP.
func MarshalSemanticSPZ ¶
func MarshalSemanticSPZ(program *SemanticProgram) ([]byte, error)
MarshalSemanticSPZ returns the optional compressed SP transport.
func NativeAnalysisJSON ¶
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 ¶
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 ¶
SemanticSE is the .se-named alias of the lossless SemanticProgram format.
func SemanticSP ¶
SemanticSP exports a source program as the readable, lossless Semantic Programming transport format.
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 ¶
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 ¶
type CompileOptions = backend.CompileOptions
type CompileOutputKind ¶
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 ¶
type CompileResult = backend.CompileResult
func Compile ¶
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 ¶
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 ¶
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 ¶
type ExternalCCompileOptions = backend.ExternalCCompileOptions
type ExternalCCompileResult ¶
type ExternalCCompileResult = backend.ExternalCCompileResult
func CompileExternalC ¶
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 ¶
type ExternalCompilerAvailability = backend.ExternalCompilerAvailability
func DiscoverExternalCompilers ¶
func DiscoverExternalCompilers() []ExternalCompilerAvailability
DiscoverExternalCompilers is the shared CLI/GUI/API availability contract.
type ExternalCompilerFamily ¶
type ExternalCompilerFamily = backend.ExternalCompilerFamily
const ( ExternalCompilerAuto ExternalCompilerFamily = backend.ExternalCompilerAuto ExternalCompilerGCC ExternalCompilerFamily = backend.ExternalCompilerGCC ExternalCompilerMSVC ExternalCompilerFamily = backend.ExternalCompilerMSVC )
type LLVMCompileOptions ¶
type LLVMCompileOptions = backend.LLVMCompileOptions
type LLVMCompileResult ¶
type LLVMCompileResult = backend.LLVMCompileResult
func CompileLLVM ¶
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 ¶
type LLVMOutputKind = backend.LLVMOutputKind
const ( LLVMIR LLVMOutputKind = backend.LLVMIR LLVMAssembly LLVMOutputKind = backend.LLVMAssembly LLVMObject LLVMOutputKind = backend.LLVMObject LLVMExecutable LLVMOutputKind = backend.LLVMExecutable )
type LLVMProjectResult ¶
type LLVMProjectResult = backend.LLVMProjectResult
func CompileLLVMProject ¶
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 ¶
type LLVMProjectionCell = backend.LLVMProjectionCell
type LLVMProjectionPlan ¶
type LLVMProjectionPlan = backend.LLVMProjectionPlan
func BuildLLVMProjectionPlan ¶
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 ¶
type LLVMTechnicalEvidenceProfile = backend.LLVMTechnicalEvidenceProfile
func LLVMTechnicalEvidence ¶
func LLVMTechnicalEvidence() LLVMTechnicalEvidenceProfile
type Language ¶
type SemanticModuleEmbeddingMode ¶
type SemanticModuleEmbeddingMode = backend.SemanticModuleEmbeddingMode
const ( SemanticModulesNeeded SemanticModuleEmbeddingMode = backend.SemanticModulesNeeded SemanticModulesReference SemanticModuleEmbeddingMode = backend.SemanticModulesReference SemanticModulesAll SemanticModuleEmbeddingMode = backend.SemanticModulesAll )
type SemanticModuleLinkOptions ¶
type SemanticModuleLinkOptions = backend.SemanticModuleLinkOptions
type SemanticProgram ¶
type SemanticProgram = backend.SemanticProgram
func ParseSemanticSE ¶
func ParseSemanticSE(data []byte) (*SemanticProgram, error)
func ParseSemanticSP ¶
func ParseSemanticSP(data []byte) (*SemanticProgram, error)
ParseSemanticSP imports a readable SP document into the canonical program.
func ParseSemanticSPZ ¶
func ParseSemanticSPZ(data []byte) (*SemanticProgram, error)
ParseSemanticSPZ imports the optional compressed SP transport.
type SemanticProject ¶
type SemanticProject = backend.SemanticProject
func LoadSemanticProject ¶
func LoadSemanticProject(dir, entry string) (*SemanticProject, error)
type TranspileRequest ¶
type TranspileRequest = manytomany.TranspileRequest
TranspileRequest and TranspileTrace expose the same immutable diagnostic boundary used by the bundled GUI and CLI.
type TranspileTrace ¶
type TranspileTrace = manytomany.TranspileTrace
func TranspileWithTrace ¶
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.