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?
- Host: GitHub
- URL: https://github.com/dracuxan/compiler
- Owner: dracuxan
- License: bsd-3-clause
- Created: 2024-09-28T04:35:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-08T12:01:29.000Z (over 1 year ago)
- Last Synced: 2025-01-04T04:37:23.897Z (over 1 year ago)
- Topics: compile, compiler-design, cpp, go, golang, hacktoberfest, python, python3
- Language: Python
- Homepage: https://compiler.bynisarg.in/
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.