mal-crystal

Version, currently main branch1 version
  • main branchlatestDec 26, 2020

github.com/stereobooster/crystal-lisp

No description declared in shard.yml.

4 stars
0 dependents
License: not declared

Installation

# Add this to your shard.yml
dependencies:
  mal-crystal:
    github: stereobooster/crystal-lisp
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
no constraint declared

Dependencies

Runtime Dependencies

  • arborist*github: davidkellis/arborist
  • readline*github: crystal-lang/crystal-readline

README

MAL in Crystal

Forked from https://github.com/kanaka/mal/tree/master/impls/crystal

Why Crystal?

My previous experiment was to build MAL in Pony. Pony is a nice language, but its type system is a bit "rigid", which slows down me. I want to experiment and iterate fast.

I want a compiled fast language, but not C. My options are:

  • Go - I don't want to deal with the absence of generics
  • Rust - I don't want to deal with the borrow checker
  • Chez Scheme or sbcl or clasp - may be, but there is no static type checker?
  • Zig
  • Crystal

I decided to go with Crystal because it is a bit more flexible than Zig. Also, I heard that they want to rewrite the Ponylang compiler from C to Crystal, so I was curious.

Ideas

Ideas I want to explore:

  1. Write reader with new Pytonish syntax, which would compile input to the SExpressions, that MAL's eval expect
  2. ...

About Lisp syntax

There were a million attempts to create an alternative to SExpressions. See:

Parsers

Crystal libs

Lisp, Sheme, Clojure BNF/EBNF

Grammars

Brainstorming

  • operator precedence rules is hard to remeber. Pony doesn't have it
  • punctuation-signs as operators are hard to search
  • I don't think that prefix notation is a problem, almost all functions except math operators and special operators like in Haskell use it. See: operators
  • In Scheme it is possible to use [] and {} in addition to (), which makes it more readable
  • In Clojure [] denotes a vector (doesn't evaluate like application), {} denotes a hashmap, :... denotes a keyword (doesn't evaluate like a variable, more like Ruby's symbol)