Home
Welcome to GLaDOS!
Last updated
Was this helpful?
Welcome to GLaDOS!
Last updated
Was this helpful?
GLaDOS is a programming language project developed as part of the B5 - Advanced Functional Programming course (B-FUN-500). It's designed to be a minimalist Lisp interpreter initially but can be extended into a more advanced language with a custom syntax, evaluation, and compilation.
Welcome to GLaDOS! This project is an exploration of programming language development in Haskell. The goal is to create a functional language with a Lisp-like core and expand it into a more feature-rich language.
Our language is called GoMelan, it is a typed language similar to Rust. With the latter it is possible to carry out complex scripts using functions, recursion, loops, internal functions, advanced types, functions prototype, include other file. All this with quick-to-understand syntax by using Syntactic sugar.
Part 0: The Enrichment Testing Center: In this mandatory part, we focus on building a robust foundation for the project. This includes setting up a build system, creating unit and integration tests, and implementing a continuous integration and continuous delivery (CI/CD) pipeline.
Part 1: Lots of Irritating Superfluous Parentheses (LISP): In this phase, we start by implementing a minimalist Lisp interpreter. It includes handling symbolic expressions, defining functions (including lambdas), conditional expressions, and built-in functions.
Part 2: Embrace and Extend: In the final part, we aim to enhance our language. This involves defining a custom syntax, implementing a virtual machine (VM), and creating a compiler for efficient code execution. Additional features, like data types, side effects, type inference, and metaprogramming, can be added for bonus points.
To get started with GLaDOS, follow these steps:
Clone the repository:
Build the project using your preferred build system (e.g., Stack):
Run the GLaDOS interpreter/compiler:
Compile a GoMelan script into a binary
Then execute the binary
You also can run some unit tests by using the following command
Run the tests
Here are some examples of our language reproduicing factorial functions (using recursive):
Output: 120
Our langauge can also use some internal functions like len
for get a size of a List or conversion functions: Here we can use the len
function to read the List and then sum it, we also use prototype to get the function.
Output: 10
You can find more of thoses examples by execute them in the examples/
folder.
Here are some example usages of the first GLaDOS step (work with GLaDOS LISP release):
For more examples, check the project's examples directory.
The project structure is organized as follows:
app/
: Contains the main function for the project.
src/
: Contains the source code for the GLaDOS interpreter and compiler.
test/
: Holds unit and integration tests for the project.
examples/
: Contains a list of GoMelan code examples
In this project, GitHub Actions will run the following checks:
On push on any branch
Build: The project will be built using Stack.
Tests: The project's unit and integration tests will be run.
On push on main OR merge to main
Build: The project will be built using Stack.
Tests: The project's unit and integration tests will be run.
Release: A new release will be created and published as draft on GitHub.
Binary: The project's binary will be built and published as an asset on the release.
Pre-commit hooks are automated scripts that run before each Git commit, ensuring code quality and adherence to coding standards. Follow this guide to set up and use pre-commit hooks in this project.
Prerequisites
Before you begin, make sure you have the following installed:
Git: Pre-commit hooks are Git hooks, so you need Git installed on your system.
Getting Started
Install Pre-Commit:
Install the pre-commit tool if you haven't already. Pre-commit is a Python package:
Initialize Pre-Commit:
Run the following command in the project's root directory to initialize pre-commit:
This command sets up the hooks defined in the .pre-commit-config.yaml
file.
Using Pre-Commit Hooks
Pre-commit hooks will automatically run before each Git commit. Here's how they work:
When you run git commit
, pre-commit will execute the configured hooks one by one.
If a hook fails (for example, if a test fails or coding standards are not met), the commit will be blocked, and you'll see an error message.
You can fix the issues reported by the hooks and try the commit again.
Updating Pre-Commit Hooks
If the .pre-commit-config.yaml
file is updated with new hooks or changes, contributors should run the following command to update their pre-commit hooks:
This command updates the pre-commit configuration to match the latest version defined in the repository.
Customizing Hooks (Optional)
If you need to customize the behavior of a specific hook, you can do so by modifying the .pre-commit-config.yaml
file. Refer to the project documentation or README for specific customization instructions.
This project is licensed under the MIT License - see the LICENSE file for details.