Project detail

Fortran to C - Scientific Transpiler Engine

Engineered a robust source-to-source compiler from scratch that transforms legacy scientific Fortran code into highly optimized C. Architected a custom LL(1) grammar, an advanced error recovery system, and a memory mapping engine that simulates Fortran's pass-by-reference logic using precise C pointer arithmetic.

System Architecture • Compiler Design • Java & C

Visit Project

The Problem: The "Legacy Code" Bottleneck

Decades of mission-critical scientific, aerospace, and financial algorithms are permanently locked in legacy Fortran codebases. Rewriting these complex mathematical models manually into modern system languages is not only incredibly slow, but risks catastrophic human errors. The challenge was to architect an automated engine that could parse, understand, and safely modernize this logic into C without losing a single drop of mathematical integrity.

The Build: Custom LL(1) Grammar & Lexical Parsing

This isn't a simple text replace script; it’s a full-fledged language processor.

  • Algorithmic Parsing: Designed and implemented a custom LL(1) grammar from the ground up to tokenize and parse complex Fortran control structures, multi-base data translations (Binary/Hex), and deep mathematical abstractions.


  • Resilient Compilation: The engine features an advanced error recovery system. Instead of fatally crashing at the first syntax error, the compiler intelligently catches, logs, and recovers, ensuring the compilation pipeline remains robust.

The Magic: Pointer Arithmetic & Memory Mapping

  • Cross-Language Memory Simulation: Fortran and C handle system memory fundamentally differently. To bridge the gap between Fortran's mathematical abstraction and C's system-level execution, I engineered a memory mapping protocol. The transpiler successfully simulates Fortran's native "pass-by-reference" memory management by automatically generating complex, precise C pointer arithmetic under the hood.

Metallic shape background image

Contact

Let's Get in Touch

Let's connect and start now.

Metallic shape background image

Contact

Let's Get in Touch

Let's connect and start now.

Metallic shape background image

Contact

Let's Get in Touch

Let's connect and start now.

Create a free website with Framer, the website builder loved by startups, designers and agencies.