Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Compiler Assistant

A smart, interactive compiler for a custom programming language — complete with lexing, parsing, evaluation, and AI-powered auto-correction.


Overview

The AI Compiler Assistant is a browser-based development environment that:

  • Lexes, parses and evaluates a custom programming language
  • Provides AI-generated corrections, explanations, and optimizations
  • Shows a beautifully styled Corrected Code Box
  • Lets users auto-replace their code with a single button
  • Includes a full Python backend + CodeMirror editor frontend

Custom Programming Language

Example:

integer a = 10;
a = a + 5;
print(a);

Grammar

  • PROGRAM → STMT_LIST EOF
  • STMT_LIST → (STMT)*
  • STMT → DECL | ASSIGN | PRINT_STMT
  • DECL → "integer" ID "=" EXPR ";"
  • ASSIGN → ID "=" EXPR ";"
  • PRINT_STMT → "print" "(" EXPR ")" ";"
  • EXPR → TERM { ("+" | "-") TERM }
  • TERM → FACTOR { ("*" | "/") FACTOR }
  • FACTOR → NUMBER | STRING | ID | "(" EXPR ")"

Backend Architecture

Backend Architecture (Python)

✔ Lexer – Tokenizes input ✔ Parser – Builds an AST ✔ Evaluator – Executes AST + symbol table ✔ AI Assistant Fallback – On failure, returns:

  • Errors
  • Explanation
  • Fix
  • Optimization
  • Corrected Code

Frontend Features (HTML / JS)

  • CodeMirror editor (Dracula theme)
  • Live output console
  • AI assistant panel
  • Clean corrected-code UI
  • Buttons:
    • Use corrected code → replaces editor
    • Copy code → clipboard support

How to run ?

Extract this repository into your working directory and simply run the compiler_server.py in webpage directory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages