Git Product home page Git Product logo

scratch-clone's Introduction

A neat and tidy scratch-like interpreter in Haskell!

Disclaimer - Plagiarism notice

This is a note from the module organiser on CS141 Functional Programming: Module organisers regularly scan GitHub for commonalities between submitted assignments and publicly available code. You are reminded to follow the plagiarism policy included with CS141 coursework specifications and the University Regulation 11 (Academic Integrity). DO NOT replicate any portion of this repository, including pieces of code, in your own submitted work. DO NOT use GitHub Copilot or similar software to write chunks of your code, as it may reproduce this work without your knowing. And please cite any resources or information you have found helpful during the creation of your own work, which may include this repository. 🙂

Hello! This is my functional programming coursework, written in lovely Haskell.

The coursework itself can be found in the scratch-clone directory.

./side-effect-demo-calculator.png ./side-effect-demo-calculator-output.png

You can try this locally using (once the io-extension directory project has been started with stack run):

./side-effect-demo-guide.png

My two extensions to this coursework: subroutines and side effects.

My extension to this coursework (as well as implementing functions…) was to rewrite the (originally pure) interpreter to handle side effects in the program. The example used here is console IO, but could now take any other form!

Where’s the code? Main files of interest

You likely care about the interpreter itself the most.

The data types representing the language are in: scratch-clone/src/Language.hs

The interpreter is implemented in: scratch-clone/src/Interpreter.hs

Then, for the more advanced IO/side effects extension, you care about:

The updated language description, now including ‘built-in statements’ or BuiltinStmt: io-extension/src/Language.hs

The much-updated interpreter, re-written with more monads handling side effects inside the code: io-extension/src/Interpreter.hs

Build & run instructions

Enter the project you want to build. Likely, this is the scratch-clone directory.

The project is built and ran using stack. Please install stack!

Then, you should be able to simply:

stack build

You may run into errors. If so, run the following:

stack clean --full
stack update
stack upgrade

And retry the build.

Once done, you’re now free to run the server with:

stack run

scratch-clone's People

Contributors

akiss-xyz avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.