/functional-compiler

A pseudocode compiler and interpreter using haskell, alex and happy

Primary LanguageHaskellOtherNOASSERTION

functional-compiler

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

How to compile the project?

  1. First, install Stack
  2. Then, clone this repository
  • git clone https://github.com/JCepedaVillamayor/funcional-compiler.git
  1. Go to the project folder and build the project
  • cd <project-path>
  • stack build

What tools have been used?

  • 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

Which language do we want to describe?

The BNF syntax for the grammar can be found here

¿How to run the code?

Once the project is built, you need to execute the following command:

  • stack exec functional-compiler-exe