knit_script.knit_script_interpreter.statements package
Submodules
- knit_script.knit_script_interpreter.statements.Assertion module
- knit_script.knit_script_interpreter.statements.Carriage_Pass_Specification module
Carriage_Pass_Specification
Carriage_Pass_Specification._source_statement
Carriage_Pass_Specification._to_sliders
Carriage_Pass_Specification._racking
Carriage_Pass_Specification._target_bed
Carriage_Pass_Specification._has_drops
Carriage_Pass_Specification._drop_pass
Carriage_Pass_Specification._needle_to_instruction
Carriage_Pass_Specification._direction
Carriage_Pass_Specification._instruction_types
Carriage_Pass_Specification._knitting_pass
Carriage_Pass_Specification._require_second
Carriage_Pass_Specification.__init__()
Carriage_Pass_Specification.write_knitout()
- knit_script.knit_script_interpreter.statements.Drop_Pass module
- knit_script.knit_script_interpreter.statements.Import_Statement module
- knit_script.knit_script_interpreter.statements.Print module
- knit_script.knit_script_interpreter.statements.Push_Statement module
- knit_script.knit_script_interpreter.statements.Statement module
- knit_script.knit_script_interpreter.statements.Swap_Statement module
- knit_script.knit_script_interpreter.statements.Variable_Declaration module
- knit_script.knit_script_interpreter.statements.With_Statement module
- knit_script.knit_script_interpreter.statements.assignment module
- knit_script.knit_script_interpreter.statements.branch_statements module
- knit_script.knit_script_interpreter.statements.carrier_statements module
- knit_script.knit_script_interpreter.statements.code_block_statements module
- knit_script.knit_script_interpreter.statements.control_loop_statements module
While_Statement
For_Each_Statement
For_Each_Statement._variables
For_Each_Statement.var_name
For_Each_Statement._iter_expression
For_Each_Statement._statement
For_Each_Statement.__init__()
For_Each_Statement.execute()
For_Each_Statement.__str__()
For_Each_Statement.__repr__()
For_Each_Statement.line_number
For_Each_Statement.location
- knit_script.knit_script_interpreter.statements.function_dec_statement module
Function_Signature
Function_Declaration
Function_Declaration._func_name
Function_Declaration._args
Function_Declaration._kwargs
Function_Declaration._body
Function_Declaration.__init__()
Function_Declaration.__str__()
Function_Declaration.__repr__()
Function_Declaration.execute()
Function_Declaration.line_number
Function_Declaration.location
- knit_script.knit_script_interpreter.statements.in_direction_statement module
- knit_script.knit_script_interpreter.statements.instruction_statements module
- knit_script.knit_script_interpreter.statements.return_statement module
- knit_script.knit_script_interpreter.statements.try_catch_statements module
- knit_script.knit_script_interpreter.statements.xfer_pass_statement module
Module contents
Knit Script Interpreter Statements Package
This package contains all statement types for the Knit Script interpreter. Statements are executable language constructs that perform actions or control program flow but do not return values (unlike expressions).
Statement Categories
- Core Language Statements:
Statement: Base class for all statements. Expression_Statement: Wrapper for evaluating expressions as statements. Code_Block: Executes multiple statements in a new scope.
- Assignment and Variables:
Assignment: Assigns values to variables in local or global scope. Variable_Declaration: Declares variables in current or global scope. With_Statement: Sets variables temporarily within a statement block.
- Control Flow:
If_Statement: Conditional execution with if-else branches. While_Statement: Loop execution while condition is true. For_Each_Statement: Iteration over iterable collections. Try_Catch_Statement: Exception handling with try-catch blocks.
- Function Management:
Function_Declaration: Declares user-defined functions. Function_Signature: Function object for parameter binding and execution. Return_Statement: Returns values from functions and exits function scope.
- Module System:
Import_Statement: Imports Python modules and knit script files.
- Machine Operations:
In_Direction_Statement: Executes needle instructions in specified direction. Carriage_Pass_Specification: Manages collections of needle operations. Drop_Pass: Specialized pass for dropping stitches. Push_Statement: Modifies layer positions of needles in stacking hierarchy. Swap_Statement: Swaps stitch layers between needles. Xfer_Pass_Statement: Executes transfer operations with racking control.
- Carrier and Yarn Management:
Cut_Statement: Cuts yarn carriers. Release_Statement: Releases yarn inserting hook. Remove_Statement: Removes carriers from bed without cutting.
- Output and Debugging:
Print: Prints to console and adds comments to knitout. Pause_Statement: Pauses machine execution. Assertion: Tests conditions with optional error messages.
Architecture
All statement classes inherit from the base Statement class and implement the execute() method to define their behavior. Statements operate within a Knit_Script_Context that provides access to: - Variable scopes (local, global, machine) - Machine state and operations - Knitout instruction generation - Parser and execution environment
The statement system integrates closely with the expression system, scope management, and machine simulation components.