Go to file
2021-10-18 22:32:08 -07:00
maaru Grand culling 2019-03-14 00:51:33 -07:00
robo Grand culling 2019-03-14 00:51:33 -07:00
rukka Grand culling 2019-03-14 00:51:33 -07:00
schala-lang Reduce number of tables in symbol table 2021-10-18 22:32:08 -07:00
schala-repl Parameterize compiler Config type 2021-10-14 02:24:42 -07:00
source_files Some updates to Schala source files 2018-08-20 19:03:55 -07:00
src Parameterize compiler Config type 2021-10-14 02:24:42 -07:00
static Switch from request to superagent 2018-07-26 00:52:45 -07:00
.gitignore Cargo.lock should be version-controlled 2019-09-25 01:54:14 -07:00
Cargo.lock Use TryFrom<&str> for Tokens 2021-10-14 02:47:19 -07:00
Cargo.toml Refactor main.rs 2021-10-07 02:10:27 -07:00
HindleyMilner.hs Consult these haskell programs from https://github.com/quchen/articles/tree/master/hindley-milner 2018-07-26 00:52:46 -07:00
Main.hs Consult these haskell programs from https://github.com/quchen/articles/tree/master/hindley-milner 2018-07-26 00:52:46 -07:00
README.md Add reference work 2019-06-16 00:22:18 -07:00
TODO.md Add random idea 2019-11-18 03:11:00 -08:00

Schala - a programming language meta-interpreter

Schala is a Rust framework written to make it easy to create and experiment with multipl toy programming languages. It provides a cross-language REPL and provisions for tokenizing text, parsing tokens, evaluating an abstract syntax tree, and other tasks that are common to all programming languages, as well as sharing state between multiple programming languages.

Schala is implemented as a Rust library schala-repl, which provides a function start_repl, meant to be used as entry point into a common REPL or non-interactive environment. Clients are expected to invoke start_repl with a vector of programming languages. Individual programming language implementations are Rust types that implement the ProgrammingLanguageInterface trait and store whatever persistent state is relevant to that language.

Run schala with: cargo run. This will drop you into a REPL environment. Type :help for more information, or type in text in any supported programming language (currently only schala-lang) to evaluate it in the REPL.

History

Schala started out life as an experiment in writing a Javascript-like programming language that would never encounter any kind of runtime value error, but rather always return null under any kind of error condition. I had seen one too many Javascript Uncaught TypeError: Cannot read property ___ of undefined messages, and I was a bit frustrated. Plus I had always wanted to write a programming langauge from scratch, and Rust is a fun language to program in. Over time I became interested in playing around with other sorts of programming languages as well, and wanted to make the process as general as possible.

The name of the project comes from Schala the Princess of Zeal from the 1995 SNES RPG Chrono Trigger. I like classic JRPGs and enjoyed the thought of creating a language name confusingly close to Scala. The naming scheme for languages implemented with the Schala meta-interpreter is Chrono Trigger characters.

Schala and languages implemented with it are incomplete alpha software and are not ready for public release.

Languages implemented using the meta-interpreter

  • The eponymous Schala language is a work-in-progress general purpose programming language with static typing and algebraic data types. Its design goals include having a very straightforward implemenation and being syntactically minimal.

  • Maaru is a very simple dynamically-typed scripting language, with the semantics that all runtime errors return a null value rather than fail.

  • Robo is an experiment in creating a lazy, functional, strongly-typed language much like Haskell

  • Rukka is a straightforward LISP implementation

Reference works

Here's a partial list of resources I've made use of in the process of learning how to write a programming language.

General

http://thume.ca/2019/04/18/writing-a-compiler-in-rust/

Type-checking

https://skillsmatter.com/skillscasts/10868-inside-the-rust-compiler https://www.youtube.com/watch?v=il3gD7XMdmA http://dev.stephendiehl.com/fun/006_hindley_milner.html https://rust-lang-nursery.github.io/rustc-guide/type-inference.html

https://eli.thegreenplace.net/2018/unification/ https://eli.thegreenplace.net/2018/type-inference/ http://smallcultfollowing.com/babysteps/blog/2017/03/25/unification-in-chalk-part-1/ http://reasonableapproximation.net/2019/05/05/hindley-milner.html https://rickyhan.com/jekyll/update/2018/05/26/hindley-milner-tutorial-rust.html

Evaluation

Understanding Computation, Tom Stuart, O'Reilly 2013

Basics of Compiler Design, Torben Mogensen

Parsing

http://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/ https://soc.github.io/languages/unified-condition-syntax

Crafting Interpreters

LLVM

http://blog.ulysse.io/2016/07/03/llvm-getting-started.html

###Rust resources https://thefullsnack.com/en/rust-for-the-web.html

https://rocket.rs/guide/getting-started/