This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use anyhow::{anyhow, Context, Error}; | |
use std::fmt; | |
mod ffi; | |
#[derive(Clone, Debug)] | |
pub enum Sexp { | |
Atom(String), | |
List(Vec<Sexp>), | |
Nil, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use anyhow::{anyhow, Context, Error}; | |
use std::fmt; | |
mod ffi; | |
#[derive(Clone, Debug)] | |
pub enum Sexp { | |
Atom(String), | |
List(Vec<Sexp>), | |
Nil, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./node_modules/.bin/prettier --write grammar.js | |
grammar.js 61ms | |
tree-sitter generate | |
tree-sitter test | |
s_expressions: | |
✗ [31matom[0m | |
✓ [32mempty[0m | |
✓ [32msingle line[0m | |
✓ [32mmultiple parts[0m | |
✓ [32mnested s-expressions[0m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import load_lam from "./fib.js"; | |
import run_js from "./fib_in_js.js"; | |
document.onclick = () => { | |
run_js().then((_) => load_lam().then(lam => { | |
const run = () => { | |
lam.step(); | |
requestAnimationFrame(run); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(fib). | |
-export([main/1]). | |
-export([add_entry/2]). | |
add_entry(_, _) -> ok. | |
fib(_, _, _, _) -> ok. | |
main(_) -> fib([], 1000, 1, 0). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(fib). | |
-export([main/1]). | |
add_entry(DomNode, Text) -> | |
NewNode = dom_document:create_element(<<"div">>), | |
dom_element:set_inner_text(NewNode, Text), | |
dom_element:append_child(DomNode, NewNode). | |
fib(DomNode, N, B, A) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let root = document.getElementById("js"); | |
let t0 = Date.now(); | |
let startedAt = document.createElement("div"); | |
startedAt.innerText = "Started at: "+Date.now(); | |
root.appendChild(startedAt) | |
let node = document.createElement("div"); | |
node.innerText = "unstarted" | |
root.appendChild(node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{module, grep}. %% version = 0 | |
{exports, [{main,1},{module_info,0},{module_info,1}]}. | |
{attributes, []}. | |
{labels, 24}. | |
{function, print_matches, 3, 2}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{module, grep}. %% version = 0 | |
{exports, [{main,1},{module_info,0},{module_info,1}]}. | |
{attributes, []}. | |
{labels, 24}. | |
{function, print_matches, 3, 2}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Source code generated with Caramel. | |
-module(grep). | |
-export([main/1]). | |
print_matches(Word, [Word | T], File) -> | |
io:format(<<"~p: ~p\n">>, [File, Word]), | |
print_matches(Word, T, File); | |
print_matches(Word, [_ | T], File)-> | |
print_matches(Word, T, File); |