GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - EngineGames-Development/Engine-s-Compiler

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Engine's Compiler

A small, scratch-built compiler written in Rust.

The project implements a simple compiler pipeline that takes arithmetic expressions as input, parses them into an Abstract Syntax Tree (AST), and generates x86-64 assembly code for Windows.

The project is primarily a learning and experimentation project focused on understanding how compilers work at a low level.

Compiler Pipeline

Source Expression
       │
       ▼
    Lexer
       │
       ▼
    Tokens
       │
       ▼
    Parser
       │
       ▼
      AST
       │
       ▼
Code Generator
       │
       ▼
x86-64 Assembly
       │
       ▼
    Executable

Current Features

  • Lexical analysis
  • Parsing arithmetic expressions
  • Abstract Syntax Tree (AST)
  • Integer literals
  • Addition (+)
  • Subtraction (-)
  • x86-64 assembly generation
  • Intel assembly syntax
  • Basic register and stack usage
  • Windows/MinGW executable generation

Example

The compiler can process arithmetic expressions such as:

10 + 5 - 3

and generate x86-64 assembly representing the calculation.

The resulting value is returned through the rax register.

Project Structure

src/
├── lexer.rs       # Converts source text into tokens
├── parser.rs      # Builds the AST from tokens
├── ast.rs         # AST data structures
├── assembly.rs    # Generates x86-64 assembly
└── main.rs        # Compiler entry point

Building

Make sure you have Rust and Cargo installed.

Clone the repository:

git clone https://github.com/EngineGames-Development/Engine-s-Compiler.git
cd Engine-s-Compiler

Build and run the compiler:

cargo run

This generates the assembly output.

Assembling and Linking

The generated assembly can be assembled and linked using MinGW/GCC:

gcc -nostdlib -e _main program.s -o program.exe

Run the resulting executable:

./program.exe

On Windows PowerShell, the result can be inspected using:

$LastExitCode

Goals

This project is being developed as a way to explore compiler construction and low-level programming.

Future goals include:

  • Multiplication and division
  • Operator precedence
  • Parentheses
  • Unary operators
  • Variables
  • Conditional expressions
  • Functions
  • Improved error reporting
  • More complete x86-64 code generation

Status

This compiler is an experimental learning project and is still under development.

The current implementation is intentionally small and focuses on understanding the individual stages of a compiler rather than providing a production-ready programming language.

License

See the repository for license information.

About

No description, website, or topics provided.

Resources

Readme
MIT license
Activity

Stars

3 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.