Skip to main content

InScript — a game-focused scripting language with 59 game modules and a bytecode VM

Project description

InScript Lexer - Rust Implementation (v3.7.2)

Real, compilable Rust tokenizer for InScript language.

Features

✅ Zero-copy token references (fast, memory efficient) ✅ State machine lexer (no backtracking) ✅ 30+ token types (keywords, operators, literals) ✅ Accurate line/column tracking ✅ Comprehensive error reporting ✅ Python FFI via PyO3 ✅ Full test coverage

Build

cargo build --release

Token Types Supported

Literals

  • Numbers (integers and floats)
  • Strings (single and double quoted)
  • Identifiers

Keywords

  • if, else, while, for, fn, return
  • true, false, nil
  • and, or, not

Operators

  • Arithmetic: +, -, *, /, %
  • Comparison: ==, !=, <, <=, >, >=
  • Assignment: =
  • Logical: and, or, not

Delimiters

  • Parentheses: ( )
  • Braces: { }
  • Brackets: [ ]
  • Punctuation: , . ; : ->

Rust Usage

use inscript_lexer::Lexer;

fn main() {
    let code = "let x = 42;";
    let lexer = Lexer::new(code);
    
    for token in lexer {
        match token {
            Ok(t) => println!("{:?}: {}", t.token_type, t.value),
            Err(e) => eprintln!("Error: {}", e),
        }
    }
}

Python Usage (after compilation)

from inscript_lexer import PyLexer, tokenize_string

# Method 1: Using PyLexer class
lexer = PyLexer("let x = 42;")
tokens = lexer.tokens()
print(f"Found {lexer.count()} tokens")

# Method 2: Direct tokenization
tokens = tokenize_string("if true then x else y")
for token in tokens:
    print(f"{token.token_type}: {token.value}")

Performance

Expected Benchmarks

  • Simple tokens: < 100ns per token
  • Complex code: < 10µs per 100 tokens
  • Memory: O(1) per token

Optimizations

  • Inline hot paths
  • No allocations in common cases
  • SIMD-friendly string scanning
  • Zero-copy string references

Testing

# Run tests
cargo test

# Run with output
cargo test -- --nocapture

# Benchmark
cargo bench

Accuracy

