Skip to content

2 front end english syntax analysis

TransCompilator edited this page Nov 26, 2026 · 1 revision

2 Front End: English Syntax Analysis

Source: https://deepwiki.com/PonvasanthPon/TransCompilator/2-front-end-english-syntax-analysis

Front End: English Syntax Analysis

Relevant source files

The following files were used as context for generating this wiki page:

Purpose and Scope

The front end of TransCompilator (tc-syntax) is responsible for ingesting raw English-source files (.tc), breaking them down into structural blocks, sentences, and lexical tokens, and analyzing their syntactic structure via a vendored dependency parser crates/tc-syntax/src/lib.rs:1-9. This page provides a high-level overview of the syntax analysis pipeline.

For detailed technical breakdowns, refer to the child pages:

Sources: crates/tc-syntax/src/lib.rs:1-9


2.1. Segmentation and Tokenization

The syntax front end begins by dividing raw source files into structured representations. A SourceFile is processed into paragraph blocks, indented code blocks, and leaf sentences using segment_source and helper utilities defined in crates/tc-syntax/src/segment.rs crates/tc-syntax/src/segment.rs:1-43.

The tokenizer preserves decimals, quoted strings, negative numbers, and indentation structures while producing atomic tokens (TokenKind::Word, TokenKind::Symbol, etc.) crates/tc-syntax/src/segment.rs:3-6. These token models and lexical text helpers are shared downstream with tc-semantics via text utility modules crates/tc-semantics/src/textutil.rs:1-14.

For details, see Segmentation and Tokenization.

graph TD
    SourceFile["SourceFile (crates/tc-syntax/src/segment.rs)"] --> RawDocument["RawDocument (crates/tc-syntax/src/segment.rs)"]
    RawDocument --> RawBlock["RawBlock (crates/tc-syntax/src/segment.rs)"]
    RawBlock --> RawSentence["RawSentence (crates/tc-syntax/src/segment.rs)"]
    RawSentence --> Tokenize["tokenize() (crates/tc-syntax/src/token.rs)"]
    Tokenize --> TextUtils["textutil helpers (crates/tc-semantics/src/textutil.rs)"]
Loading

Figure 1: Natural language segmentation pipeline mapping source inputs to structural blocks and semantic text utilities.

Sources: crates/tc-syntax/src/segment.rs:1-43, crates/tc-semantics/src/textutil.rs:1-14


2.2. Link Grammar Integration and Clause Trees

Once sentences are segmented and tokenized, they are passed to the syntactic parser. TransCompilator vendors CMU Link Grammar 5.13.2 and integrates it via Foreign Function Interface (FFI) bindings crates/tc-syntax/src/lib.rs:6-8.

The tc-syntax crate normalizes the raw linkage results into a finite, deterministic set of clause roles, constructing ClauseTree structures that represent active, passive, and imperative constructions crates/tc-syntax/src/lib.rs:6-8. These trees abstract away complex dependency graphs into simplified verb heads and prepositional phrases required by the semantic intent gate crates/tc-syntax/src/lib.rs:10-21.

For details, see Link Grammar Integration and Clause Trees.

graph TD
    RawSentence["RawSentence (crates/tc-syntax/src/segment.rs)"] --> LgParser["LinkGrammarParser (crates/tc-syntax/src/lg_ffi.rs)"]
    LgParser --> LgParse["LgParse (crates/tc-syntax/src/lg_ffi.rs)"]
    LgParse --> AnalyzeClause["analyze_clause() (crates/tc-syntax/src/clause.rs)"]
    AnalyzeClause --> ClauseTree["ClauseTree (crates/tc-syntax/src/clause.rs)"]
    ClauseTree --> SemanticAnalysis["Semantic Front End (tc-semantics)"]
Loading

Figure 2: Syntactic analysis pipeline bridging raw sentences to normalized clause trees.

Sources: crates/tc-syntax/src/lib.rs:6-21, crates/tc-syntax/src/segment.rs:1-23


Clone this wiki locally