Skip to content

ayush-thakur02/dot-corec

Repository files navigation

Core C Transpiler

Python-like syntax transpiler generating optimized, modular C code.

Quick Start

# Build
make

# Transpile
./core_c examples/fibonacci.corc

# Compile & run
gcc -o prog output/fibonacci.c output/main.c && ./prog

Documentation

  • LANGUAGE_REFERENCE.md - Syntax and examples
  • ARCHITECTURE.md - Technical implementation
  • MVP_FINAL_REPORT.md - Project status

Build Options

make                                    # Linux/macOS
gcc -o core_c src/*.c                  # Manual build

CLI Options

./core_c file.corc                     # Basic transpilation
./core_c file.corc -o dir/             # Custom output
./core_c file.corc -v                  # Verbose (show AST)

Examples

See examples/ directory for sample .corc files:

  • fibonacci.corc - Recursive algorithms
  • calculator.corc - Function composition
  • control_flow.corc - Conditional logic
  • gcd.corc - Iterative algorithms

Testing

python tests/run_tests.py              # Run all tests
./test.sh                              # Linux/macOS wrapper
test.bat                               # Windows wrapper

Current Status

Supported: Functions, if/else, while loops, expressions, print statements, recursion Limitations: Integer types only, no arrays, no for loops, basic error handling

See LANGUAGE_REFERENCE.md for complete syntax documentation.

  • Module system with imports
  • Standard library functions

Phase 3

  • Memory management helpers
  • Code optimization passes
  • IDE integration
  • Debugging support

🏗️ Architecture

The transpiler follows a clean 4-stage pipeline:

  1. Lexer - Tokenizes source code
  2. Parser - Builds Abstract Syntax Tree
  3. Code Generator - Produces modular C code
  4. Output - Three separate files for clean organization

See ARCHITECTURE.md for detailed technical information.

📖 Documentation

  • LANGUAGE_REFERENCE.md - Complete language syntax and features
  • ARCHITECTURE.md - Technical design and implementation details
  • examples/ - Working code samples
  • Inline code comments for implementation details

🤝 Contributing

This MVP demonstrates the core concept. Future contributions could include:

  • Additional language features
  • Optimization improvements
  • Better error handling
  • IDE/editor integration
  • Performance benchmarks

📄 License

MIT License - Feel free to use, modify, and distribute.


Core C MVP - Bringing Python's expressiveness to C's performance through intelligent transpilation.

About

Python-like syntax transpiler generating optimized, modular C code.

Topics

Resources

License

Stars

Watchers

Forks

Contributors