✅ Correct line/column tracking ✅ Handles escape sequences ✅ Detects unterminated strings ✅ Error recovery

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inscript_lang-3.9.6.38.tar.gz (328.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

inscript_lang-3.9.6.38-cp312-cp312-win_amd64.whl (681.8 kB view details)

Uploaded CPython 3.12Windows x86-64

inscript_lang-3.9.6.38-cp312-cp312-manylinux_2_28_x86_64.whl (765.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.38-cp312-cp312-manylinux_2_28_aarch64.whl (733.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.38-cp312-cp312-macosx_10_13_universal2.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

inscript_lang-3.9.6.38-cp311-cp311-win_amd64.whl (678.2 kB view details)

Uploaded CPython 3.11Windows x86-64

inscript_lang-3.9.6.38-cp311-cp311-manylinux_2_28_x86_64.whl (762.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.38-cp311-cp311-manylinux_2_28_aarch64.whl (732.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.38-cp311-cp311-macosx_10_12_universal2.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 10.12+ universal2 (ARM64, x86-64)

inscript_lang-3.9.6.38-cp310-cp310-win_amd64.whl (678.5 kB view details)

Uploaded CPython 3.10Windows x86-64

inscript_lang-3.9.6.38-cp310-cp310-manylinux_2_28_x86_64.whl (762.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.38-cp310-cp310-manylinux_2_28_aarch64.whl (732.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.38-cp310-cp310-macosx_10_12_universal2.whl (1.1 MB view details)

Uploaded CPython 3.10macOS 10.12+ universal2 (ARM64, x86-64)

File details

Details for the file inscript_lang-3.9.6.38.tar.gz.

File metadata

  • Download URL: inscript_lang-3.9.6.38.tar.gz
  • Upload date:
  • Size: 328.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for inscript_lang-3.9.6.38.tar.gz
Algorithm Hash digest
SHA256 bce540a0620ef907b43e8844c86ee2f2cfba04281e31c62e8ce138ddb2c0f3f4
MD5 a64482967baeda03a12c18db8c613779
BLAKE2b-256 ccc6448d0085a3b1e9ed97647e6271be0a1a2e306a567da5fc68d50a0b397a2e

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4860f44d91c67e8f2866929469034e435fa584c544f5b00e8675a86257e2d59f
MD5 75e09debddc453e5b08484f327563e8f
BLAKE2b-256 080b122ff4e886d4568458f9b90a22612d390aa513c73ff3c60619298c37a5c0

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c7538acafa48368746f137f209397ae33d941bd1c73bf9fc6f50858f69fef5c7
MD5 524797e96422ea34f2fdb5b671cb8229
BLAKE2b-256 20e3de489cb6dbbb1604f282a9f0f8194e98fcc3a740dc0acad9a0fbecaa6b9b

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 316e44bd862f0545b43f2d44e77878a625d6b311b3b2725b3d6d986765d4a2d7
MD5 c968c44437f50497de834501c0576617
BLAKE2b-256 a275018368e888d6ea87e616663bbcab978495b29d5c7a19b442d86d12592f69

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 ee08f179195cad8931b329fbf3f6bb5a390348606d018ece6d3daa8a094c2f34
MD5 38a0761e8cc207d42f9fea189e21ac96
BLAKE2b-256 6d9e1c2e74c61ac3a56fa87a9f93c096152a1a0e731a735bfb16a9ff81c5ddfd

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fc6f83abfba31b793e34b74e530482b1622d0219f234582f089c923e35153f7c
MD5 bd71c7fe3ee33d441e0eaba15316270f
BLAKE2b-256 67d00afef6d6038172f617269aa1624af0e2761983eddbbed8a448a6a04f0e48

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1f09e5703233f5f37ef0a65da9eeca3a570f0429e20bce60f6b0d9a72f05b8ea
MD5 d6a54f213d695cbecac2dc262ed17600
BLAKE2b-256 4c1d510f1114d22081009a67ac49505c47132f41590337d31ee3cfd9361da70b

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 25502339f3200c54da18dc052b66391e8c6d1f181b605eec2ec84e109228f5af
MD5 84742f1366762e50b9e22a622c1175b3
BLAKE2b-256 ecad04e41648f69a38aeac09876edfb5086db97667641eaf52cf89d132800a1a

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp311-cp311-macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp311-cp311-macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 9adcae2d1fc51484d7429ea230871a2effff966ab87c02e7dff353484f91fc12
MD5 b4c36359a78ce50f667595f689ce9284
BLAKE2b-256 c94d94c7bb5de98495efb99dbec187891676dfd58996777a43d534495e1f8d71

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 29ef0f5690d998d9ffc6f78345ba8fd5e36693435025cb23f3be569da5640085
MD5 c1edbdf9dd127fdd05c714ea0e4b3309
BLAKE2b-256 d91dff27a41bccaee829995d1ccbdba7054affaf362bd303a628c9c595e47c26

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 efa88ebf19cc4c920d0ce4aa3e31ece9788e68eacbfe63f4bbab8ed63f506a0a
MD5 4a4154e011fe2c6a2e1d1c852ed2448f
BLAKE2b-256 f7a3a786d2d7e06f2bca878352be52ffdb05fea756bf62d3fb0602e5d5c01cd6

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d3aa3dbd09df289b9bf6e2d465b9e665c95960bfcf1cf9e684b9e2820db15c8f
MD5 ff20730e93ca9679f3c344c1dfa12639
BLAKE2b-256 ce631f5967cde8d797e753cc753eef83f1e3113c59bc91fd4a8249b4d133f491

See more details on using hashes here.

File details

Details for the file inscript_lang-3.9.6.38-cp310-cp310-macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for inscript_lang-3.9.6.38-cp310-cp310-macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 bfb5dc4089074658300c452ddf6662d313b0870987eaf16b0a3f679ef8fc3a2d
MD5 b1935c58aae400b502c41c83c8f608c5
BLAKE2b-256 448b825328b740ba224f80f7549438a80d9796b127416b7bd0190a156f44130a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page