priime0 / logic-plus

Small extensions for `#lang isl-spec` and `#lang lsl`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logic-plus

A collection of packages that build on #lang isl-spec and #lang lsl, enabling them to interface with ob-racket in Emacs. These packages relate to Northeastern’s CS 2800 - Logic and Computation course.

Note: These hashlangs should not be used in substitution of #lang isl-spec and #lang lsl for any proper assignments.

Attribution: this builds on top of isl-spec and lsl, lifting some existing code to accomodate certain hacks.

Installation

Since I doubt a lack of interaction with these packages (Emacs and Org users are few at Northeastern), there’s currently no incentive for me to put these on the Racket package server. Instead, readers can install the packages manually:

Clone the repository and raco pkg install in each package directory:

git clone https://github.com/priime0/logic-plus
cd isl-spec-plus && raco pkg install --auto --skip-installed
cd ../lsl-plus && raco pkg install --auto --skip-installed

Modifications

  • define in #lang isl-spec is only permitted at the top-level. Since ob-racket places the contents of a code-block in a let expression, this will error. Instead of providing #lang isl-spec’s define, this package provides #lang racket’s define since it can be used anywhere.
  • let in #lang isl-spec further only allows a single expression in its body. This is problematic if we want multiple forms, such as multiple define forms. This package again provides #lang racket’s define to compensate.
  • the check-property macro in #lang isl-spec is also only permitted in the top-level. I copy the code from its main module, removing the top-level check, and re-provide it in lieu of isl-spec’s check-property.
  • ob-racket uses write as the last form to display the last expression in the result of evaluating a code-block. write isn’t provided in #lang isl-spec. Since it isn’t provided in #lang isl-spec (and so shouldn’t be used in the code-block), and it’s the last form in ob-racket, I made an interesting hack:
    • The test-engine tests don’t run the tests by default in a code-block. write acts as the conclusion of a program, so #lang isl-spec-plus rewrites write to use #lang racket’s write and output the last expression. After writing the last expression, it then runs the tests, printing any failed checks (and nothing otherwise).

About

Small extensions for `#lang isl-spec` and `#lang lsl`


Languages

Language:Racket 100.0%