How joaomofrancisco/thrift-java-compiler works
Project type and purpose
• This is an open-source compiler toolchain for Apache Thrift IDL written in Java. It has two main Maven modules:
• thrift-java-compiler-idl-parser: parses .thrift files into an in-memory AST/model
• thrift-java-compiler-codegenerator: takes that AST and emits Java (and Swift) source
• Its purpose is to let you feed it Thrift definitions and get out generated client/server code.
File structure
• Top level: a multi-module Maven project (pom.xml, two submodule directories).
• thrift-java-compiler-idl-parser:
• ANTLR3 grammar under src/main/antlr3
• Parser entry point ThriftIdlParser
• com.facebook.swift.parser.model package with AST node classes
• Visitor framework to walk/transform the AST
• thrift-java-compiler-codegenerator:
• Generator entry points (SwiftGenerator, ConstantRenderer, ServiceCodeGenerator, etc.)
• A registry (TypeRegistry, TypedefRegistry) holding AST→Java‐type mappings
• Packages for codegenerator implementations, visitor templates, utility classes
• Both modules have test resources (sample .thrift files) and JUnit/TestNG test suites.
• Build: Maven, ANTLR plugin generating lexer/parser code, standard compiler and surefire plugins.
Key insights from README
• The README appears to be an unrelated API doc template. For architecture, focus on code structure:
• Thrift grammar → parser → AST
• AST → generator → code files