byoidsl
byoidsl
This repository is a companion to a live-coding project aimed at building your own interactive DSL.
You can check out the videos here.
Installation
Clone the project, then run shards install
to install the dependencies.
To package the CLI tool into an executable, run
crystal build --release src/igol_repl.cr -o igol
Using the CLI tool
You can use the CLI tool to either start the REPL or run a script.
Run ./igol --help
to print the CLI help message.
REPL
To enter the REPL, you can run
crystal src/igol_cli.cr
or simply
./igol
The REPL can interpret commands to
- show the current state of the grid
- evolve the grid
- assign a pattern to a variable
- set a pattern on the grid
The REPL also supports loading scripts from a file into the REPL runtime, with the special %load
syntax
%load filepath/to/script
Try running the following yourself!
(0,2) <- .****
show
%load examples/script.igol
evolve 2;
n: ..*
(1,-2) <- n
Note. You can append ;
to a DSL instruction to suppress the output.
Running scripts
To run a script, simply pass an argument to the executable, e.g.
./igol examples/script.igol
Contributing
- Fork it (https://github.com/lbarasti/byoidsl/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- lbarasti - creator and maintainer
byoidsl
- 6
- 1
- 0
- 0
- 4
- over 4 years ago
- May 25, 2020
MIT License
Sat, 23 Nov 2024 20:15:21 GMT