This repository is one case study in the subject "Programación declarativa" taught at UCLM
The objectives of the case study are:
- Write an interpreter
- Use Haskell to write the interpreter
- First, install Stack
- Then, clone this repository
git clone https://github.com/JCepedaVillamayor/funcional-compiler.git
- Go to the project folder and build the project
cd <project-path>
stack build
- The lexer has been implemented using Alex, which is a tool for generating lexical analyzers in Haskell. This tool is similar to the tool Flex and Jflex. A tutorial showing how to use alex can be found here
- The syntax parser has benn implemented using Happy. Happy is a parser generator system: it takes a file containing a BNF specification and produces a Haskell containing a parser for the grammar. A tutorial showing how to use Happy can be found here
The BNF syntax for the grammar can be found here
Once the project is built, you need to execute the following command:
stack exec functional-compiler-exe