vintage-basic: Interpreter for microcomputer-era BASIC

[ bsd3, compilers-interpreters, program ] [ Propose Tags ]

An interpreter for what is essentially Microsoft BASIC v2, what you might find on a computer in the late 70s or early 80s, such as the Commodore 64.

Rather than making use of traditional stack-based primitives, the implementation uses monad transformers, including one with resumable exceptions that can caught by a program's continuation rather than its context.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0, 1.0.1, 1.0.3
Dependencies array (>=0.1), base (>=4.9 && <5), directory (>=1), filepath (>=1.1), hashable (>=1.2), hashtables (>=1.2), HUnit (>=1.2), mtl (>=1.1), parsec (>=2.1), process (>=1), random (>=1), regex-base (>=0.72), regex-posix (>=0.72), time (>=1.1) [details]
License BSD-3-Clause
Author Lyle Kopnicky
Maintainer lyle@vintage-basic.net
Category Compilers/Interpreters
Home page http://www.vintage-basic.net
Uploaded by LyleKopnicky at 2017-08-02T05:09:34Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables vintbas
Downloads 2894 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2017-08-02 [all 3 reports]

Readme for vintage-basic-1.0.3

[back to package description]
To compile:

cabal configure
cabal build

...or with stack:

stack build

To run unit tests:

cabal test

..or with stack:

stack test

To install:

cabal install

...or with stack:

stack install

You can then run the resulting program as

  vintbas [<.bas source file> ...]

The monad transformer I created is CPST.  Monad
transformers are basically monad building-blocks.  You
start with the identity monad and stack monad
transformers on top of it to build a combined monad.
The ordering is very important.  There are monad
transformers in the Control.Monad.Trans library,
so I used them.  Unfortunately you can't stack any
more monad transformers on top of CPST.  It has to be on
top, because of the type of the shift morphism.  The
standard ContT transformer is similar to my CPST, but
defines callCC, not shift.  Take a look at the type
of callCC in my code.  Notice every time you see a
CPST, it is followed by an o.  Notice that every
other morphism in CPST has the same property, except
shift.  That is the key to why it's no longer stackable -
monad transformers can take only two type parameters, not
three.  But I like shift and think it's neat that I
can define callCC in terms of it and reset, but not
vice-versa.  So there.  Plus, my shift and callCC are
rank-3 polymorphic!  Nobody else achieves that flexibility.

Other things we could do:
* Pre-check types
* Pre-check labels, generate code in place of labels
* Convert variable references to IORefs
  Is it easiest to do these with staging?
* Consider sending errors to stderr.
* On syntax error, consider printing line with marked error.