2017-09-09 18:39:51 +00:00
|
|
|
# dst
|
2017-02-09 20:02:59 +00:00
|
|
|
|
2017-09-09 18:39:51 +00:00
|
|
|
[![Build Status](https://travis-ci.org/bakpakin/dst.svg?branch=master)](https://travis-ci.org/bakpakin/dst)
|
2017-06-25 23:56:17 +00:00
|
|
|
|
2017-09-09 18:39:51 +00:00
|
|
|
dst is a language and vm that is small and embeddable, has metaprogramming
|
2017-04-25 22:22:43 +00:00
|
|
|
facilities, can interoperate with C, and has enough features to make it
|
2017-07-02 02:46:56 +00:00
|
|
|
a useful general purpose programming language. It is a variant of
|
2017-04-25 22:22:43 +00:00
|
|
|
Lisp with several native useful datatypes. Some of the more interesting and
|
|
|
|
useful features are first class functions and closures, immutable and mutable
|
|
|
|
hashtables, arrays, and bytebuffers, macros (NYI), tail-call optimization,
|
|
|
|
and continuations (coroutines, error handling). The runtime and bootstrapping
|
|
|
|
compiler are written in C99, but should eventually be completely compatible
|
|
|
|
with C89 compilers.
|
|
|
|
|
2017-07-02 02:46:56 +00:00
|
|
|
As of July 2017, still WIP. While the basic runtime is in place, as are many
|
2017-04-25 22:22:43 +00:00
|
|
|
native functions, several important features are still being implemented and
|
2017-07-02 02:46:56 +00:00
|
|
|
defined, like the module system and macros.
|
2017-04-25 22:22:43 +00:00
|
|
|
|
2017-07-02 02:46:56 +00:00
|
|
|
There is a repl for trying out the language, as well as the ability
|
2017-04-25 22:22:43 +00:00
|
|
|
to run script files. This client program is separate from the core runtime, so
|
2017-09-09 18:39:51 +00:00
|
|
|
dst could be embedded into other programs.
|
2017-04-25 22:22:43 +00:00
|
|
|
|
|
|
|
## Compiling and Running
|
|
|
|
|
|
|
|
Clone the repository and run:
|
|
|
|
```sh
|
|
|
|
make run
|
|
|
|
```
|
2017-07-02 02:46:56 +00:00
|
|
|
To build the runtime and launch a repl.
|
2017-04-25 22:22:43 +00:00
|
|
|
|
|
|
|
## Basic programs
|
|
|
|
|
|
|
|
To run some basic programs, run the client with one argument, the name of the
|
|
|
|
file to run. For example, the client that is built will be located in the
|
2017-09-09 18:39:51 +00:00
|
|
|
client directory, so running a program `script.dst` from the project directory
|
2017-07-02 02:46:56 +00:00
|
|
|
would be
|
|
|
|
```bash
|
2017-09-09 18:39:51 +00:00
|
|
|
client/dst script.dst
|
2017-04-25 22:22:43 +00:00
|
|
|
```
|
|
|
|
|
2017-07-02 02:46:56 +00:00
|
|
|
You can also use the `--help` option to see more usage information for the vm.
|
|
|
|
|
|
|
|
## Running Tests
|
|
|
|
|
|
|
|
Simply run `make test` to run the currently minimal test suite.
|
|
|
|
|
2017-06-10 21:44:02 +00:00
|
|
|
## Todo
|
|
|
|
|
2017-07-02 02:46:56 +00:00
|
|
|
* Documentation, with the caveat that things may change.
|
2017-06-10 21:44:02 +00:00
|
|
|
* Use serialization to allow creation of bytecode files that can be loaded.
|
2017-07-02 02:46:56 +00:00
|
|
|
This includes defining a file format for the bytecode files. This mostly done.
|
|
|
|
The byte code serialization could also be useful for the module system for loading artifacts.
|
|
|
|
* Pattern matching/regex library, as well as string formatting functions. This
|
|
|
|
would also be useful for implementing better error messages.
|
2017-06-10 21:44:02 +00:00
|
|
|
* Better error messages, expecially for compilation. This probably means string
|
|
|
|
formating functions.
|
|
|
|
* Macro/specials system that happens before compilation
|
2017-07-02 02:46:56 +00:00
|
|
|
* Module system. Something similar to node's require.
|
2017-09-09 18:39:51 +00:00
|
|
|
* Change name (dst is the name of many projects, including GNU Smalltalk).
|
2017-06-10 21:44:02 +00:00
|
|
|
Maybe make logo :)?
|
|
|
|
* Change C API to be stack based for fewer potential memory management
|
|
|
|
problems. This could mean making current C API internal and use separate
|
|
|
|
API externally.
|
|
|
|
* Store source information in parallel data structure after parsing
|
|
|
|
* Use source information during compilation
|
|
|
|
* Use Lua style memory alocator backend C API (one single function for
|
|
|
|
allocating/reallocating/freeing memory).
|
|
|
|
* More builtin libraires.
|
|
|
|
* Fuzzing
|
|
|
|
|