Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add partial syntax, source maps, removed Keyword from AST and other CLI fixes #107

Merged
merged 25 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0571063
Removed `Keyword` from AST and other CLI fixes
kaleidawave Jan 15, 2024
cb67f7c
Changed AST generator interpolation & added more keyword registrations
kaleidawave Jan 15, 2024
0740c87
Parser fixes & simplified APIs
kaleidawave Jan 16, 2024
cb2bbd4
Added partial syntax, refactor cursors -> markers & added option for …
kaleidawave Jan 17, 2024
c935e6f
Added source map bindings & other improvements
kaleidawave Jan 18, 2024
d4f927a
minor fixes
kaleidawave Jan 18, 2024
ed15418
More fixes
kaleidawave Jan 18, 2024
e0765e2
Added max_length and some more fixes
kaleidawave Jan 18, 2024
d5cb9d8
More fixes
kaleidawave Jan 19, 2024
4717775
Few more fixes
kaleidawave Jan 19, 2024
74861b3
actual fixes (forgot to stage everything lmao)
kaleidawave Jan 19, 2024
6164aba
More minor parser fixes
kaleidawave Jan 22, 2024
9d66300
more parser fixes
kaleidawave Jan 22, 2024
885b689
Some more fixings
kaleidawave Jan 22, 2024
6875639
Some fixes
kaleidawave Jan 22, 2024
6bb7b6c
More fixes
kaleidawave Jan 23, 2024
ac249b9
hmm
kaleidawave Jan 23, 2024
8de859c
maybe
kaleidawave Jan 23, 2024
1b47c83
More
kaleidawave Jan 23, 2024
7d00f51
Removed retaining number formatting and fixed things
kaleidawave Jan 23, 2024
0d0aeb6
Statement::Marker -> StatementOrDeclaration. Removed number formatting
kaleidawave Jan 25, 2024
e808306
More
kaleidawave Jan 25, 2024
b3541f5
Fix hex and binary literal decoding & improved declaration lookahead
kaleidawave Jan 25, 2024
ba2ea0f
No longer allow empty function arguments
kaleidawave Jan 27, 2024
ee20145
.
kaleidawave Jan 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
# Important that everything here works in all the above OSes!
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/performance-and-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
Expand Down Expand Up @@ -73,13 +74,13 @@ jobs:
- name: Run parser, minfier/stringer performance
shell: bash
run: |
curl https://esm.sh/v128/[email protected]/es2022/react-dom.mjs > react.js

