An open API service indexing awesome lists of open source software.

https://github.com/dracuxan/compiler

Used Python, JS, Go to show a compiler implementation. I mean why not?
https://github.com/dracuxan/compiler

compile compiler-design cpp go golang hacktoberfest python python3

Last synced: 2 months ago
JSON representation

Used Python, JS, Go to show a compiler implementation. I mean why not?

Awesome Lists containing this project

README

          

# Multi-Language Compiler Project
This repository contains a compiler project implemented using multiple programming languages, primarily Go and Python. The project demonstrates various stages of compilation, including lexical analysis, semantic analysis, and intermediate code generation.

## Key Components:
- Lexical Analyzer (Go):
- Located in runner/src/go_lexer/main.go
- Tokenizes input code from sample.txt
- Generates a tokens.txt file with identified tokens

- Semantic Analyzer (Python):
- Found in runner/src/python_parser/semantic_analyzer.py
- Performs semantic analysis on the tokens generated by the lexer
- Checks for variable declarations and basic type checking

- Three-Address Code (3AC) Generator (Python):
- Implemented in runner/src/3ac/3ac.py
- Converts input expressions to Three-Address Code
- Generates quadruples, triples, and indirect triples

- Backend API (Go):
- Main file: runner/main.go
- Provides RESTful endpoints to trigger lexical analysis, semantic analysis, and 3AC generation
- Handles file uploads for input code

- Frontend (HTML/CSS/JavaScript)
- Located in the website directory
- Offers a user-friendly interface to interact with the compiler
- Allows file uploads and displays compiler outputs
- Docker Integration:
- Includes Dockerfiles for both backend and frontend
- Docker Compose file for easy deployment and containerization

## Features:
- Multi-stage compilation process
- Web-based interface for easy interaction
- File upload capability for custom input code
- Dockerized setup for consistent deployment across environments
- Modular design allowing for easy extensions and modifications

## Technology Stack:
- Go (Lexer and Backend API)
- Python (Semantic Analyzer and 3AC Generator)
- HTML/CSS/JavaScript (Frontend)
- Docker (Containerization)
- Fiber (Go web framework)

### This project serves as an excellent educational tool for understanding compiler design and implementation across different programming languages. It demonstrates the integration of various compiler components and provides a practical example of full-stack development in the context of compiler construction.