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 - Other-Project/SI3-Compiler: Custom language to ARMv7 assembly code compiler

This repository was archived by the owner on Jun 15, 2024. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

124 Commits
124 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.vscode
.vscode
 
 
bad_input
bad_input
 
 
good_input
good_input
 
 
input
input
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
analyse_lexicale.py
analyse_lexicale.py
 
 
analyse_syntaxique.py
analyse_syntaxique.py
 
 
arbre_abstrait.py
arbre_abstrait.py
 
 
generation_code.py
generation_code.py
 
 
juge.py
juge.py
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 
table_des_symboles.py
table_des_symboles.py
 
 

Repository files navigation

Flo compiler

Project realized by Théo Delias, Alban Falcoz, Evan Galli and Théo Lassauniere
as part of the Languages, Compilation, Automata course.

The project

The aim of this project is to compile FLO code (detailed below) into ARMv7 assembly code.

The structure

  • Lexical analysis: breaks down the code into lexemes
  • Syntax analysis: generates an abstract tree of the code
  • Code generation: transforms the abstract tree into the corresponding assembly code

The FLO langage

The Flo programming language is a statically typed imperative language designed by Florian Bridoux.

Data types:

  • entier (integer)
  • booleen (boolean)

Operators:

  • Algebraic: +, -, *, /, %
  • Comparison: ==, !=, <, >, <=, >=
  • Logical: et (and), ou (or), non (not)

Built-in functions:

  • vide ecrire(entier|booleen valeur) (write)
  • entier lire() (read)

Functions:

  • Functions always return a value: no void (vide) except for the built-in function ecrire

Control flow:

  • si (if), sinon si (else if), sinon (else)
  • tantque (while)

Limitations

  • There is no check for the presence of a return in the functions. This is a bit complex to do, as it requires to check that there is a return in all cases. Simply checking that the last instruction in the function is a return is not enough.
  • It would have been interesting to add an optimisation phase at the end. This would have eliminated, for example, pushes followed immediately by pops, variables declared but not used (or only used in one direction), and useless operations such as +0, -0, *1 or /1.
  • Read, write, divide and modulo are implemented via the libc functions, it would have been better to program them directly in asm.

Usage

usage: generation_code.py [-h] [-o OUTPUT] [-arm] [-t] [--builtins] filename

Generate assembly code from flo script

positional arguments:
  filename

options:
  -h, --help                  Show this help message and exit
  -o OUTPUT, --output OUTPUT  Destination file
  -arm, --arm                 Generate ARM assembly
  -t, -table, --table         Display the symbol table
  --builtins                  Display builtins in the symbol table

About

Custom language to ARMv7 assembly code compiler

Resources

Readme
Activity
Custom properties

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — 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.