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.39.tar.gz (328.4 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.39-cp312-cp312-win_amd64.whl (681.9 kB view details)

Uploaded CPython 3.12Windows x86-64

inscript_lang-3.9.6.39-cp312-cp312-manylinux_2_28_x86_64.whl (765.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.39-cp312-cp312-manylinux_2_28_aarch64.whl (734.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.39-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.39-cp311-cp311-win_amd64.whl (678.4 kB view details)

Uploaded CPython 3.11Windows x86-64

inscript_lang-3.9.6.39-cp311-cp311-manylinux_2_28_x86_64.whl (762.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.39-cp311-cp311-manylinux_2_28_aarch64.whl (732.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.39-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.39-cp310-cp310-win_amd64.whl (678.7 kB view details)

Uploaded CPython 3.10Windows x86-64

inscript_lang-3.9.6.39-cp310-cp310-manylinux_2_28_x86_64.whl (763.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.39-cp310-cp310-manylinux_2_28_aarch64.whl (732.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.39-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.39.tar.gz.

File metadata

  • Download URL: inscript_lang-3.9.6.39.tar.gz
  • Upload date:
  • Size: 328.4 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.39.tar.gz
Algorithm Hash digest
SHA256 e3d6eb64eb22cbce69d1a2b2d1cb7a3f43367f8933e409c15dab7d47228dd362
MD5 28395c062637232d09d6f1ec84a32e00
BLAKE2b-256 fe3424bdad628570d0ae99f1711c9a2563a14a132a27db5ad9156adbfd839545

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1f5724381048f3164fdbd2c8a47f259beeb0e887afb3931b511dcaa6b41027f2
MD5 3b829698f0be6223e7befb88c5615414
BLAKE2b-256 d13fed745800eb80b069668aafd69713a3413a559660fa6c2159d55deb77a340

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 673b9b995f438f221f31bdd60dc5708b8621191f142aa9c0f7d5c0fc108cbfe1
MD5 0f94d4f8b2e8d3099df141ff839cfd53
BLAKE2b-256 ed6b841709a2a39b116375d3b1a540cc251f0eb14f1032d702c480e8f54c6365

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0c00c53a0c5dd17b3aaa41675134156d55a7704e44f81a264f9d97edb291a608
MD5 27e55e94c9c2bc0ab05d4c3e84ce09e9
BLAKE2b-256 d4fcf11a0827429b7e7d373d3491362eb8df8fc8eaaffb8310777ddb66a44379

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 f0bb50b75ae64d14bab972a1029829f08162e07dd25a23dc20d2fc0f9d60bc54
MD5 60d114c068c0ea89765a76b33bafd22a
BLAKE2b-256 ec651baa06c27cd5146c0a1205a5bf71c8ff903e1103033c485a24efaca5b9ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bd9b93a6ddfe52a8dd5a05a68fffe0a20e7d3bb1536778d4641b0d19507b9f64
MD5 958a222d90aa90de1f796c01f4b61daf
BLAKE2b-256 0e732309c71d422dc5848f824bb9dea224b1a04fc2e2f67741c535f045bd53a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7871186e72a7afdd53b302ae9c63fd27556fe365ba4a234d8dcc8f4e55bf93e7
MD5 a59a6bd3408601e26a859498c24a910f
BLAKE2b-256 213e115fdd5188015dc78fb6ecab7da99fc4edd1697c3bb2483cd67571448de5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4c04b47363b8333614af7bb23e12dee02e817af9cb362b079016479bd83f8a36
MD5 a7763a7a6124d90391fc354256dc32ee
BLAKE2b-256 8169c78e7b16207564f79618f8da8895f91dfad5038466dd00d35b2f7338be09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp311-cp311-macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 92f46cb08617eaaaf49b3aec7a105cdf363b7a417ed5242949361b20f9041bb4
MD5 83f163cccb458c7ceac0be6c0436bab9
BLAKE2b-256 916a19c2b7875f11abfe0131a832dd0810fc7a495468a0847a50ecddf312a80e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fca307203f9e87f3279bcab8a02bd1bcc842e14eeb755f281f1c696c5c191e73
MD5 d935386f8e456a25397e2b4f28ab2e94
BLAKE2b-256 d0e7051d00b39095320fb6c4c0df9cb554005d3728432b623e8cc97d213e633e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 88bea798b31caa587e2f29eb0e2337c6e8cbbc764d7facb0ee22bce89a172d5a
MD5 d4e7b196c5ce3e8e215e0a0d8f384322
BLAKE2b-256 e93233d7558f92db471be02bc895192b84cae558a628fbdd57663a2694436bd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fadfcab6516738a92ff49bfc2cf25b8a8a12a25a43db6075b369acf9ac79451a
MD5 918b5728ce422f1e13e7e9638a0d5d45
BLAKE2b-256 44f10427c99c130d34cee2f94e50045930c49747c32153a9032643b16ffcc010

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.39-cp310-cp310-macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 d6e98a17b162f915615484a1cb82fada0c008ed68a2daec6cadf7e2bfd149d6a
MD5 0d232f8a9a4ec238466a7ade5125cfab
BLAKE2b-256 30ebdaf72fd9692eb135f42b2d9563f5a647a17017a3501caa5f0e1a1d7d85d6

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