tiny-lang is a simple programming language developed as a part of a college project for the subject Compiler Theory. It includes the implementation of the lexical and syntax analysis phases of a compiler. The purpose of this project is to demonstrate how a compiler can take a stream of characters and convert it into a sequence of tokens, which can then be analyzed by the syntax analyzer to determine whether the input is a valid program.
The tiny-lang interpreter supports the following features:
- Lexical analysis of input stream to generate tokens
- Syntax analysis of tokens to determine the validity of the input
- Error handling for invalid input
- Output of the input program's abstract syntax tree (AST)
To install the tiny-lang interpreter locally, follow these steps:
- Clone the repository:
git clone https://github.com/Omar-Yasser/tiny-lang.git
- Open the solution file
tiny-lang.sln
using Visual Studio or a similar C# IDE. - Build the solution by clicking on the Build option from the menu.
- Run the interpreter by setting the input file path and clicking on the Run button.
Note: Please ensure that you have Visual Studio or a similar C# IDE installed on your system in order to build the solution.
To run a tiny-lang program, create a file with the .tiny
extension and include your code. For example:
// example tiny
int main() {
int x = 5;
if (x > 3) {
Console.WriteLine("Hello, World!");
}
return 0;
}
To execute the program, set the input file path in the Program.cs
file and run the project.