/tiny-language-compiler

This is an implementation for CSE439s Design of Compilers course project

Primary LanguageCMIT LicenseMIT

tiny-language-compiler

This is a Qt project that demonstrates the integration of Python with the Qt framework.

untitled txt - Tiny Language Compiler 13_02_2023 08_07_25 PM

Objective

To create a Qt GUI application that demonstrates how to scan and parse tiny language source files using recursive decent parsing method and then generate a parse tree for the syntax.

Prerequisites

Before building and running this project, you will need to have the following installed on your system:

  • Qt 7.0.0
  • Python 3.11
  • PyQt6 (the Python bindings for Qt)
  • PySide6
  • Qt Creator (optional but recommended for development)

Features

  • Scan tiny language source files for different types of tokens here's a list:
Token Type Value
SEMICOLON ;
IF if
THEN then
END end
REPEAT repeat
UNTIL until
IDENTIFIER x, abc, xyz
ASSIGN :=
READ read
WRITE write
LESSTHAN <
EQUAL =
PLUS +
MINUS -
MULT *
DIV /
OPENBRACKET (
CLOSEDBRACKET (
NUMBER 12, 289
  • Parse different kinds of tokens and create the parse tree here's an example for a tiny language source file with its parse/syntax tree:
{sample program in TINY language- computes factorial}
read x; { input an integer }
if 0<x then { don’t compute if x<=0 }
  fact:=1;
  repeat
    fact := fact*x;
    x := x-1
  until x=0;
  write fact{output factorial of x}
end

output

Building the project

Here are the steps to build and run the project (for Windows only, we didn't run the project on any other platform):

Last modification date: 2023 - 02 - 22 03:35 PM
  1. Download Qt Creator or VSCode or any IDE you see fit
  2. Install python
https://www.python.org/downloads/
  1. Add scripts directory to your path (if it doesn't) (this includes pip clang-format etc...). Example path:
C:\Users\${YOUR_USERNAME}\AppData\Local\Programs\Python\Python311\Scripts
  1. Install PySide6
pip install pyside6
  1. Change the Python interpreter to point to the right one (qt creator, vscode, ...). Example:
C:\Users\${YOUR_USERNAME}\AppData\Local\Programs\Python\Python311\python.exe
  1. Clone the repository
git clone https://github.com/saifkandil/tiny-language-compiler.git
  1. Change into the project directory
cd tiny-language-compiler
  1. Run the project
py tiny-language-compiler

Contributing

We welcome contributions from the community. If you would like to contribute to this project, please follow these guidelines:

Pull Request Process

  1. Fork this repository.
  2. Create a new branch with a descriptive name for your feature or bug fix.
  3. Make your changes and ensure that your code follows the project's coding style and conventions.
  4. Document your changes briefly.
  5. Commit your changes and provide a clear and concise commit message.
  6. Push your changes to your forked repository.
  7. Open a Pull Request against this repository's master branch.

Questions and Feedback

If you have questions or need further assistance, please open an issue or join our community discussion in the Discussions section.

Thank you for your contribution!

Acknowledgements

We would like to extend our gratitude to the Qt and Python communities for their support and for providing such powerful tools for developing GUI applications. We would also like to acknowledge the open-source projects and libraries that were used in the development of this project.

About US

We are a group of four students currently enrolled at Ain Shams University, Faculty of Engineering, who share a passion for solving complex problems and creating innovative solutions. Our team consists of four Computer & Systems Engineering majors, providing a unique blend of skills and perspectives.

At the heart of our team is a shared commitment to hard work, collaboration, and making a difference. Whether we're working on a school project or a startup, we approach every challenge with enthusiasm, creativity, and a drive to succeed.

We are excited to see what the future holds and are committed to making the most of every opportunity that comes our way.

  • Usama Ahmed Kawashty Abdelraheem 18Q9484
  • Saif Salah Eldeen Yahya Mostafa 1901529
  • Hussein Ahmed Hussein Adbelgalil 18Q4984
  • Yousef Mohamed Elsharkawy 18Q4486