Skip to content

Johnicholas/goobergram

 
 

Repository files navigation

I wanted to play with Mark Jason Dominus's marvelous linogram program
from his book _Higher-Order Perl_:
http://hop.perl.plover.com/linogram/

But as a Perl tyro I'd rather read it in Python. Since I didn't feel
like translating the linogram parser and interpreter, here's an
attempt to provide the core features of constraints, expressions, and
compound objects as Python objects you can use directly.

(The name was picked at random -- since this isn't exactly MJD's
program. Might be better renamed descriptively like py_linogram_core,
supposing it works out.)


## Update

There's now a parser and interpreter for Linogram source files
(minilinogram.py). It's incomplete:

  * In one of the first test cases one of the variables did not get
    pinned down that should've been. (I'm guessing this is from
    making decisions from floating-point equality; they should
    probably be approximate comparisons. Does Linogram have to
    deal with this too?)

  * Expect other bugs.

  * Tuple arithmetic like `figure + (2,3)` works only for points;
    I haven't implemented the auto-mapping over all fields in
    `figure` that end with `.x` or `.y`.

  * I haven't made up a mechanism to replace the Perl-code drawables.

  * The full Linogram does more; I aimed to redo just the book
    version.

The grammar is derived from Dominus's. It uses
https://github.com/darius/parson

linear_equations.py also closely follows the Linogram code.

About

A Python rewrite of Mark Jason Dominus's linogram language. Unfinished.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%