echo "### Parsing and writing out minified form of `react-dom`
\`\`\`shell">> $GITHUB_STEP_SUMMARY
hyperfine './target/release/ezno ast-explorer --file react.js uglifier' >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
strings=(
"https://esm.sh/v128/[email protected]/es2022/react-dom.mjs"
"https://esm.sh/v135/[email protected]/es2022/typescript.mjs"
)

- name: Print (linux) binary size
run: |
echo "Binary is $(stat -c %s ./target/release/ezno) bytes" >> $GITHUB_STEP_SUMMARY
for url in "${strings[@]}"; do
curl $url > input.js
cargo run -p ezno-parser --example parse input.js --timings --render-timings
cargo run -p ezno-parser --release --example parse input.js --timings --render-timings
done
152 changes: 82 additions & 70 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,72 +43,6 @@ jobs:

- name: Check binary
run: cargo check --bin ezno

extras:
runs-on: ubuntu-latest
needs: validity
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable

- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- 'src/**'
parser:
- 'parser/**'
checker:
- 'checker/**'

- uses: brndnmtthws/rust-action-cargo-binstall@v1
if: steps.changes.outputs.src == 'true'
with:
packages: [email protected]
- uses: denoland/setup-deno@v1
if: steps.changes.outputs.src == 'true'
with:
deno-version: v1.x
- uses: actions/setup-node@v3
if: steps.changes.outputs.src == 'true'
with:
node-version: 18

- name: Check WASM
if: steps.changes.outputs.src == 'true'
run: |
rustup target add wasm32-unknown-unknown
# Need to build to check that the JS builds
npm ci
npm run build
working-directory: src/js-cli-and-library

- name: Build and test WASM
if: steps.changes.outputs.src == 'true'
run: |
npm ci
npm run test
node ./dist/cli.cjs info
deno run -A ./dist/cli.mjs info
working-directory: src/js-cli-and-library
shell: bash

- name: Check parser without extras
if: steps.changes.outputs.parser == 'true'
run:
cargo check -p ezno-parser --no-default-features

- name: Check checker without default features
if: steps.changes.outputs.checker == 'true'
run:
cargo check -p ezno-checker --no-default-features

formating:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -152,11 +86,8 @@ jobs:
run: |
cargo test

# TODO test other big libraries
curl https://esm.sh/v128/[email protected]/es2022/react-dom.mjs > react.js
cargo run -p ezno-parser --example parse react.js > /dev/null

cargo test -p ezno-ast-generator
cargo run -p ezno-parser --example parse react.js --timings --render-timings
working-directory: parser

- name: Run checker specification
Expand All @@ -181,6 +112,76 @@ jobs:
- name: Run base tests
run: cargo test

extras:
runs-on: ubuntu-latest
needs: validity
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable

- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- 'src/**'
parser:
- 'parser/**'
checker:
- 'checker/**'

- uses: brndnmtthws/rust-action-cargo-binstall@v1
if: steps.changes.outputs.src == 'true'
with:
packages: [email protected]
- uses: denoland/setup-deno@v1
if: steps.changes.outputs.src == 'true'
with:
deno-version: v1.x
- uses: actions/setup-node@v3
if: steps.changes.outputs.src == 'true'
with:
node-version: 18

- name: Build and test WASM
if: steps.changes.outputs.src == 'true'
# TODO want `continue-on-error: true` but doesn't report error
run: |
# TODO `cargo check --target wasm32-unknown-unknown --lib` might be good enough

rustup target add wasm32-unknown-unknown
npm ci
npm run build
npm run test
node ./dist/cli.cjs info
deno run -A ./dist/cli.mjs info
working-directory: src/js-cli-and-library
shell: bash

- name: Check parser without extras
if: steps.changes.outputs.parser == 'true'
# TODO want `continue-on-error: true` but doesn't report error
run:
cargo check -p ezno-parser --no-default-features

- name: Check parser generator
if: steps.changes.outputs.parser == 'true'
# TODO want `continue-on-error: true` but doesn't report error
run:
cargo test -p ezno-ast-generator

- name: Check checker without default features
if: steps.changes.outputs.checker == 'true'
# TODO want `continue-on-error: true` but doesn't report error
run:
cargo check -p ezno-checker --no-default-features

fuzzing:
needs: validity
runs-on: ubuntu-latest
Expand Down Expand Up @@ -239,10 +240,21 @@ jobs:
publish-ability:
# TODO only need to do for `.toml` file changes
runs-on: ubuntu-latest
# `publish --dry-run` reports too many false positives and doesn't catch actual errors. So disabling for now
if: false
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable

- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
manifests:
- '**/*.toml'

- name: Check that it will publish to crates.io
if: steps.changes.outputs.manifests == 'true'
run: |
cargo metadata --offline --format-version 1 --no-deps | jq -r ".workspace_members[]" | while read -r _n _v pathInfo ; do
if ! grep -q "publish = false" "${pathInfo:13:-1}/Cargo.toml"; then
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cargo run -p ezno-parser --example lex path/to/file.ts
- Check source is valid with `cargo check --workspace`
- Check that code is formatted in accordance with the configuration with `cargo fmt --all --check`
- Run all tests `cargo test --workspace --verbose`
- Use `cargo clippy -- --allow warnings` to find blocking lints
- Use `cargo clippy -- -A warnings` to find blocking lints

### The notify! macro

Expand Down
63 changes: 26 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ serde_json = "1.0.107"
[dependencies.checker]
path = "./checker"
version = "0.0.14"
features = ["ezno-parser"]
features = ["ezno-parser", "serde-serialize"]
package = "ezno-checker"

[dependencies.parser]
Expand All @@ -76,6 +76,7 @@ package = "ezno-parser"

[target.'cfg(target_family = "wasm")'.dependencies]
wasm-bindgen = "=0.2.89"
wasm-bindgen-derive = "0.2.1"
serde-wasm-bindgen = "0.6.3"
console_error_panic_hook = "0.1.7"
js-sys = "0.3"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ What Ezno is
- A *imperative* type system that tracks and evaluates the side effects of functions and control flow structures. It is similar to an interpreter, but acts with types instead of *values* and does not run IO side effects etc
- A collection of experiments of types. Many are being worked out and are in the prototype stage. Some of the new behaviors benefit JavaScript specifically and others could be applied to other languages
- [Fast](https://github.com/kaleidawave/ezno/actions/workflows/performance-and-size.yml)
- [Small](https://github.com/kaleidawave/ezno/actions/workflows/lines-of-code.yml)
- Written in Rust
- Open source! [You can help build Ezno!](https://github.com/kaleidawave/ezno/issues?q=is%3Aopen+label%3Agood-first-issue%2Cfeedback-needed)
- A challenge to the status quo of type checking, optimisations and compilation through deeper static analysis beyond syntax analysis
Expand All @@ -38,7 +39,7 @@ This project is a workspace consisting of a few crates:
<!-- | ezno-web-framework | ![](https://projects.kaleidawave.workers.dev/project/framework/badge) | Visitors and code generation for JSX and reactive expression transformations. | -->
<!-- | ezno-lsp | ![](https://projects.kaleidawave.workers.dev/project/framework/badge) | Visitors and code generation for JSX and reactive expression transformations. | -->

Also checkout [oxc_type_synthesis](https://github.com/web-infra-dev/oxc/tree/main/crates/oxc_type_synthesis), a crate which allows using the type checker inside [oxc](https://github.com/web-infra-dev/oxc/tree/main)!
<!-- Also checkout [oxc_type_synthesis](https://github.com/web-infra-dev/oxc/tree/main/crates/oxc_type_synthesis), a crate which allows using the type checker inside [oxc](https://github.com/web-infra-dev/oxc/tree/main)! -->

## Help contribute

Expand Down
Loading
Loading