Skip to content

Commit

Permalink
Gave up on WebAssembly, now using a Rust server
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasLYang committed Nov 27, 2022
1 parent 3f0b022 commit f4c4b2e
Show file tree
Hide file tree
Showing 24 changed files with 2,750 additions and 334 deletions.
772 changes: 772 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ edition = "2021"

[dependencies]
anyhow = "1.0.66"
axum = "0.6.0"
serde = { version = "1.0.147", features = ["derive"] }
tokio = { version = "1.22.0", features = ["full"]}
tower-http = { version = "0.3.4", features = ["cors"] }
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
tree-sitter = "0.20.9"

[build-dependencies]
Expand Down
8 changes: 8 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ struct LetDeclaration {

This might require some rules on tree-sitter grammars such as `choice` must always be top level
(although anonymous structs is a reasonable solution)

# Tree-Sitter WebAssembly

Currently, tree-sitter compiles to WebAssembly via a custom build script. I'd like to change that, so it can be compiled
via the Rust build.rs script. That way it can be used with the rest of a Rust codebase that is compiled to WebAssembly.

The current idea is to fix up the build.rs script. However, a longer term idea is to just compile tree-sitter grammars
to Rust instead of C.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ fn main() {
cc::Build::new()
.include(&dir)
.file(dir.join("parser.c"))
.compile("tree-sitter-vicuna");
.compile("tree-sitter-vicuna")
}
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Vicuna</title>
<script type="text/javascript" src="/target/wasm32-unknown-emscripten/debug/vicuna.js">
</script>
</head>
<body>
<p>This is an example paragraph. Anything in the <strong>body</strong> tag will appear on the page, just like this <strong>p</strong> tag and its contents.</p>
</body>
</html>
24 changes: 24 additions & 0 deletions playground/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions playground/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit f4c4b2e

Please sign in to comment.