# Fr
[](https://github.com/Omena0/fr/actions/workflows/publish.yaml)



Simple bytecode compiled C-style scripting language.
## Installation
```zsh
pip install frscript
```
## Features:
- Command line launcher (`fr`)
- **File and Socket I/O**. Low-level file operations and sockets.
- Python integration - You can use any Python libraries with Frscript.
- **Aggressive optimization**. Bytecode and AST optimizations, fused operations, fast C runtime. Stack-based VM.
## What's New
### In version 7B:
Bugfixes and performance.
- Fixed FUSED_LOAD_STORE and FUSED_STORE_LOAD instructions executing in pairs.
- Fixed SELECT instruction being incorrectly mapped.
- Added SELECT optimization for if-else statements that assign to the same variable
- SELECT instruction now automatically replaces simple if-else assignment patterns
- Optimizer detects and preserves side effects in conditional branches
### In version 7A:
General performance upgrade.
This version is ~10% faster than 6A.
- Added signature help for user-defined functions in VSCode extension
- Added float literal support to binary AST encoder/decoder
- Added function-scoped label resolution to prevent cross-function jump collisions
- Added SWITCH_JUMP_TABLE opcode with jump table optimization for switches with 5+ consecutive cases
- Added function-scoped label resolution to prevent cross-function jump collisions
- Added case body fusion pass for detecting similar labeled blocks
- Added parser support for all CMP_*_CONST and arithmetic float const instructions in C VM
- Added SWITCH_JUMP_TABLE opcode to VM instruction set
- Added parser for SWITCH_JUMP_TABLE with min/max bounds and label array
- Added label resolution for SWITCH_JUMP_TABLE jump tables
- Added warning when const functions contain non-evaluable builtins, automatically treating them as regular functions
- Implemented OP_LOAD2_MUL_F64 instruction for optimized float multiplication
- Implemented OP_SWITCH_JUMP_TABLE instruction for O(1) dense integer switch dispatch
- Implemented OP_MOD_CONST_I64 instruction for modulo with constant operand
- Implemented CMP_LT_CONST, CMP_GT_CONST, CMP_LE_CONST, CMP_GE_CONST, CMP_EQ_CONST, CMP_NE_CONST instructions & f64 variants
- Implemented ADD_CONST_F64, SUB_CONST_F64, MUL_CONST_F64, DIV_CONST_F64 VM instructions for optimized float arithmetic
- Implemented LOAD2_ADD_F64, LOAD2_SUB_F64, LOAD2_MUL_F64, LOAD2_DIV_F64 fused instructions for float operations
- Implemented SWITCH_JUMP_TABLE instruction for O(1) dense integer switch dispatch
- Implemented LIST_NEW_I64, LIST_NEW_F64, LIST_NEW_STR, and LIST_NEW_BOOL instructions
- Implemented cache_loaded_values optimization to detect duplicate LOAD instructions and use DUP
- Improved hover information to display properly formatted function signatures
- Increased VM bytecode buffer size from 4096 to 65536 characters to support long optimized list instructions
- Optimized switch case bodies by fusing similar LOAD/ADD_CONST/STORE patterns into single arithmetic expression
- Reduced switch statement overhead from 70+ instructions to ~12 instructions (83% reduction)
- Increased VM bytecode buffer size from 4096 to 65536 characters to support long optimized list instructions
- Constant list creation is now optimized to use only 1 instruction
- Fixed critical label scoping bug in C VM causing jumps to resolve to wrong function
- Fixed syntax highlighting for function parameter types using single-match pattern
- Fixed function parameter type checking to correctly identify parameter types within function bodies
- Fixed inlay hints showing parameter names in function definitions instead of just function calls
- Fixed import path in compiler.py (from optimizer -> from src.optimizer)
- Fixed ADD_CONST_I64 instruction not checking for integer overflow
- Fixed len() function evaluating at parse time instead of runtime
- Fixed the frscript extension type errors and highlighting
- Fixed type errors
### In Version 6D
Feature and bugfix update
- Added runtime error handling
- Added try-except statements.
- Added raise statement
- Added ExceptionHandler structure to VM with exception type, handler PC, and state snapshots
- Added float division by zero detection in DIV_F64 operation
- Added bytecode parsing for TRY_BEGIN "exc_type" label and TRY_END instructions
- Added tests for exception handling
- Added exception type detection from "[Type] message" format in C VM error handler
- Implemented exception handling with OP_TRY_BEGIN, OP_TRY_END, and OP_RAISE opcodes
- Implemented exception handler stack (MAX_EXCEPTION_HANDLERS = 64)
- Modified vm_runtime_error() to check for active exception handlers and jump to matching ones
- Fixed some errors not showing the correct line or char
- Fixed eval_expr not properly re-raising exceptions
- Fixed stack overflow in C VM caused by missing RETURN_VOID in void functions
- Fixed float division by zero detection in C VM
- Fixed test runner to properly handle exceptions vs partial output in C VM
### In Version 6A
Bugfixes.
- Fixed Python SyntaxError handling for unclosed strings in parser
The parser now properly catches and handles Python SyntaxErrors when parsing expressions with unclosed strings, providing better error messages.
- Improved error handling in expression parser
- Updated README with improved installation instructions
### In Version 5A
Debugging update
- Added comprehensive debugging support
You can now debug FRScript code with step-by-step execution, breakpoints, and detailed variable tracking.
The debug runtime provides execution tracing and improved error tracking for easier troubleshooting.
- Added debug runtime with step-by-step execution capabilities
- Enhanced parser with improved error tracking and debugging information
- Added breakpoint support in debug runtime
- Created chat application examples (client and server)
- Improved runtime with better variable tracking
- Added detailed execution tracing capabilities
- Reorganized test cases into categorized folders (assertions, control_flow, data_structures, data_types, expressions, functions, io, math, misc, operators, python_interop, runtime_errors, syntax_errors)
- Moved over 240 test files into organized directory structure
### In Version 4E
- Fixed C runtime Python object handling
- Improved optimizer for Python objects
- Enhanced test suite stability
### In Version 4D
- Added pyobj as type alias for pyobject
You can now use the shorter `pyobj` keyword instead of `pyobject` for Python object types.
- Created test cases for pyobj usage
- Updated examples to use shorter pyobj syntax
### In Version 4C
- Added 9 test cases for Python object setattr functionality
Comprehensive testing for setting Python object attributes from FRScript, covering all data types and edge cases.
- Tests cover: basic setattr, boolean, float, list, multiple attributes, multiple objects, nested attributes, overwrite, string values
### In Version 4B
- Fixed Python attribute access in both runtimes
- Added Python module function call support
You can now call Python module functions directly and access Python object methods from FRScript.
- Enhanced optimizer with 190+ lines of improvements
- Improved C VM with 1000+ lines of Python object handling
- Added method call statement support
- Enhanced compiler with better Python integration
### In Version 4A
- Full Python integration and interoperability
You can now use any Python libraries from FRScript! Import Python modules, create Python objects, call functions, and access attributes seamlessly.
Support for pyimport statements (basic, from, as) and pyobject types for wrapping Python objects.
Integration with Python standard library including datetime, pathlib, regex, StringIO, and collections.
- Added Python import support (pyimport, pyimport from, pyimport as)
- Implemented Python object (pyobject) type for wrapping Python objects
- Added Python function calling from FRScript
- Support for Python attribute access and method calls
- Created 53 Python interop test cases
- Enhanced compiler with 340+ lines of Python integration code
- Improved C VM with 430+ lines of Python support
- Added builtin functions for Python interop
- Support for Python class instantiation
- Python object comparison and collection support
- Integration with Python standard library (datetime, pathlib, regex, StringIO, collections)
- Created UI example using Python integration
- Enhanced parser with Python syntax support
- Improved runtime with Python object handling
- Updated README with Python integration examples
### In Version 3B
- Bugfixes for HTTP server
- Enhanced builtin functions
- Improved CLI functionality
- Fixed compiler edge cases
### In Version 3A
- Added HTTP server example with static file serving
Full-featured HTTP server implementation with routing, static file serving, and socket handling.
- Renamed all test files from .c to .fr extension
- Enhanced parser for better syntax handling
- Improved runtime with additional capabilities
- Added comprehensive HTTP routing example
### In Version 2B
- Added more I/O utility functions
Enhanced file I/O with sequential reads, write returns, and improved socket handling for multiple connections.
- Enhanced file operations with sequential reads and write returns
- Improved socket handling with multiple connections
- Updated C VM with 550+ lines of I/O improvements
- Enhanced builtin functions with 220+ lines of I/O code
- Improved compiler with better I/O bytecode generation
- Enhanced parser with 120+ lines of improvements
- Added var_in_function test case
### In Version 2A
- Added comprehensive file I/O support
Low-level file operations including read, write, append, and partial reads.
Socket I/O for network programming with client and server functionality.
- Implemented socket I/O for network programming
- Added file operations: read, write, append, partial reads
- Socket client and server functionality
- Added userdata support for custom data handling
- Enhanced C VM with 440+ lines of I/O code
- Added 290+ lines of builtin I/O functions
- Enhanced compiler with I/O bytecode generation
- Added 10 I/O test cases
### In Version A1
- Initial release of FRScript
A simple bytecode compiled C-style scripting language with Python runtime and C VM.
Full language support for variables, functions, control flow, data types, and operations.
- Complete Python runtime implementation (709 lines)
- C VM implementation with 3758 lines
- Parser with full language syntax support (1430 lines)
- Compiler with bytecode generation (1207 lines)
- Optimizer for code optimization (488 lines)
- Support for: variables, functions, control flow (if/else, for, while, switch), assertions
- String operations: concat, join, split, replace, upper, lower, strip
- List operations: indexing, assignment, length
- Math operations: abs, max, min, pow, expressions
- F-string support with expressions
- Struct/object support with nested structs
- Type conversions: int, float, bool, str
- Break and continue statements with level support
- Comprehensive error handling
- 101 initial test cases
- CLI with multiple execution modes (327 lines)
- Binary module for bytecode operations (160 lines)
- Builtin functions module (270 lines)
- Utility functions for runtime operations (265 lines)
- Test runner (250 lines)
- Complete README documentation
Raw data
{
"_id": null,
"home_page": null,
"name": "frscript",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.13",
"maintainer_email": null,
"keywords": "compiler, interpreter, scripting, bytecode, language",
"author": "Omena0",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/76/6e/3144575e7689253c5322fe36214ae46e6fef6350abc1db446c8c4e58d5ad/frscript-7.1.0.tar.gz",
"platform": null,
"description": "\n\n# Fr\n\n[](https://github.com/Omena0/fr/actions/workflows/publish.yaml)\n\n\n\n\nSimple bytecode compiled C-style scripting language.\n\n## Installation\n\n```zsh\npip install frscript\n```\n\n## Features:\n- Command line launcher (`fr`)\n- **File and Socket I/O**. Low-level file operations and sockets.\n- Python integration - You can use any Python libraries with Frscript.\n- **Aggressive optimization**. Bytecode and AST optimizations, fused operations, fast C runtime. Stack-based VM.\n\n\n## What's New\n\n### In version 7B:\nBugfixes and performance.\n\n- Fixed FUSED_LOAD_STORE and FUSED_STORE_LOAD instructions executing in pairs.\n- Fixed SELECT instruction being incorrectly mapped.\n- Added SELECT optimization for if-else statements that assign to the same variable\n- SELECT instruction now automatically replaces simple if-else assignment patterns\n- Optimizer detects and preserves side effects in conditional branches\n\n### In version 7A:\nGeneral performance upgrade.\n\nThis version is ~10% faster than 6A.\n\n- Added signature help for user-defined functions in VSCode extension\n- Added float literal support to binary AST encoder/decoder\n- Added function-scoped label resolution to prevent cross-function jump collisions\n- Added SWITCH_JUMP_TABLE opcode with jump table optimization for switches with 5+ consecutive cases\n- Added function-scoped label resolution to prevent cross-function jump collisions\n- Added case body fusion pass for detecting similar labeled blocks\n- Added parser support for all CMP_*_CONST and arithmetic float const instructions in C VM\n- Added SWITCH_JUMP_TABLE opcode to VM instruction set\n- Added parser for SWITCH_JUMP_TABLE with min/max bounds and label array\n- Added label resolution for SWITCH_JUMP_TABLE jump tables\n- Added warning when const functions contain non-evaluable builtins, automatically treating them as regular functions\n- Implemented OP_LOAD2_MUL_F64 instruction for optimized float multiplication\n- Implemented OP_SWITCH_JUMP_TABLE instruction for O(1) dense integer switch dispatch\n- Implemented OP_MOD_CONST_I64 instruction for modulo with constant operand\n- Implemented CMP_LT_CONST, CMP_GT_CONST, CMP_LE_CONST, CMP_GE_CONST, CMP_EQ_CONST, CMP_NE_CONST instructions & f64 variants\n- Implemented ADD_CONST_F64, SUB_CONST_F64, MUL_CONST_F64, DIV_CONST_F64 VM instructions for optimized float arithmetic\n- Implemented LOAD2_ADD_F64, LOAD2_SUB_F64, LOAD2_MUL_F64, LOAD2_DIV_F64 fused instructions for float operations\n- Implemented SWITCH_JUMP_TABLE instruction for O(1) dense integer switch dispatch\n- Implemented LIST_NEW_I64, LIST_NEW_F64, LIST_NEW_STR, and LIST_NEW_BOOL instructions\n- Implemented cache_loaded_values optimization to detect duplicate LOAD instructions and use DUP\n- Improved hover information to display properly formatted function signatures\n- Increased VM bytecode buffer size from 4096 to 65536 characters to support long optimized list instructions\n- Optimized switch case bodies by fusing similar LOAD/ADD_CONST/STORE patterns into single arithmetic expression\n- Reduced switch statement overhead from 70+ instructions to ~12 instructions (83% reduction)\n- Increased VM bytecode buffer size from 4096 to 65536 characters to support long optimized list instructions\n- Constant list creation is now optimized to use only 1 instruction\n- Fixed critical label scoping bug in C VM causing jumps to resolve to wrong function\n- Fixed syntax highlighting for function parameter types using single-match pattern\n- Fixed function parameter type checking to correctly identify parameter types within function bodies\n- Fixed inlay hints showing parameter names in function definitions instead of just function calls\n- Fixed import path in compiler.py (from optimizer -> from src.optimizer)\n- Fixed ADD_CONST_I64 instruction not checking for integer overflow\n- Fixed len() function evaluating at parse time instead of runtime\n- Fixed the frscript extension type errors and highlighting\n- Fixed type errors\n\n### In Version 6D\nFeature and bugfix update\n\n- Added runtime error handling\n- Added try-except statements.\n- Added raise statement\n- Added ExceptionHandler structure to VM with exception type, handler PC, and state snapshots\n- Added float division by zero detection in DIV_F64 operation\n- Added bytecode parsing for TRY_BEGIN \"exc_type\" label and TRY_END instructions\n- Added tests for exception handling\n- Added exception type detection from \"[Type] message\" format in C VM error handler\n- Implemented exception handling with OP_TRY_BEGIN, OP_TRY_END, and OP_RAISE opcodes\n- Implemented exception handler stack (MAX_EXCEPTION_HANDLERS = 64)\n- Modified vm_runtime_error() to check for active exception handlers and jump to matching ones\n- Fixed some errors not showing the correct line or char\n- Fixed eval_expr not properly re-raising exceptions\n- Fixed stack overflow in C VM caused by missing RETURN_VOID in void functions\n- Fixed float division by zero detection in C VM\n- Fixed test runner to properly handle exceptions vs partial output in C VM\n\n### In Version 6A\nBugfixes.\n\n- Fixed Python SyntaxError handling for unclosed strings in parser\n\n The parser now properly catches and handles Python SyntaxErrors when parsing expressions with unclosed strings, providing better error messages.\n\n- Improved error handling in expression parser\n- Updated README with improved installation instructions\n\n### In Version 5A\nDebugging update\n\n- Added comprehensive debugging support\n\n You can now debug FRScript code with step-by-step execution, breakpoints, and detailed variable tracking.\n The debug runtime provides execution tracing and improved error tracking for easier troubleshooting.\n\n- Added debug runtime with step-by-step execution capabilities\n- Enhanced parser with improved error tracking and debugging information\n- Added breakpoint support in debug runtime\n- Created chat application examples (client and server)\n- Improved runtime with better variable tracking\n- Added detailed execution tracing capabilities\n- Reorganized test cases into categorized folders (assertions, control_flow, data_structures, data_types, expressions, functions, io, math, misc, operators, python_interop, runtime_errors, syntax_errors)\n- Moved over 240 test files into organized directory structure\n\n### In Version 4E\n- Fixed C runtime Python object handling\n- Improved optimizer for Python objects\n- Enhanced test suite stability\n\n### In Version 4D\n- Added pyobj as type alias for pyobject\n\n You can now use the shorter `pyobj` keyword instead of `pyobject` for Python object types.\n\n- Created test cases for pyobj usage\n- Updated examples to use shorter pyobj syntax\n\n### In Version 4C\n- Added 9 test cases for Python object setattr functionality\n\n Comprehensive testing for setting Python object attributes from FRScript, covering all data types and edge cases.\n\n- Tests cover: basic setattr, boolean, float, list, multiple attributes, multiple objects, nested attributes, overwrite, string values\n\n### In Version 4B\n- Fixed Python attribute access in both runtimes\n- Added Python module function call support\n\n You can now call Python module functions directly and access Python object methods from FRScript.\n\n- Enhanced optimizer with 190+ lines of improvements\n- Improved C VM with 1000+ lines of Python object handling\n- Added method call statement support\n- Enhanced compiler with better Python integration\n\n### In Version 4A\n- Full Python integration and interoperability\n\n You can now use any Python libraries from FRScript! Import Python modules, create Python objects, call functions, and access attributes seamlessly.\n Support for pyimport statements (basic, from, as) and pyobject types for wrapping Python objects.\n Integration with Python standard library including datetime, pathlib, regex, StringIO, and collections.\n\n- Added Python import support (pyimport, pyimport from, pyimport as)\n- Implemented Python object (pyobject) type for wrapping Python objects\n- Added Python function calling from FRScript\n- Support for Python attribute access and method calls\n- Created 53 Python interop test cases\n- Enhanced compiler with 340+ lines of Python integration code\n- Improved C VM with 430+ lines of Python support\n- Added builtin functions for Python interop\n- Support for Python class instantiation\n- Python object comparison and collection support\n- Integration with Python standard library (datetime, pathlib, regex, StringIO, collections)\n- Created UI example using Python integration\n- Enhanced parser with Python syntax support\n- Improved runtime with Python object handling\n- Updated README with Python integration examples\n\n### In Version 3B\n- Bugfixes for HTTP server\n- Enhanced builtin functions\n- Improved CLI functionality\n- Fixed compiler edge cases\n\n### In Version 3A\n- Added HTTP server example with static file serving\n\n Full-featured HTTP server implementation with routing, static file serving, and socket handling.\n\n- Renamed all test files from .c to .fr extension\n- Enhanced parser for better syntax handling\n- Improved runtime with additional capabilities\n- Added comprehensive HTTP routing example\n\n### In Version 2B\n- Added more I/O utility functions\n\n Enhanced file I/O with sequential reads, write returns, and improved socket handling for multiple connections.\n\n- Enhanced file operations with sequential reads and write returns\n- Improved socket handling with multiple connections\n- Updated C VM with 550+ lines of I/O improvements\n- Enhanced builtin functions with 220+ lines of I/O code\n- Improved compiler with better I/O bytecode generation\n- Enhanced parser with 120+ lines of improvements\n- Added var_in_function test case\n\n### In Version 2A\n- Added comprehensive file I/O support\n\n Low-level file operations including read, write, append, and partial reads.\n Socket I/O for network programming with client and server functionality.\n\n- Implemented socket I/O for network programming\n- Added file operations: read, write, append, partial reads\n- Socket client and server functionality\n- Added userdata support for custom data handling\n- Enhanced C VM with 440+ lines of I/O code\n- Added 290+ lines of builtin I/O functions\n- Enhanced compiler with I/O bytecode generation\n- Added 10 I/O test cases\n\n### In Version A1\n- Initial release of FRScript\n\n A simple bytecode compiled C-style scripting language with Python runtime and C VM.\n Full language support for variables, functions, control flow, data types, and operations.\n\n- Complete Python runtime implementation (709 lines)\n- C VM implementation with 3758 lines\n- Parser with full language syntax support (1430 lines)\n- Compiler with bytecode generation (1207 lines)\n- Optimizer for code optimization (488 lines)\n- Support for: variables, functions, control flow (if/else, for, while, switch), assertions\n- String operations: concat, join, split, replace, upper, lower, strip\n- List operations: indexing, assignment, length\n- Math operations: abs, max, min, pow, expressions\n- F-string support with expressions\n- Struct/object support with nested structs\n- Type conversions: int, float, bool, str\n- Break and continue statements with level support\n- Comprehensive error handling\n- 101 initial test cases\n- CLI with multiple execution modes (327 lines)\n- Binary module for bytecode operations (160 lines)\n- Builtin functions module (270 lines)\n- Utility functions for runtime operations (265 lines)\n- Test runner (250 lines)\n- Complete README documentation\n\n",
"bugtrack_url": null,
"license": "PolyForm Noncommercial License 1.0.0",
"summary": "Simple bytecode compiled C-style scripting language",
"version": "7.1.0",
"project_urls": {
"Bug Reports": "https://github.com/Omena0/fr/issues",
"Source": "https://github.com/Omena0/fr"
},
"split_keywords": [
"compiler",
" interpreter",
" scripting",
" bytecode",
" language"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "222a05237c600b33dd8a09c0811c7623234f543813b589e5bc872b7bd0a218b9",
"md5": "8b399e16ef32de38305a52c141d62d5b",
"sha256": "9ed358c620638f54706e4f7a791e1845132eef6bdf7b517f3d864d3f38778b7c"
},
"downloads": -1,
"filename": "frscript-7.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8b399e16ef32de38305a52c141d62d5b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.13",
"size": 119763,
"upload_time": "2025-10-10T11:38:47",
"upload_time_iso_8601": "2025-10-10T11:38:47.214358Z",
"url": "https://files.pythonhosted.org/packages/22/2a/05237c600b33dd8a09c0811c7623234f543813b589e5bc872b7bd0a218b9/frscript-7.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "766e3144575e7689253c5322fe36214ae46e6fef6350abc1db446c8c4e58d5ad",
"md5": "dca2fc81e44e73cb89496638c3865c8e",
"sha256": "8286b8db59a98304aca5c5cb2e733d230cbe0b1e0202deaf3dcec01a21e991e0"
},
"downloads": -1,
"filename": "frscript-7.1.0.tar.gz",
"has_sig": false,
"md5_digest": "dca2fc81e44e73cb89496638c3865c8e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.13",
"size": 155695,
"upload_time": "2025-10-10T11:38:48",
"upload_time_iso_8601": "2025-10-10T11:38:48.732414Z",
"url": "https://files.pythonhosted.org/packages/76/6e/3144575e7689253c5322fe36214ae46e6fef6350abc1db446c8c4e58d5ad/frscript-7.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-10 11:38:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Omena0",
"github_project": "fr",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "setuptools",
"specs": []
},
{
"name": "zstd",
"specs": []
}
],
"lcname": "frscript"
}