Skip to content

CrossCraft: ARM Edition is a C to ARM cross-compiler that converts C source code into optimized ARM assembly instructions for embedded systems. The project features a modular Python backend for compiling and a React-based frontend for an interactive UI. It supports standard C features, offers an extensive test suite, and integrates with GCC.

Notifications You must be signed in to change notification settings

Ayush-2404/C-to-Arm_Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CrossCraft: ARM Edition

C to ARM Cross Compiler

Introduction

The C to ARM Cross Compiler project is a comprehensive tool designed to compile C source code into ARM assembly instructions. It facilitates efficient development for embedded systems by bridging the gap between high-level C programming and low-level ARM machine code generation. This project leverages Python for backend compiler components and a modern React-based frontend for an interactive user interface.

Project Overview

This cross-compiler translates C code into ARM machine code, enabling developers to build applications optimized for ARM-based embedded devices. Its modular design, user-friendly interface, and comprehensive testing framework make it a robust solution for both learning and real-world applications in embedded system development.

Features

  • Supports standard C language features.
  • Modular backend architecture including lexer, parser, semantic analysis, and code generation.
  • Generates optimized ARM assembly code.
  • Interactive frontend built with React and Tailwind CSS.
  • Command-line API powered by Flask for backend communication.
  • Comprehensive test suite covering lexical, syntactic, and semantic analysis.
  • Sample input programs included for testing and demonstration.

Technologies Used

Python React TypeScript JavaScript
Tailwind CSS GCC Git GitHub
  • Python (compiler logic)
  • Flask (backend API)
  • React and TypeScript (frontend UI)
  • Tailwind CSS (frontend styling)
  • GCC (ARM compiler tools)
  • Git & GitHub (version control)
  • Virtual Environment (dependency isolation)

Project Structure

├── Backend/ # Python backend source code and compiler modules 
│ ├── compiler.py 
│ ├── modules/ 
│ ├── input/ # Sample C input programs 
│ ├── output/ # Generated output files 
│ ├── tests/ # Test cases and expected outputs 
│ └── app.py # Flask app entry point 
├── Frontend/ # React frontend source code 
│ ├── src/ 
│ ├── index.html 
│ └── package.json 
├── .venv/ # Python virtual environment 
├── README.md # Project documentation 
└── ...

Compilation Workflow

  1. Write or use existing C source files from the Backend/input/ directory.
  2. Use the backend compiler modules to tokenize, parse, and perform semantic analysis.
  3. Generate intermediate representation (IR) and convert it to ARM assembly code.
  4. Compile generated assembly using ARM GCC toolchain.
  5. Test generated binaries on ARM hardware or emulators.

How to Run

Clone Repo

  git clone <https://github.com/Ayush-2404/C-to-Arm_Compiler.git>
  cd project-root

Backend

  1. Create and activate the virtual environment:

Create virtual environment

python -m venv .venv

Activate virtual environment

On Linux/Mac:

source .venv/bin/activate

On Windows (Command Prompt):

.venv\Scripts\activate

On Windows (PowerShell):

.venv\Scripts\Activate.ps1
    1. Install required dependencies:
  pip install -r requirements.txt
  1. Run the Flask backend server:
  python app.py

Frontend

  1. Navigate to the Frontend directory:
  cd Frontend
  1. Install frontend dependencies:
  npm install
  1. Start the development server:
  npm run dev
  1. Open the browser and visit http://localhost:3000 to access the UI.

Testing

Tests are available in the Backend/tests/ directory. Run the backend test script to validate functionality:

  python run_tests.py

Acknowledgments

  • GNU Compiler Collection (GCC)
  • React and Tailwind CSS communities
  • Python open source ecosystem

About

CrossCraft: ARM Edition is a C to ARM cross-compiler that converts C source code into optimized ARM assembly instructions for embedded systems. The project features a modular Python backend for compiling and a React-based frontend for an interactive UI. It supports standard C features, offers an extensive test suite, and integrates with GCC.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •