{"id":16752314,"url":"https://github.com/jprochazk/hebi","last_synced_at":"2025-03-17T02:31:01.033Z","repository":{"id":81108527,"uuid":"579728879","full_name":"jprochazk/hebi","owner":"jprochazk","description":"Scripting language","archived":false,"fork":false,"pushed_at":"2023-10-08T13:02:08.000Z","size":1971,"stargazers_count":19,"open_issues_count":14,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-11T19:46:23.242Z","etag":null,"topics":["compiler","interpreter","programming-language","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jprochazk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-12-18T18:00:46.000Z","updated_at":"2025-01-11T00:05:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"eee00190-a8cd-4ffd-b594-ab16b7dcec2e","html_url":"https://github.com/jprochazk/hebi","commit_stats":{"total_commits":219,"total_committers":1,"mean_commits":219.0,"dds":0.0,"last_synced_commit":"6d3939faed1ff7edbad6792af4669452264f4c3d"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jprochazk%2Fhebi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jprochazk%2Fhebi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jprochazk%2Fhebi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jprochazk%2Fhebi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jprochazk","download_url":"https://codeload.github.com/jprochazk/hebi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243776838,"owners_count":20346357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","interpreter","programming-language","rust"],"created_at":"2024-10-13T02:46:38.590Z","updated_at":"2025-03-17T02:31:00.589Z","avatar_url":"https://github.com/jprochazk.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg\n    alt=\"A snake inside of a gear shape\"\n    src=\"./assets/logo.svg\"\n    height=\"192px\"\n  \u003e\n\u003c/p\u003e\n\n# Hebi\n\nThis repository hosts a dynamically typed language, its compiler, and VM.\n\n🚧 This branch contains a rewrite of the language. It is currently heavily WIP! 🚧\n\n## Usage\n\nInstall the library (currently only available via git):\n\n```\n$ cargo add --git https://github.com/jprochazk/hebi.git --branch v2\n```\n\nImport it, and run some code:\n\n```rust\nuse hebi::Hebi;\n\nfn main() {\n  let mut hebi = Hebi::new();\n\n  println!(\"1 + 1 = {}\", hebi.eval(\"1 + 1\").unwrap());\n}\n```\n\nHebi can do much more than this, though! Here are some of its features:\n\n- Syntax similar to Python, including significant indentation\n- First-class functions\n- Classes with single inheritance\n- Easy Rust function and struct binding\n- Async support\n\nVisit the [examples](./examples) directory to see Hebi in action.\n\nYou can run an example using `cargo run --example \u003cname\u003e`:\n```\n$ cargo run --example basic\n```\n\nAs well as with the CLI:\n```rs\n$ cargo run -p hebi-cli -- examples/hebi/tic-tac-toe.hebi\n```\n\n## Development\n\nThe first step is to install Rust and Cargo via [rustup](https://rustup.rs/).\n\n### xtask\n\nThis repository uses [cargo-xtask](https://github.com/matklad/cargo-xtask) for various utilities, scripts, and tasks. That means you don't need anything other than Rust and Cargo. No makefiles, Python, or Bash.\n\nTo see all available tasks, run:\n```\n$ cargo xtask\n```\n\nTo run one of them, use:\n```\n$ cargo xtask \u003ctask\u003e\n```\n\nOr the slightly shorter:\n```\n$ cargo x \u003ctask\u003e\n```\n\nFor example:\n```\n# Run all tests and examples\n$ cargo xtask test\n```\n\nSome tasks use tools which you'll have to install, though these are kept to just a select few, and ideally always installed through either `rustup` or `cargo`.\n\n- [Miri](https://github.com/rust-lang/miri) (`rustup +nightly component add miri`)\n- [Insta](https://insta.rs/) (`cargo install --locked cargo-insta`)\n- [mdBook](https://github.com/rust-lang/mdBook) (`cargo install --locked mdbook`)\n\n### CLI\nThe Hebi CLI provides a few tools for running and debugging scripts. It can be used through `cargo run` or directly after installing the binary with `cargo install --path cli`. The examples below demonstrate both ways.\n\n```bash\n# Print help\n$ cargo run -p hebi-cli -- --help\nUsage: hebi-cli [FILE] [COMMAND]\n\nCommands:\n  run          Execute a Hebi file [default]\n  disassemble  Disassemble a Hebi file [aliases: dis]\n  repl         \n  help         Print this message or the help of the given subcommand(s)\n\nArguments:\n  [FILE]  The path to the Hebi file to process. Required unless code is supplied through stdin\n\nOptions:\n  -h, --help     Print help\n  -V, --version  Print version\n\n# Execute a script\n$ echo 'print \"Hello, world!\"' | hebi \nHello, world!\n\n# Disassemble a script\n$ hebi dis examples/hebi/fib.hebi\nfunction `fib` (registers: 7, length: 57, constants: 2)\n.code\n  0  | load_smi 0\n  2  | store r2\n  4  | load_smi 1\n  6  | store r3\n  8  | load_smi 0\n\u003c...\u003e\n\n# Run a script and dump the VM state on exit\n$ cargo run -p hebi-cli -- run examples/hebi/count_primes.hebi --dump\nπ(1000) = 168\nHebi(\n    Vm {\n        global: Global {\n            inner: State {\n                globals: {\n                    \"to_int\": Object(\n                        BuiltinFunction {\n                            name: \"to_int\",\n                        },\n                    ),\n\u003c...\u003e\n```\n\n## Why Hebi?\n\nI thought it was appropriate, because the language is in the Python family, and Hebi (蛇) means snake in Japanese. \n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0\n  ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license\n  ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjprochazk%2Fhebi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjprochazk%2Fhebi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjprochazk%2Fhebi/lists"}