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.24.tar.gz (327.3 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.24-cp312-cp312-win_amd64.whl (680.8 kB view details)

Uploaded CPython 3.12Windows x86-64

inscript_lang-3.9.6.24-cp312-cp312-manylinux_2_28_x86_64.whl (764.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.24-cp312-cp312-manylinux_2_28_aarch64.whl (732.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.24-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.24-cp311-cp311-win_amd64.whl (677.3 kB view details)

Uploaded CPython 3.11Windows x86-64

inscript_lang-3.9.6.24-cp311-cp311-manylinux_2_28_x86_64.whl (761.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.24-cp311-cp311-manylinux_2_28_aarch64.whl (731.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.24-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.24-cp310-cp310-win_amd64.whl (677.5 kB view details)

Uploaded CPython 3.10Windows x86-64

inscript_lang-3.9.6.24-cp310-cp310-manylinux_2_28_x86_64.whl (761.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.24-cp310-cp310-manylinux_2_28_aarch64.whl (731.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.24-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.24.tar.gz.

File metadata

  • Download URL: inscript_lang-3.9.6.24.tar.gz
  • Upload date:
  • Size: 327.3 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.24.tar.gz
Algorithm Hash digest
SHA256 e5f165a10b1c5aabd664b3421fb0811f32f87b259c2a256859729c85da746b24
MD5 da45c24d1dd5b7b609277cfc4be1d371
BLAKE2b-256 97878bc2ecc804988539dbc1cd9de38ce75897d0880a65412d63da453093b0ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d0027e9337bbdd1656e4b5292c3911edfbf51c55f87f72303554329f7dfe14ff
MD5 a4f2bce45647a4572cb7c7c8780102f8
BLAKE2b-256 2812bdf4001a29dd707e4289e74f64f5174119d41d29ddc6f8bbae588aa3dfab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b32a98e09c84e38768b4e6888364035262c1b6daf614503b59e1564cce02abfe
MD5 ce41fe1c76c3ac4db71b9a769c4b06aa
BLAKE2b-256 bb3eafe50b2254159c21d9a088f6d4b3768bee62199c332896cd3093f812a06d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ced93bbe5fb64f6346ed269dc1e821a25fdf8fc88b3be7a816865eda40179f03
MD5 ecd1c3eeede0af9ac9bc13836d23ed75
BLAKE2b-256 ca0006fa518c61fc1d0d6db88671fae99158eb4d2531546a8eb29256eb7dc2a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 1b7c39d04c71b1ec9508f5f8a3f06d3ed2f8f46ac98680da9524aa9875ed7c5f
MD5 a440bfd6514f7c1a2159e4d05c534399
BLAKE2b-256 e35dfa9599da2b4a9c1895b8e37dee672932c3cae274608035171b239ebffd3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1367918e1a3a3d2c3bddab7019e092c79bd91e3127887d9a0dd1f67487adddab
MD5 b33c65e8beeb7dd49fa2ed43aedd1583
BLAKE2b-256 03d6f524e6861477fdc27e94f725893378f982c20287419578887bfb80f2ee27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d6fd79cf3a4df510b6ba1f1a36611f19476c266d07d4d4dbd6b7d7b7a2d20e61
MD5 ecd991c06c4faf83a394c54c52ce277e
BLAKE2b-256 1ac3cc5854da9e6d67de26c14adfb928f5afa0267a233312cdb33aca9d53c03c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 45b81a64f21be2dfc25ca9d38a0549abacbddce5aa6457e85268fc1c21cb83d6
MD5 f7c2372ca977c22422a85dc65bb97ed4
BLAKE2b-256 5c1763346c7df0ddcf343f01dc12a8175730b15bef0d597b4405351cff5f4fb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp311-cp311-macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 982ee37d576f8ff758cf17637731ea419eff355b522545d082bf25853360c074
MD5 96311fb35d02f9203dac8d5edba7bc35
BLAKE2b-256 428049099379cfc8eeb824910ea92dd861cc2f4f448272df586f61ce0ed7fcc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 62f77d103d13c92d5321cfd512d524e1ef504e34de0975663da235ff11960c0b
MD5 b6e6d54b29c00c50a5dc6677bedccfa4
BLAKE2b-256 671dad3162d5cbd2b2f0f4e027e1a047dd0e6ccfc2cf15896361e56691fe0157

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 071311209ed17fa00cb59cc68744b80d744256a237f904a7e0656ff328b0ba8f
MD5 64f86d93e20313f98339f3c891f6bb9c
BLAKE2b-256 58fb4641dce54cd3ef2116f45ace7c8c7e05aafb7aabb3b9ec8f457bc14bdb1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 23ba97566faa93d404d02ab47f7497f39a1d33375b77c6824ba7e818bec605f4
MD5 84a296bb4c8373fa1fab6f89047f2de3
BLAKE2b-256 c01c029599add34ce44d6760aaf717202b65980fd0cdd0285e47798e110aa760

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.24-cp310-cp310-macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 9b477b81fbf4367bbb23c5ddc6b6d1cbca6b7b37fcca10e8d301d69f553b5303
MD5 9f11345986222a24019a2b604615e9a0
BLAKE2b-256 0a580d0411326dccf9c6fdfd990386f91f8fb40fdd21c0955cd02022d1ff0b18

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