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.10.16.tar.gz (325.6 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.10.16-cp312-cp312-win_amd64.whl (679.1 kB view details)

Uploaded CPython 3.12Windows x86-64

inscript_lang-3.9.6.10.16-cp312-cp312-manylinux_2_28_x86_64.whl (763.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.10.16-cp312-cp312-manylinux_2_28_aarch64.whl (731.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.10.16-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.10.16-cp311-cp311-win_amd64.whl (675.6 kB view details)

Uploaded CPython 3.11Windows x86-64

inscript_lang-3.9.6.10.16-cp311-cp311-manylinux_2_28_x86_64.whl (759.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.10.16-cp311-cp311-manylinux_2_28_aarch64.whl (729.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.10.16-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.10.16-cp310-cp310-win_amd64.whl (675.8 kB view details)

Uploaded CPython 3.10Windows x86-64

inscript_lang-3.9.6.10.16-cp310-cp310-manylinux_2_28_x86_64.whl (760.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

inscript_lang-3.9.6.10.16-cp310-cp310-manylinux_2_28_aarch64.whl (730.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

inscript_lang-3.9.6.10.16-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.10.16.tar.gz.

File metadata

  • Download URL: inscript_lang-3.9.6.10.16.tar.gz
  • Upload date:
  • Size: 325.6 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.10.16.tar.gz
Algorithm Hash digest
SHA256 ab1a7dd973bb8bc048811a1610b2cd8ec0bac0f603d002def0a0f3b15247da37
MD5 83cd45891c2a914a40a7ecb9af52b847
BLAKE2b-256 3ecf79b298253a87d23e3e8256788bac035066e9fc6b03a8ed687e578d18944c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dbd0d642099c217d5c73fe7d26cad81c8be2e5a921dbd97832d2093a42a13f7b
MD5 02d7bbdab02136f0e0701990c4f5c401
BLAKE2b-256 ff01842500f835d0c5401a6d6ca8966f2bf442c2312870ba623f95c7e0e6f7b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0607b7d8de7a5cbcdcc732ed71ec4fe209af797aa01ff71fd6de9597544e02dc
MD5 46e7d5e0126eac7c3e07abe042597609
BLAKE2b-256 cd8c0e968ca42c5c34601fa82daf146fc38ef80c6229578a404ba7e69b00eeaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 308d07fd53acdab936467f70fec1d963ec61a40172cc64c2bf20caa952891666
MD5 7cf053e5b4bdafb0ecdde07ab14bb61d
BLAKE2b-256 bce9eede4b0dd9e610b992f026b22c2764ed087db23de36d6c913984c7b1ee11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 1692023d7c27dc6cd3761a4e0f8e08e3c00fe074fab9d7fd810509561511c85f
MD5 0f7866238484e459096b66d8318a9f80
BLAKE2b-256 4c2725d1682a4ad6416377a5207e3787142b18bf6b32256dd4c6fe7c8130b30a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c22ca827c6fb280afa4f73e0ab01084a5be412deba17aa1c2bb88b5cb0e5f04a
MD5 c45bf6297dd0ce01c1f18adbf9a52294
BLAKE2b-256 ac8db9c0fe93c80458f534bff38a6ef4ae27deef14e1f15e8ee2c622ea11dac4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4aa98cec1ad39279b8962d75170ba4ff7c4d94a4a0e71148de10e6630153fcc8
MD5 997026f2054ecbc48de2294092610e6c
BLAKE2b-256 8d013dcb26b73afd9667b8db230922e8984e418812350f93ac12fe76f05dc862

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c96f131076c245edcabf63f0bb15e5eab34f8adecc4d51a7889d6b751e3d952b
MD5 49efe3522f211270095ed94839d9f862
BLAKE2b-256 e880b897e23dc0a2ed3786ec424c1cc51fb8c98cc6c06e26810ad214d1e9d4a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp311-cp311-macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 10605949ffd5bc026b44a918c9f8daa447140151de9a0e0b24196a6f7ad575d4
MD5 8c38744bfb7970e32b2cfc491a0970b2
BLAKE2b-256 dc98e00fb954f6a407286d438f4aa162bd9f5e16b61fbfd0225466122db041c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d2337a10ffef3a127a5f3e1348d384d49bf9abcb204820a9b78407d5105f6245
MD5 83a48b09f216678d87bb6c937b0b2840
BLAKE2b-256 8665282c258c474ec7fbb68686c80a22a73f83493af014f17a4ebddf2b45cf0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ecf4c6e63b2b5da7aba468a0c259222c3c4f75025d365784bcec1f129c2fe413
MD5 965010b984dd94b67cdbcde40a5a4761
BLAKE2b-256 1943bbf70d6d480c8cea7dba9cb4e6db85786bdb237a1537341fece0538940b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a0e8a5886b3b9451852d8e02b16c0cfb147dfba859430a5c7cedcbb0aacaf9a6
MD5 b86efac1ee32f2e288a15025e725362b
BLAKE2b-256 df56a90a4b4aa3bd9562ec15066dc721025b2d99fa8d10580ba0717b5a821d68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inscript_lang-3.9.6.10.16-cp310-cp310-macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 f46375dfefcbe394bc65926835002a15167f22ee7bc5baa9452172f48e5be34e
MD5 9350a2219c392990a88c447d6f285cdd
BLAKE2b-256 9c763b576194ceb172d9b68f3fa36d4898ffb765cae74c117f1c786c5881e6c6

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