Crates.io | codebake |
lib.rs | codebake |
version | 0.1.1 |
source | src |
created_at | 2023-05-22 22:28:24.257921 |
updated_at | 2023-05-22 22:39:48.620494 |
description | data processing framework and lisp |
homepage | https://github.com/s-viour/codebake |
repository | https://github.com/s-viour/codebake |
max_upload_size | |
id | 871389 |
size | 81,582 |
codebake (working title) is a toy data-processing framework and lisp language inspired by Cyberchef. it's still got a long way to come, so bear with us! additionally, we have a wiki containing a tutorial and reference documentation for working with codebake.
the principle object in codebake is the Dish, which is just a mutable container of data that is manipulated by operations. for a list of all operations implemented in codebake, check the Operation Reference
the embedded lisp is currently the primary (and only) way of using codebake. there are plans to build a webapp similar to Cyberchef soon, but for now, the lisp is how you use codebake. here's an example:
codebake> (def my-dish d"hello world!")
my-dish
codebake> (def my-recipe (recipe (rot13 13) reverse to-base64))
my-recipe
codebake> (def undo-my-recipe (recipe from-base64 reverse (rot13 13)))
undo-my-recipe
codebake> (bake my-recipe my-dish)
Dish("IXF5ZWJqIGJ5eXJ1")
codebake> (bake undo-my-recipe :ans)
Dish("hello world!")
note that:
d"hello world!"
isn't a regular string, it's a dish literal which creates a Dish
.recipe
function creates a recipe (just a list of functions that operate on dishes) out of its arguments. a recipe is applied in-order. that is, the recipe (recipe (rot13 13) reverse)
will apply the rot13
operation before applying reverse
.bake
function applies a recipe to a Dish
.:ans
symbol is always defined and is the last successful result from the interpreter.the bake
and recipe
functions are implemented for convenience, but applying operations directly to dishes is perfectly viable too. additionally, the lisp supports lambda
and defn
for defining functions. here's an example demonstrating all this:
codebake> (defn rot-reverse (n text) (reverse ((rot13 n) (dish text))))
rot-reverse
codebake> (rot-reverse 13 "hello world!")
Dish("!qyebj byyru")
for more information on the Lisp, see the Lisp Reference.
the core codebake project can be compiled to WASM to run in the web. this lets us embed the lisp in a browser. we'd like to incorporate this into a Cyberchef-like scripting environment that runs in the browser alongside the webapp, but we're still very far off from that. a demo of the web interpreter is available here though: https://saviour.dev/0013
codebake is a cargo workspace containing all of the main codebake projects. currently, there is:
we intend to add a 3rd project, the webapp, to this workspace soon.
contributions are welcome! check out the CONTRIBUTING file to learn more.
codebake follows the standard cargo build
procedure!