Skip to content

jworr/happy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

98f25fc · Oct 29, 2022

History

2 Commits
Oct 29, 2022
Oct 29, 2022
Oct 29, 2022
Oct 29, 2022
Oct 29, 2022
Oct 29, 2022

Repository files navigation

Domain Specific Language Example

This is an implementation of a DSL using Happy. The DSL is the arithmetic language used in the Happy tutorial/documentation. This project is an interpreter for the DSL.

Build the interpreter with the following commands:

happy calc.y -o Calc.hs
ghc --make Calc.hs -outputdir=lib

Test the interpreter with this example, put the following text into a example.txt:

let x = 10 in 
let y = 20 in 
x + y

Evaluate the example with command, ./Calc example.txt which will generate the result 30.0.

I wrote the code in Interpret.hs, most of the rest comes from the tutorial.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published