Skip to content

xieyuheng/study

Repository files navigation

Study

Study of language design and implementation.

The aim of this repository is to quickly make prototypes for language design ideas.

This repository contains a series of language implementations,
and some general supporting libraries (such as parsing and command line interface).

Remember,
an engineer solve problem,
an engineer does not want just a religion about how to solve a problem.
-- Gerry Sussman

Study of parsing techniques

  • partech
    A parser generator, with various parsing techniques.
    • Earley parser
      Its time complexity is O(n^3) in general for context free grammar.

Study of scope

Study of assignment

  • eopl/lang_explicit_refs
    • Explicit reference (address)
  • eopl/lang_implicit_refs
    • We need to distinguish denoted value from expressed value for mutable variable.
      This is also called call-by-value parameter passing.
  • eopl/lang_mutable_pairs
    • Lisp's cons, car and cdr, with set-car! and set-cdr!
  • eopl/lang_call_by_reference
    • Marking an variable ref when passing it to a function,
      will not create new ref and reuse the ref of the variable,
      thus make callee be able to set caller's variable.
  • eopl/lang_call_by_need
    • When an expression occurs as argument of an application,
      do not eval it, but make it into a thunk.
      and only eval it when needed (during variable lookup).
    • This is also called lazy-eval.

Study of lambda calculus with types

Study of type checking

Study of type inference

Study of normalization by evaluation (a.k.a. nbe)

  • nbe/lambda
    • The untyped lambda calculus.
  • nbe/syst
    • Kurt Gödel's system T.
    • Simply typed lambda calculus with natural number.
  • nbe/tartlet
    • "Checking Dependent Types with Normalization by Evaluation: A Tutorial",
      by David Thrane Christiansen (the original tutorial).
    • Since tartlet is little pie, recursion is also not an option here.
  • nbe/minitt
    • "A simple type-theoretic language: Mini-TT",
      by Thierry Coquand, Yoshiki Kinoshita, Bengt Nordström, Makoto Takeyama.
    • No termination check, thus when viewed as logic it is unsound.

Study of function composition and stack machine

References

  • "Parsing Techniques -- A Practical Guide"
    • by Dick Grune and Ceriel J.H. Jacobs.
  • "Essentials of Programming Languages" (a.k.a. EOPL)
    • by Daniel P. Friedman and Mitchell Wand.
  • "Lambda Calculus with Types"
    • by Henk Barendregt, Wil Dekkers and Richard Statman. 2010.
  • "Do-it-yourself Type Theory"
    • by Roland Backhouse, Paul Chisholm, Erik Saaman and Grant Malcolm, 1988.
  • "Computation and Reasoning -- A Type Theory for Computer Science"
    • by Zhaohui Luo, 1994.

Usage

  • Build: sbt stage
    • Then you can find executable files in ./target/universal/stage/bin/
  • Test: ./dev t
  • Example code at: example

Community

Contributions are welcome, see current TODO list for tasks.
(Please add yourself to the AUTHORS list if you made any contributions.)

License

About

Study of language design and implementation.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published