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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inscript_lang-3.9.6.23.tar.gz.
File metadata
- Download URL: inscript_lang-3.9.6.23.tar.gz
- Upload date:
- Size: 326.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f74961e54296437ac3a73f8c349a82daf81d0363d9908f1fec11ca46a05081ce
|
|
| MD5 |
78738763ec0d91b909997efec52d2acc
|
|
| BLAKE2b-256 |
23d496c0b4e55de6f5cc1425c8eec5a095607ec57fac7af5bfc17ede5de60b3f
|
File details
Details for the file inscript_lang-3.9.6.23-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 679.9 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61ec4781dd2d3d31ff7a753e1c23e66c8b4aa38ec00a7b1e4ef07e97964fa8eb
|
|
| MD5 |
b8938aba11ac86c5d0ed45bf143fd214
|
|
| BLAKE2b-256 |
7ec01a7f226aa1661df0382a8c387e6b409b5dd41edcba14022f39799ba46478
|
File details
Details for the file inscript_lang-3.9.6.23-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 763.8 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26ba65c1db678d75eebc56653131852cd372bde42ad7ef3140509d375d01aa40
|
|
| MD5 |
587860d5d80539c8a80a9dc229c47390
|
|
| BLAKE2b-256 |
158e5b91c3269e3fce84b4227542acd5b9067d8965928f3f1a451ce23fb67c8e
|
File details
Details for the file inscript_lang-3.9.6.23-cp312-cp312-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp312-cp312-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 732.0 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ad958545b58742b020b0ac65f10c8c0e965649c266d3bd62dfc810dd7ca966c
|
|
| MD5 |
839d62c35a410f724898788f037d2bb2
|
|
| BLAKE2b-256 |
d8ec3a781cda88b905d16d71114d710ea7eb58a6eb79ca53af93c1f1706194bd
|
File details
Details for the file inscript_lang-3.9.6.23-cp312-cp312-macosx_10_13_universal2.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp312-cp312-macosx_10_13_universal2.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20bf59ae5e55229d7d7fd0b255273c5225391a837aa3098f8d0fa2b8f5cdf9b6
|
|
| MD5 |
01a9855256acb86b6c68825f3f02b6a0
|
|
| BLAKE2b-256 |
6579ed2848fafe469b51259b3a0c2d1b6cb519b381efe0ce089647822c95c93a
|
File details
Details for the file inscript_lang-3.9.6.23-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 676.4 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9d13d331dba549d250d26320d843affccee59f473f454a09f5e293cef70e2e6
|
|
| MD5 |
dd0a1c0e3ac3160f99b9b9e66965458f
|
|
| BLAKE2b-256 |
11a0eecd8fa26e615d76909c3b76d976c2c6ea9e4a189b49eb104fcd9ea735b0
|
File details
Details for the file inscript_lang-3.9.6.23-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 760.7 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a619158f24156e062591e3a6993384f6dab526ea974454eb9592710ce55cca6b
|
|
| MD5 |
7967abfb4f6ac3c637b7a0a979d6c4dc
|
|
| BLAKE2b-256 |
0c3a030534c632eaf9c463447a563eb2978dde4ac191f6ee19c5ec63e2afb63c
|
File details
Details for the file inscript_lang-3.9.6.23-cp311-cp311-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp311-cp311-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 730.6 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0138bd911fc96ff9aa5abfafc1aec8b22a2587b89097456181fd34428505e322
|
|
| MD5 |
81323df355d97ba003aedef190f84c68
|
|
| BLAKE2b-256 |
b51a7db23a9636d404141c39666ec91778c328fd9041e45ba9e93516bbcd7c27
|
File details
Details for the file inscript_lang-3.9.6.23-cp311-cp311-macosx_10_12_universal2.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp311-cp311-macosx_10_12_universal2.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, macOS 10.12+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd49d481e2ad9db5f2ca54dc551a4daec2ddf8028afac8cb0142719f653cd8a8
|
|
| MD5 |
cc959fe7fb17e7cb484b62659df0ec3b
|
|
| BLAKE2b-256 |
7395c036e41d02ad71f771c0bb4c8c5f86af94ab009eac60c23dc73ee4db2ea1
|
File details
Details for the file inscript_lang-3.9.6.23-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 676.6 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7895b7f18ddfd5a3f705828ead5e8f44c46893cdf00419509695ddbcf4c143d2
|
|
| MD5 |
24d8cdc6fbac9b9f4aeec0c4fd8035bb
|
|
| BLAKE2b-256 |
c644831178de84fe2935465eac0f3c29175af6a7413fd61e64349607dae2d561
|
File details
Details for the file inscript_lang-3.9.6.23-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 761.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acad943c9bb995620eec2801eab232a3052eda6bfd30401eb723a499cb50ee2b
|
|
| MD5 |
ec820e663d8606d31430100512afc9c4
|
|
| BLAKE2b-256 |
f4434f76053f09012965ef1cd1f1b97359ddbc30ab93422e6bca0e37e4360cd6
|
File details
Details for the file inscript_lang-3.9.6.23-cp310-cp310-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp310-cp310-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 730.8 kB
- Tags: CPython 3.10, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aac49d2ca368d95be59f7a2f0e69692690a8a40ffccfbfedb34cd656d0b9c166
|
|
| MD5 |
c0f76da9d5447b257590ac0cb45ae69d
|
|
| BLAKE2b-256 |
3ab6e6b3409f08d70eee4b15dcf14707aad7b4a79dcebefa184d2fe039751c6b
|
File details
Details for the file inscript_lang-3.9.6.23-cp310-cp310-macosx_10_12_universal2.whl.
File metadata
- Download URL: inscript_lang-3.9.6.23-cp310-cp310-macosx_10_12_universal2.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, macOS 10.12+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86540aa7d18ca8a79db9b34b4efd800f23fdd105dc2fc2b276742ac4585c83bf
|
|
| MD5 |
d94a725f87240a54d6d4a316eaafc56d
|
|
| BLAKE2b-256 |
ea3a0795ce02b0edc683426404006793c26e59043e36b8d6cdcacabc9336bbcf
|