PL1CompInPy API Reference

This file is generated from the Python source tree. Regenerate it with python scripts/generate_api_docs.py.

Summary

pl1compinpy

Source: pl1compinpy/__init__.py

PL1CompInPy: a Python-based PL/1 compiler project.

pl1compinpy.__main__

Source: pl1compinpy/__main__.py

Module containing main support for the PL/I compiler.

pl1compinpy.ast

Source: pl1compinpy/ast.py

Compatibility wrapper for the core AST package.

pl1compinpy.builtins

Source: pl1compinpy/builtins/__init__.py

PL/I builtin source management.

pl1compinpy.builtins.loader

Source: pl1compinpy/builtins/loader.py

Module containing loader support for the PL/I compiler.

Classes

BuiltinError

class BuiltinError(ValueError)

Exception type raised for builtin errors.

Defined at line 7.

BuiltinLibrary

class BuiltinLibrary

Data container describing builtin library values used by the compiler.

Defined at line 12.

Methods:

BuiltinLibrary.source
def source(self, name: str) -> str

Performs source behavior in BuiltinLibrary.

Defined at line 15.

BuiltinLibrary.include
def include(self, names: list[str]) -> str

Performs include behavior in BuiltinLibrary.

Defined at line 21.

Functions

include_builtins

def include_builtins(source: str, names: list[str] | None = None) -> str

Performs include builtins behavior in pl1compinpy.builtins.loader.

Defined at line 25.

pl1compinpy.builtins.pl1

Source: pl1compinpy/builtins/pl1/__init__.py

Packaged PL/I builtin source files.

pl1compinpy.cli

Source: pl1compinpy/cli.py

Module containing cli support for the PL/I compiler.

Functions

build_parser

def build_parser() -> argparse.ArgumentParser

Performs build parser behavior in pl1compinpy.cli.

Defined at line 9.

main

def main(argv: list[str] | None = None) -> int

Performs main behavior in pl1compinpy.cli.

Defined at line 43.

pl1compinpy.codegen

Source: pl1compinpy/codegen/__init__.py

Assembly, executable lowering, and binary container generation.

Functions

emit_code

def emit_code(program, target: str) -> str

Emits code output for the compiler.

Defined at line 15.

pl1compinpy.codegen.backends

Source: pl1compinpy/codegen/backends.py

Module containing backends support for the PL/I compiler.

Classes

AssemblyTarget

class AssemblyTarget

Data container describing assembly target values used by the compiler.

Defined at line 26.

BackendError

class BackendError(ValueError)

Exception type raised for backend errors.

Defined at line 49.

SymbolTable

class SymbolTable

Data container describing symbol table values used by the compiler.

Defined at line 67.

Methods:

SymbolTable.add_string
def add_string(self, value: str) -> str

Performs add string behavior in SymbolTable.

Defined at line 72.

AssemblyEmitter

class AssemblyEmitter

Class implementing assembly emitter behavior in the PL/I compiler.

Defined at line 79.

Methods:

AssemblyEmitter.__init__
def __init__(self, target: AssemblyTarget) -> None

Initializes an instance of AssemblyEmitter.

Defined at line 80.

AssemblyEmitter._collect_symbols
def _collect_symbols(self, program: Program) -> None

Internal helper in AssemblyEmitter for collect symbols.

Defined at line 86.

AssemblyEmitter._collect_statement
def _collect_statement(self, statement: Statement) -> None

Internal helper in AssemblyEmitter for collect statement.

Defined at line 90.

AssemblyEmitter._collect_expression
def _collect_expression(self, expression: Expression) -> None

Internal helper in AssemblyEmitter for collect expression.

Defined at line 117.

AssemblyEmitter._new_label
def _new_label(self, stem: str) -> str

Internal helper in AssemblyEmitter for new label.

Defined at line 126.

AssemblyEmitter._symbol
def _symbol(self, name: str) -> str

Internal helper in AssemblyEmitter for symbol.

Defined at line 131.

AssemblyEmitter._runtime_symbol
def _runtime_symbol(self, name: str) -> str

Internal helper in AssemblyEmitter for runtime symbol.

Defined at line 134.

AssemblyEmitter._runtime_externs
def _runtime_externs(self) -> list[str]

Internal helper in AssemblyEmitter for runtime externs.

Defined at line 137.

AssemblyEmitter._runtime_link_comments
def _runtime_link_comments(self, comment: str) -> list[str]

Internal helper in AssemblyEmitter for runtime link comments.

Defined at line 140.

AssemblyEmitter._escaped_bytes
def _escaped_bytes(self, value: str) -> str

Internal helper in AssemblyEmitter for escaped bytes.

Defined at line 150.

AssemblyEmitter._condition_jump
def _condition_jump(self, operator: str, if_false: bool) -> str

Internal helper in AssemblyEmitter for condition jump.

Defined at line 154.

AssemblyEmitter._raw_put_arguments
def _raw_put_arguments(self, statement: RawStatement) -> list[Expression]

Internal helper in AssemblyEmitter for raw put arguments.

Defined at line 166.

X586AssemblyEmitter

class X586AssemblyEmitter(AssemblyEmitter)

Class implementing x586 assembly emitter behavior in the PL/I compiler.

Defined at line 183.

Methods:

X586AssemblyEmitter.emit
def emit(self, program: Program) -> str

Performs emit behavior in X586AssemblyEmitter.

Defined at line 184.

X586AssemblyEmitter._statement
def _statement(self, statement: Statement) -> list[str]

Internal helper in X586AssemblyEmitter for statement.

Defined at line 208.

X586AssemblyEmitter._if
def _if(self, statement: IfStatement) -> list[str]

Internal helper in X586AssemblyEmitter for if.

Defined at line 241.

X586AssemblyEmitter._call
def _call(self, statement: Call) -> list[str]

Internal helper in X586AssemblyEmitter for call.

Defined at line 253.

X586AssemblyEmitter._print_arguments
def _print_arguments(self, arguments: list[Expression]) -> list[str]

Internal helper in X586AssemblyEmitter for print arguments.

Defined at line 265.

X586AssemblyEmitter._comparison
def _comparison(self, expression: Expression, false_label: str) -> list[str]

Internal helper in X586AssemblyEmitter for comparison.

Defined at line 276.

X586AssemblyEmitter._expression
def _expression(self, expression: Expression) -> list[str]

Internal helper in X586AssemblyEmitter for expression.

Defined at line 288.

X8664AssemblyEmitter

class X8664AssemblyEmitter(AssemblyEmitter)

Class implementing x8664 assembly emitter behavior in the PL/I compiler.

Defined at line 314.

Methods:

X8664AssemblyEmitter.emit
def emit(self, program: Program) -> str

Performs emit behavior in X8664AssemblyEmitter.

Defined at line 315.

X8664AssemblyEmitter._statement
def _statement(self, statement: Statement) -> list[str]

Internal helper in X8664AssemblyEmitter for statement.

Defined at line 341.

X8664AssemblyEmitter._if
def _if(self, statement: IfStatement) -> list[str]

Internal helper in X8664AssemblyEmitter for if.

Defined at line 374.

X8664AssemblyEmitter._call
def _call(self, statement: Call) -> list[str]

Internal helper in X8664AssemblyEmitter for call.

Defined at line 386.

X8664AssemblyEmitter._print_arguments
def _print_arguments(self, arguments: list[Expression]) -> list[str]

Internal helper in X8664AssemblyEmitter for print arguments.

Defined at line 398.

X8664AssemblyEmitter._comparison
def _comparison(self, expression: Expression, false_label: str) -> list[str]

Internal helper in X8664AssemblyEmitter for comparison.

Defined at line 425.

X8664AssemblyEmitter._expression
def _expression(self, expression: Expression) -> list[str]

Internal helper in X8664AssemblyEmitter for expression.

Defined at line 437.

Arm64AssemblyEmitter

class Arm64AssemblyEmitter(AssemblyEmitter)

Class implementing arm64 assembly emitter behavior in the PL/I compiler.

Defined at line 463.

Methods:

Arm64AssemblyEmitter.emit
def emit(self, program: Program) -> str

Performs emit behavior in Arm64AssemblyEmitter.

Defined at line 464.

Arm64AssemblyEmitter._statement
def _statement(self, statement: Statement) -> list[str]

Internal helper in Arm64AssemblyEmitter for statement.

Defined at line 492.

Arm64AssemblyEmitter._if
def _if(self, statement: IfStatement) -> list[str]

Internal helper in Arm64AssemblyEmitter for if.

Defined at line 525.

Arm64AssemblyEmitter._call
def _call(self, statement: Call) -> list[str]

Internal helper in Arm64AssemblyEmitter for call.

Defined at line 537.

Arm64AssemblyEmitter._print_arguments
def _print_arguments(self, arguments: list[Expression]) -> list[str]

Internal helper in Arm64AssemblyEmitter for print arguments.

Defined at line 547.

Arm64AssemblyEmitter._comparison
def _comparison(self, expression: Expression, false_label: str) -> list[str]

Internal helper in Arm64AssemblyEmitter for comparison.

Defined at line 573.

Arm64AssemblyEmitter._expression
def _expression(self, expression: Expression) -> list[str]

Internal helper in Arm64AssemblyEmitter for expression.

Defined at line 594.

Arm64AssemblyEmitter._escape_asciz
def _escape_asciz(self, value: str) -> str

Internal helper in Arm64AssemblyEmitter for escape asciz.

Defined at line 619.

Functions

emit_assembly

def emit_assembly(program: Program, target_name: str) -> str

Emits assembly output for the compiler.

Defined at line 53.

pl1compinpy.codegen.binary_formats

Source: pl1compinpy/codegen/binary_formats.py

Module containing binary formats support for the PL/I compiler.

Classes

BinaryFormatError

class BinaryFormatError(ValueError)

Exception type raised for binary format errors.

Defined at line 9.

Functions

emit_binary

def emit_binary(format_name: str, program: Program | None = None) -> bytes

Emits binary output for the compiler.

Defined at line 23.

_align

def _align(value: int, alignment: int) -> int

Internal helper in pl1compinpy.codegen.binary_formats for align.

Defined at line 39.

_pe32_x586_windows

def _pe32_x586_windows(program: Program | None = None) -> bytes

Internal helper in pl1compinpy.codegen.binary_formats for pe32 x586 windows.

Defined at line 43.

_pe64_x86_64_windows

def _pe64_x86_64_windows(program: Program | None = None) -> bytes

Internal helper in pl1compinpy.codegen.binary_formats for pe64 x86 64 windows.

Defined at line 129.

_elf64_x86_64

def _elf64_x86_64(program: Program | None = None) -> bytes

Internal helper in pl1compinpy.codegen.binary_formats for elf64 x86 64.

Defined at line 214.

_elf64_aarch64

def _elf64_aarch64(program: Program | None = None) -> bytes

Internal helper in pl1compinpy.codegen.binary_formats for elf64 aarch64.

Defined at line 221.

_elf64

def _elf64(machine: int, code: bytes, data: bytes = b'') -> bytes

Internal helper in pl1compinpy.codegen.binary_formats for elf64.

Defined at line 232.

_macho64_x86_64_macos

def _macho64_x86_64_macos(program: Program | None = None) -> bytes

Internal helper in pl1compinpy.codegen.binary_formats for macho64 x86 64 macos.

Defined at line 273.

_macho64_arm64_macos

def _macho64_arm64_macos(program: Program | None = None) -> bytes

Internal helper in pl1compinpy.codegen.binary_formats for macho64 arm64 macos.

Defined at line 280.

_macho64

def _macho64(cpu_type: int, cpu_subtype: int, code: bytes, data: bytes = b'') -> bytes

Internal helper in pl1compinpy.codegen.binary_formats for macho64.

Defined at line 287.

_segment_command

def _segment_command(name: str, vmaddr: int, vmsize: int, fileoff: int, filesize: int, maxprot: int, initprot: int) -> bytes

Internal helper in pl1compinpy.codegen.binary_formats for segment command.

Defined at line 318.

pl1compinpy.codegen.dotnet_executable

Source: pl1compinpy/codegen/dotnet_executable.py

Module containing dotnet executable support for the PL/I compiler.

Classes

DotNetExecutableError

class DotNetExecutableError(RuntimeError)

Exception type raised for dot net executable errors.

Defined at line 12.

Functions

emit_dotnet_executable

def emit_dotnet_executable(program: Program, output: Path, ilasm: str | None = None) -> Path

Emits dotnet executable output for the compiler.

Defined at line 16.

pl1compinpy.codegen.dotnet_il

Source: pl1compinpy/codegen/dotnet_il.py

Module containing dotnet il support for the PL/I compiler.

Classes

DotNetILEmitter

class DotNetILEmitter

Class implementing dot net ilemitter behavior in the PL/I compiler.

Defined at line 7.

Methods:

DotNetILEmitter.emit
def emit(self, program: Program) -> str

Performs emit behavior in DotNetILEmitter.

Defined at line 8.

DotNetILEmitter._procedure
def _procedure(self, name: str, procedure: Procedure) -> list[str]

Internal helper in DotNetILEmitter for procedure.

Defined at line 54.

DotNetILEmitter._entrypoint_call
def _entrypoint_call(self, procedure_name: str, returns: bool) -> list[str]

Internal helper in DotNetILEmitter for entrypoint call.

Defined at line 82.

DotNetILEmitter._entrypoint_body
def _entrypoint_body(self, statements: list[object]) -> list[str]

Internal helper in DotNetILEmitter for entrypoint body.

Defined at line 97.

DotNetILEmitter._statement
def _statement(self, statement: object, locals_map: dict[str, int], local_types: list[str]) -> list[str]

Internal helper in DotNetILEmitter for statement.

Defined at line 116.

DotNetILEmitter._expression
def _expression(self, expression: object, locals_map: dict[str, int], local_types: list[str]) -> list[str]

Internal helper in DotNetILEmitter for expression.

Defined at line 138.

DotNetILEmitter._call
def _call(self, call: Call, locals_map: dict[str, int], local_types: list[str]) -> list[str]

Internal helper in DotNetILEmitter for call.

Defined at line 150.

DotNetILEmitter._local
def _local(self, name: str, locals_map: dict[str, int], local_types: list[str]) -> int

Internal helper in DotNetILEmitter for local.

Defined at line 167.

DotNetILEmitter._int_constant
def _int_constant(self, value: int) -> list[str]

Internal helper in DotNetILEmitter for int constant.

Defined at line 173.

DotNetILEmitter._main_name
def _main_name(self, program: Program) -> str | None

Internal helper in DotNetILEmitter for main name.

Defined at line 182.

DotNetILEmitter._quote
def _quote(self, value: str) -> str

Internal helper in DotNetILEmitter for quote.

Defined at line 189.

Functions

emit_dotnet_il

def emit_dotnet_il(program: Program) -> str

Emits dotnet il output for the compiler.

Defined at line 194.

pl1compinpy.codegen.executable_pipeline

Source: pl1compinpy/codegen/executable_pipeline.py

Module containing executable pipeline support for the PL/I compiler.

Classes

Mnemonic

class Mnemonic

Data container describing mnemonic values used by the compiler.

Defined at line 26.

ExecutableImage

class ExecutableImage

Data container describing executable image values used by the compiler.

Defined at line 32.

LoweringContext

class LoweringContext

Data container describing lowering context values used by the compiler.

Defined at line 38.

Methods:

LoweringContext.variable
def variable(self, name: str) -> int

Performs variable behavior in LoweringContext.

Defined at line 46.

LoweringContext.local
def local(self, name: str) -> int

Performs local behavior in LoweringContext.

Defined at line 52.

LoweringContext.local_bytes
def local_bytes(self) -> int

Performs local bytes behavior in LoweringContext.

Defined at line 60.

LoweringContext.is_local
def is_local(self, name: str) -> bool

Performs is local behavior in LoweringContext.

Defined at line 63.

LoweringContext.is_parameter
def is_parameter(self, name: str) -> bool

Performs is parameter behavior in LoweringContext.

Defined at line 66.

LoweringContext.stack_offset
def stack_offset(self, name: str) -> int

Performs stack offset behavior in LoweringContext.

Defined at line 69.

LoweringContext.string
def string(self, value: str) -> tuple[int, int]

Performs string behavior in LoweringContext.

Defined at line 76.

LoweringContext.label
def label(self, stem: str) -> str

Performs label behavior in LoweringContext.

Defined at line 82.

X586MnemonicAssembler

class X586MnemonicAssembler

Class implementing x586 mnemonic assembler behavior in the PL/I compiler.

Defined at line 335.

Methods:

X586MnemonicAssembler.__init__
def __init__(self, image_base: int, code_rva: int, data: bytes, variables: dict[str, int]) -> None

Initializes an instance of X586MnemonicAssembler.

Defined at line 336.

X586MnemonicAssembler.assemble
def assemble(self, mnemonics: list[Mnemonic]) -> bytes

Performs assemble behavior in X586MnemonicAssembler.

Defined at line 343.

X586MnemonicAssembler._var_addr
def _var_addr(self, name: str) -> int

Internal helper in X586MnemonicAssembler for var addr.

Defined at line 351.

X586MnemonicAssembler._data_addr
def _data_addr(self, offset: int) -> int

Internal helper in X586MnemonicAssembler for data addr.

Defined at line 354.

X586MnemonicAssembler._code_size
def _code_size(self, mnemonics: list[Mnemonic]) -> int

Internal helper in X586MnemonicAssembler for code size.

Defined at line 357.

X586MnemonicAssembler._label_offsets
def _label_offsets(self, mnemonics: list[Mnemonic]) -> dict[str, int]

Internal helper in X586MnemonicAssembler for label offsets.

Defined at line 360.

X586MnemonicAssembler._size
def _size(self, mnemonic: Mnemonic) -> int

Internal helper in X586MnemonicAssembler for size.

Defined at line 369.

X586MnemonicAssembler._encode
def _encode(self, mnemonic: Mnemonic, offset: int, labels: dict[str, int]) -> bytes

Internal helper in X586MnemonicAssembler for encode.

Defined at line 405.

X586MnemonicAssembler._jfalse_opcode
def _jfalse_opcode(self, operator: str) -> bytes

Internal helper in X586MnemonicAssembler for jfalse opcode.

Defined at line 474.

X8664MnemonicAssembler

class X8664MnemonicAssembler

Class implementing x8664 mnemonic assembler behavior in the PL/I compiler.

Defined at line 486.

Methods:

X8664MnemonicAssembler.__init__
def __init__(self, image_base: int, code_rva: int, data: bytes, variables: dict[str, int], macos: bool = False, windows: bool = False) -> None

Initializes an instance of X8664MnemonicAssembler.

Defined at line 487.

X8664MnemonicAssembler.assemble
def assemble(self, mnemonics: list[Mnemonic]) -> bytes

Performs assemble behavior in X8664MnemonicAssembler.

Defined at line 495.

Arm64MnemonicAssembler

class Arm64MnemonicAssembler

Class implementing arm64 mnemonic assembler behavior in the PL/I compiler.

Defined at line 517.

Methods:

Arm64MnemonicAssembler.__init__
def __init__(self, macos: bool = False) -> None

Initializes an instance of Arm64MnemonicAssembler.

Defined at line 518.

Arm64MnemonicAssembler.assemble
def assemble(self, mnemonics: list[Mnemonic]) -> bytes

Performs assemble behavior in Arm64MnemonicAssembler.

Defined at line 521.

Arm64MnemonicAssembler._mov_w0_imm
def _mov_w0_imm(self, value: int) -> bytes

Internal helper in Arm64MnemonicAssembler for mov w0 imm.

Defined at line 534.

Arm64MnemonicAssembler._mov_x16_or_x8
def _mov_x16_or_x8(self, value: int) -> bytes

Internal helper in Arm64MnemonicAssembler for mov x16 or x8.

Defined at line 539.

Functions

lower_program

def lower_program(program: Program) -> tuple[list[Mnemonic], bytes, dict[str, int]]

Performs lower program behavior in pl1compinpy.codegen.executable_pipeline.

Defined at line 88.

assemble_executable

def assemble_executable(program: Program, binary_format: str, *, image_base: int = 4194304, code_rva: int = 4096) -> ExecutableImage

Performs assemble executable behavior in pl1compinpy.codegen.executable_pipeline.

Defined at line 114.

_collect_data

def _collect_data(statement: Statement, context: LoweringContext) -> None

Internal helper in pl1compinpy.codegen.executable_pipeline for collect data.

Defined at line 136.

_collect_expression_data

def _collect_expression_data(expression: Expression, context: LoweringContext) -> None

Internal helper in pl1compinpy.codegen.executable_pipeline for collect expression data.

Defined at line 157.

_is_procedure_definition

def _is_procedure_definition(statement: Statement) -> bool

Internal helper in pl1compinpy.codegen.executable_pipeline for is procedure definition.

Defined at line 167.

_main_procedure_name

def _main_procedure_name(program: Program) -> str | None

Internal helper in pl1compinpy.codegen.executable_pipeline for main procedure name.

Defined at line 173.

_lower_statement

def _lower_statement(statement: Statement, context: LoweringContext) -> list[Mnemonic]

Internal helper in pl1compinpy.codegen.executable_pipeline for lower statement.

Defined at line 181.

_lower_procedure

def _lower_procedure(procedure: Procedure, context: LoweringContext) -> list[Mnemonic]

Internal helper in pl1compinpy.codegen.executable_pipeline for lower procedure.

Defined at line 230.

_lower_call

def _lower_call(call: Call, context: LoweringContext) -> list[Mnemonic]

Internal helper in pl1compinpy.codegen.executable_pipeline for lower call.

Defined at line 250.

_lower_expression

def _lower_expression(expression: Expression, context: LoweringContext) -> list[Mnemonic]

Internal helper in pl1compinpy.codegen.executable_pipeline for lower expression.

Defined at line 264.

_lower_condition_false_jump

def _lower_condition_false_jump(expression: Expression, false_label: str, context: LoweringContext) -> list[Mnemonic]

Internal helper in pl1compinpy.codegen.executable_pipeline for lower condition false jump.

Defined at line 286.

_lower_display

def _lower_display(arguments: list[Expression], context: LoweringContext) -> list[Mnemonic]

Internal helper in pl1compinpy.codegen.executable_pipeline for lower display.

Defined at line 296.

_load_name

def _load_name(name: str, context: LoweringContext) -> Mnemonic

Internal helper in pl1compinpy.codegen.executable_pipeline for load name.

Defined at line 308.

_store_name

def _store_name(name: str, context: LoweringContext) -> Mnemonic

Internal helper in pl1compinpy.codegen.executable_pipeline for store name.

Defined at line 317.

_push_reference

def _push_reference(name: str, context: LoweringContext) -> Mnemonic

Internal helper in pl1compinpy.codegen.executable_pipeline for push reference.

Defined at line 326.

pl1compinpy.codegen.jvm_bytecode

Source: pl1compinpy/codegen/jvm_bytecode.py

Module containing jvm bytecode support for the PL/I compiler.

Classes

JVMBytecodeEmitter

class JVMBytecodeEmitter

Class implementing jvmbytecode emitter behavior in the PL/I compiler.

Defined at line 7.

Methods:

JVMBytecodeEmitter.emit
def emit(self, program: Program) -> str

Performs emit behavior in JVMBytecodeEmitter.

Defined at line 8.

JVMBytecodeEmitter._procedure
def _procedure(self, name: str, procedure: Procedure) -> list[str]

Internal helper in JVMBytecodeEmitter for procedure.

Defined at line 44.

JVMBytecodeEmitter._expression
def _expression(self, expression: object, locals_map: dict[str, int]) -> list[str]

Internal helper in JVMBytecodeEmitter for expression.

Defined at line 81.

JVMBytecodeEmitter._call
def _call(self, call: Call, locals_map: dict[str, int]) -> list[str]

Internal helper in JVMBytecodeEmitter for call.

Defined at line 100.

JVMBytecodeEmitter._int_constant
def _int_constant(self, value: int) -> list[str]

Internal helper in JVMBytecodeEmitter for int constant.

Defined at line 108.

JVMBytecodeEmitter._return_descriptor
def _return_descriptor(self, procedure: Procedure) -> str

Internal helper in JVMBytecodeEmitter for return descriptor.

Defined at line 117.

JVMBytecodeEmitter._main_name
def _main_name(self, program: Program) -> str | None

Internal helper in JVMBytecodeEmitter for main name.

Defined at line 120.

Functions

emit_jvm_bytecode

def emit_jvm_bytecode(program: Program) -> str

Emits jvm bytecode output for the compiler.

Defined at line 128.

pl1compinpy.codegen.jvm_classfile

Source: pl1compinpy/codegen/jvm_classfile.py

Module containing jvm classfile support for the PL/I compiler.

Classes

ConstantPool

class ConstantPool

Data container describing constant pool values used by the compiler.

Defined at line 14.

Methods:

ConstantPool.utf8
def utf8(self, value: str) -> int

Performs utf8 behavior in ConstantPool.

Defined at line 18.

ConstantPool.class_info
def class_info(self, name: str) -> int

Performs class info behavior in ConstantPool.

Defined at line 25.

ConstantPool.name_and_type
def name_and_type(self, name: str, descriptor: str) -> int

Performs name and type behavior in ConstantPool.

Defined at line 31.

ConstantPool.method_ref
def method_ref(self, owner: str, name: str, descriptor: str) -> int

Performs method ref behavior in ConstantPool.

Defined at line 37.

ConstantPool._add
def _add(self, entry: bytes) -> int

Internal helper in ConstantPool for add.

Defined at line 45.

ConstantPool.bytes
def bytes(self) -> bytes

Performs bytes behavior in ConstantPool.

Defined at line 49.

JVMProcedure

class JVMProcedure

Data container describing jvmprocedure values used by the compiler.

Defined at line 54.

Methods:

JVMProcedure.descriptor
def descriptor(self) -> str

Performs descriptor behavior in JVMProcedure.

Defined at line 63.

JVMClassFileEmitter

class JVMClassFileEmitter

Class implementing jvmclass file emitter behavior in the PL/I compiler.

Defined at line 67.

Methods:

JVMClassFileEmitter.emit
def emit(self, program: Program, class_name: str = 'PL1Program') -> bytes

Performs emit behavior in JVMClassFileEmitter.

Defined at line 68.

JVMClassFileEmitter._procedures
def _procedures(self, program: Program) -> list[JVMProcedure]

Internal helper in JVMClassFileEmitter for procedures.

Defined at line 118.

JVMClassFileEmitter._procedure
def _procedure(self, name: str, procedure: Procedure) -> JVMProcedure

Internal helper in JVMClassFileEmitter for procedure.

Defined at line 127.

JVMClassFileEmitter._return_value
def _return_value(self, statement: RawStatement, locals_map: dict[str, int]) -> bytes

Internal helper in JVMClassFileEmitter for return value.

Defined at line 157.

JVMClassFileEmitter._expression
def _expression(self, expression: object, locals_map: dict[str, int]) -> bytes

Internal helper in JVMClassFileEmitter for expression.

Defined at line 164.

JVMClassFileEmitter._constructor_code
def _constructor_code(self, pool: ConstantPool) -> bytes

Internal helper in JVMClassFileEmitter for constructor code.

Defined at line 174.

JVMClassFileEmitter._method
def _method(self, pool: ConstantPool, name: str, descriptor: str, code: bytes, max_stack: int, max_locals: int) -> bytes

Internal helper in JVMClassFileEmitter for method.

Defined at line 177.

JVMClassFileEmitter._iconst
def _iconst(self, value: int) -> bytes

Internal helper in JVMClassFileEmitter for iconst.

Defined at line 194.

JVMClassFileEmitter._iload
def _iload(self, index: int) -> bytes

Internal helper in JVMClassFileEmitter for iload.

Defined at line 203.

JVMClassFileEmitter._istore
def _istore(self, index: int) -> bytes

Internal helper in JVMClassFileEmitter for istore.

Defined at line 206.

JVMClassFileEmitter._main_name
def _main_name(self, program: Program) -> str | None

Internal helper in JVMClassFileEmitter for main name.

Defined at line 209.

Functions

emit_jvm_class

def emit_jvm_class(program: Program, class_name: str = 'PL1Program') -> bytes

Emits jvm class output for the compiler.

Defined at line 217.

emit_jvm_classes

def emit_jvm_classes(program: Program, class_name: str = 'PL1Program') -> dict[str, bytes]

Emits jvm classes output for the compiler.

Defined at line 221.

pl1compinpy.codegen.linkers

Source: pl1compinpy/codegen/linkers.py

Module containing linkers support for the PL/I compiler.

Classes

LinkRequest

class LinkRequest

Data container describing link request values used by the compiler.

Defined at line 10.

LinkerError

class LinkerError(ValueError)

Exception type raised for linker errors.

Defined at line 15.

ExecutableLinker

class ExecutableLinker

Facade for the platform executable container writers.

Defined at line 19.

Methods:

ExecutableLinker.link
def link(self, request: LinkRequest) -> bytes

Performs link behavior in ExecutableLinker.

Defined at line 22.

PELinker

class PELinker(ExecutableLinker)

Class implementing pelinker behavior in the PL/I compiler.

Defined at line 28.

Methods:

PELinker.link_pe32_x586_windows
def link_pe32_x586_windows(self, program: Program | None = None) -> bytes

Performs link pe32 x586 windows behavior in PELinker.

Defined at line 29.

PELinker.link_pe64_x86_64_windows
def link_pe64_x86_64_windows(self, program: Program | None = None) -> bytes

Performs link pe64 x86 64 windows behavior in PELinker.

Defined at line 32.

ELFLinker

class ELFLinker(ExecutableLinker)

Class implementing elflinker behavior in the PL/I compiler.

Defined at line 36.

Methods:

ELFLinker.link_elf64_x86_64
def link_elf64_x86_64(self, program: Program | None = None) -> bytes

Performs link elf64 x86 64 behavior in ELFLinker.

Defined at line 37.

ELFLinker.link_elf64_aarch64
def link_elf64_aarch64(self, program: Program | None = None) -> bytes

Performs link elf64 aarch64 behavior in ELFLinker.

Defined at line 40.

MachOLinker

class MachOLinker(ExecutableLinker)

Class implementing mach olinker behavior in the PL/I compiler.

Defined at line 44.

Methods:

MachOLinker.link_macho64_x86_64_macos
def link_macho64_x86_64_macos(self, program: Program | None = None) -> bytes

Performs link macho64 x86 64 macos behavior in MachOLinker.

Defined at line 45.

MachOLinker.link_macho64_arm64_macos
def link_macho64_arm64_macos(self, program: Program | None = None) -> bytes

Performs link macho64 arm64 macos behavior in MachOLinker.

Defined at line 48.

Functions

link_executable

def link_executable(format_name: str, program: Program | None = None) -> bytes

Performs link executable behavior in pl1compinpy.codegen.linkers.

Defined at line 52.

pl1compinpy.codegen.python_source

Source: pl1compinpy/codegen/python_source.py

Module containing python source support for the PL/I compiler.

Classes

PythonSourceEmitter

class PythonSourceEmitter

Class implementing python source emitter behavior in the PL/I compiler.

Defined at line 24.

Methods:

PythonSourceEmitter.emit
def emit(self, program: Program) -> str

Performs emit behavior in PythonSourceEmitter.

Defined at line 25.

PythonSourceEmitter._statement
def _statement(self, statement: object, indent: int = 0) -> list[str]

Internal helper in PythonSourceEmitter for statement.

Defined at line 34.

PythonSourceEmitter._io_statement
def _io_statement(self, statement: IOStatement, indent: int) -> list[str]

Internal helper in PythonSourceEmitter for io statement.

Defined at line 90.

PythonSourceEmitter._select_statement
def _select_statement(self, statement: SelectStatement, indent: int) -> list[str]

Internal helper in PythonSourceEmitter for select statement.

Defined at line 105.

PythonSourceEmitter._select_condition
def _select_condition(self, statement: SelectStatement, expressions: list[Expression]) -> str

Internal helper in PythonSourceEmitter for select condition.

Defined at line 118.

PythonSourceEmitter._procedure
def _procedure(self, procedure: Procedure, indent: int) -> list[str]

Internal helper in PythonSourceEmitter for procedure.

Defined at line 126.

PythonSourceEmitter._body
def _body(self, statements: list[object], indent: int) -> list[str]

Internal helper in PythonSourceEmitter for body.

Defined at line 136.

PythonSourceEmitter._expression
def _expression(self, expression: Expression) -> str

Internal helper in PythonSourceEmitter for expression.

Defined at line 144.

PythonSourceEmitter._operator
def _operator(self, operator: str) -> str

Internal helper in PythonSourceEmitter for operator.

Defined at line 160.

PythonSourceEmitter._declaration_initial_value
def _declaration_initial_value(self, declaration: Declaration, name: str) -> str

Internal helper in PythonSourceEmitter for declaration initial value.

Defined at line 171.

PythonSourceEmitter._main_procedure_name
def _main_procedure_name(self, program: Program) -> str | None

Internal helper in PythonSourceEmitter for main procedure name.

Defined at line 183.

Functions

emit_python_source

def emit_python_source(program: Program) -> str

Emits python source output for the compiler.

Defined at line 191.

pl1compinpy.codegen.runtime_link

Source: pl1compinpy/codegen/runtime_link.py

Module containing runtime link support for the PL/I compiler.

Classes

RuntimeLinkage

class RuntimeLinkage

Data container describing runtime linkage values used by the compiler.

Defined at line 10.

Methods:

RuntimeLinkage.symbol
def symbol(self, name: str, prefix: str = '') -> str

Performs symbol behavior in RuntimeLinkage.

Defined at line 24.

RuntimeLinkManifest

class RuntimeLinkManifest

Data container describing runtime link manifest values used by the compiler.

Defined at line 31.

Methods:

RuntimeLinkManifest.to_bytes
def to_bytes(self) -> bytes

Performs to bytes behavior in RuntimeLinkManifest.

Defined at line 35.

Functions

runtime_linkage

def runtime_linkage(target: str) -> RuntimeLinkage

Performs runtime linkage behavior in pl1compinpy.codegen.runtime_link.

Defined at line 176.

runtime_manifest

def runtime_manifest(target: str, program: Program | None = None) -> RuntimeLinkManifest

Performs runtime manifest behavior in pl1compinpy.codegen.runtime_link.

Defined at line 188.

encoded_runtime_manifest

def encoded_runtime_manifest(target: str, program: Program | None = None) -> bytes

Performs encoded runtime manifest behavior in pl1compinpy.codegen.runtime_link.

Defined at line 192.

_runtime_calls

def _runtime_calls(program: Program | None) -> set[str]

Internal helper in pl1compinpy.codegen.runtime_link for runtime calls.

Defined at line 196.

_collect_runtime_calls

def _collect_runtime_calls(statement: Statement | None, calls: set[str]) -> None

Internal helper in pl1compinpy.codegen.runtime_link for collect runtime calls.

Defined at line 205.

pl1compinpy.compiler

Source: pl1compinpy/compiler.py

Compatibility wrapper for the core compiler package.

pl1compinpy.core

Source: pl1compinpy/core/__init__.py

Core AST and compiler orchestration.

pl1compinpy.core.ast

Source: pl1compinpy/core/ast.py

Module containing ast support for the PL/I compiler.

Classes

Program

class Program

Data container describing program values used by the compiler.

Defined at line 7.

Statement

class Statement

Class implementing statement behavior in the PL/I compiler.

Defined at line 11.

Assignment

class Assignment(Statement)

Data container describing assignment values used by the compiler.

Defined at line 16.

Declaration

class Declaration(Statement)

Data container describing declaration values used by the compiler.

Defined at line 22.

GenericAlternative

class GenericAlternative

Data container describing generic alternative values used by the compiler.

Defined at line 34.

Call

class Call(Statement)

Data container describing call values used by the compiler.

Defined at line 40.

Procedure

class Procedure(Statement)

Data container describing procedure values used by the compiler.

Defined at line 47.

DoGroup

class DoGroup(Statement)

Data container describing do group values used by the compiler.

Defined at line 57.

IfStatement

class IfStatement(Statement)

Data container describing if statement values used by the compiler.

Defined at line 65.

IOStatement

class IOStatement(Statement)

Data container describing iostatement values used by the compiler.

Defined at line 72.

SelectStatement

class SelectStatement(Statement)

Data container describing select statement values used by the compiler.

Defined at line 81.

WhenBranch

class WhenBranch

Data container describing when branch values used by the compiler.

Defined at line 88.

LabelledStatement

class LabelledStatement(Statement)

Data container describing labelled statement values used by the compiler.

Defined at line 94.

RawStatement

class RawStatement(Statement)

Data container describing raw statement values used by the compiler.

Defined at line 100.

Expression

class Expression

Class implementing expression behavior in the PL/I compiler.

Defined at line 105.

Identifier

class Identifier(Expression)

Data container describing identifier values used by the compiler.

Defined at line 110.

NumberLiteral

class NumberLiteral(Expression)

Data container describing number literal values used by the compiler.

Defined at line 115.

StringLiteral

class StringLiteral(Expression)

Data container describing string literal values used by the compiler.

Defined at line 120.

BinaryExpression

class BinaryExpression(Expression)

Data container describing binary expression values used by the compiler.

Defined at line 125.

UnaryExpression

class UnaryExpression(Expression)

Data container describing unary expression values used by the compiler.

Defined at line 132.

pl1compinpy.core.compiler

Source: pl1compinpy/core/compiler.py

Module containing compiler support for the PL/I compiler.

Classes

Compiler

class Compiler

Class implementing compiler behavior in the PL/I compiler.

Defined at line 11.

Methods:

Compiler.compile
def compile(self, source: str, target: str = 'python-source', builtins: list[str] | None = None) -> str

Performs compile behavior in Compiler.

Defined at line 12.

Functions

compile_source

def compile_source(source: str, target: str = 'python-source', builtins: list[str] | None = None) -> str

Compiles PL/I input into source output.

Defined at line 18.

available_targets

def available_targets() -> tuple[str, ...]

Performs available targets behavior in pl1compinpy.core.compiler.

Defined at line 22.

available_binary_formats

def available_binary_formats() -> tuple[str, ...]

Performs available binary formats behavior in pl1compinpy.core.compiler.

Defined at line 26.

compile_binary

def compile_binary(format_name: str, source: str | None = None, builtins: list[str] | None = None) -> bytes

Compiles PL/I input into binary output.

Defined at line 30.

compile_jvm_classes

def compile_jvm_classes(source: str, builtins: list[str] | None = None) -> dict[str, bytes]

Compiles PL/I input into jvm classes output.

Defined at line 36.

compile_dotnet_executable

def compile_dotnet_executable(source: str, output: str | Path, builtins: list[str] | None = None, ilasm: str | None = None) -> Path

Compiles PL/I input into dotnet executable output.

Defined at line 42.

pl1compinpy.frontend

Source: pl1compinpy/frontend/__init__.py

Lexing, keyword metadata, and parsing for PL1CompInPy.

pl1compinpy.frontend.keywords

Source: pl1compinpy/frontend/keywords.py

Module containing keywords support for the PL/I compiler.

Classes

KeywordInfo

class KeywordInfo

Data container describing keyword info values used by the compiler.

Defined at line 7.

Functions

_add

def _add(word: str, category: str, meaning: str, *aliases: str) -> None

Internal helper in pl1compinpy.frontend.keywords for add.

Defined at line 18.

keyword_info

def keyword_info(word: str) -> KeywordInfo | None

Performs keyword info behavior in pl1compinpy.frontend.keywords.

Defined at line 169.

pl1compinpy.frontend.lexer

Source: pl1compinpy/frontend/lexer.py

Module containing lexer support for the PL/I compiler.

Classes

TokenType

class TokenType(str, Enum)

Class implementing token type behavior in the PL/I compiler.

Defined at line 9.

Token

class Token

Data container describing token values used by the compiler.

Defined at line 40.

Methods:

Token.is_keyword
def is_keyword(self) -> bool

Performs is keyword behavior in Token.

Defined at line 48.

LexerError

class LexerError(ValueError)

Exception type raised for lexer errors.

Defined at line 52.

Lexer

class Lexer

Class implementing lexer behavior in the PL/I compiler.

Defined at line 56.

Methods:

Lexer.__init__
def __init__(self, source: str) -> None

Initializes an instance of Lexer.

Defined at line 57.

Lexer.tokenize
def tokenize(self) -> list[Token]

Tokenizes PL/I source text for the parser.

Defined at line 63.

Lexer._at_end
def _at_end(self) -> bool

Internal helper in Lexer for at end.

Defined at line 86.

Lexer._peek
def _peek(self) -> str

Internal helper in Lexer for peek.

Defined at line 89.

Lexer._peek_next
def _peek_next(self) -> str

Internal helper in Lexer for peek next.

Defined at line 92.

Lexer._advance
def _advance(self) -> str

Internal helper in Lexer for advance.

Defined at line 98.

Lexer._advance_line
def _advance_line(self) -> None

Internal helper in Lexer for advance line.

Defined at line 104.

Lexer._identifier
def _identifier(self) -> Token

Internal helper in Lexer for identifier.

Defined at line 109.

Lexer._number
def _number(self) -> Token

Internal helper in Lexer for number.

Defined at line 118.

Lexer._string
def _string(self) -> Token

Internal helper in Lexer for string.

Defined at line 130.

Lexer._comment
def _comment(self) -> None

Internal helper in Lexer for comment.

Defined at line 145.

Lexer._symbol
def _symbol(self) -> Token

Internal helper in Lexer for symbol.

Defined at line 161.

pl1compinpy.frontend.parser

Source: pl1compinpy/frontend/parser.py

Module containing parser support for the PL/I compiler.

Classes

ParserError

class ParserError(ValueError)

Exception type raised for parser errors.

Defined at line 28.

Parser

class Parser

Class implementing parser behavior in the PL/I compiler.

Defined at line 32.

Methods:

Parser.__init__
def __init__(self, tokens: list[Token]) -> None

Initializes an instance of Parser.

Defined at line 33.

Parser.parse
def parse(self) -> Program

Parses lexer tokens into the compiler's AST representation.

Defined at line 37.

Parser._statement
def _statement(self) -> Statement

Internal helper in Parser for statement.

Defined at line 45.

Parser._declaration
def _declaration(self) -> Declaration

Internal helper in Parser for declaration.

Defined at line 82.

Parser._dimensions_from_tokens
def _dimensions_from_tokens(self, tokens: list[Token], index: int) -> tuple[list[int], int]

Internal helper in Parser for dimensions from tokens.

Defined at line 144.

Parser._file_options_from_tokens
def _file_options_from_tokens(self, tokens: list[Token]) -> dict[str, str]

Internal helper in Parser for file options from tokens.

Defined at line 152.

Parser._generic_options_from_tokens
def _generic_options_from_tokens(self, names: list[str], tokens: list[Token]) -> dict[str, list[GenericAlternative]]

Internal helper in Parser for generic options from tokens.

Defined at line 171.

Parser._picture_options_from_tokens
def _picture_options_from_tokens(self, names: list[str], tokens: list[Token]) -> dict[str, str]

Internal helper in Parser for picture options from tokens.

Defined at line 190.

Parser._picture_pattern_from_tokens
def _picture_pattern_from_tokens(self, tokens: list[Token], index: int) -> tuple[str, int]

Internal helper in Parser for picture pattern from tokens.

Defined at line 202.

Parser._based_options_from_tokens
def _based_options_from_tokens(self, names: list[str], tokens: list[Token]) -> dict[str, str | None]

Internal helper in Parser for based options from tokens.

Defined at line 232.

Parser._pointer_names_from_tokens
def _pointer_names_from_tokens(self, names: list[str], tokens: list[Token]) -> list[str]

Internal helper in Parser for pointer names from tokens.

Defined at line 245.

Parser._procedure
def _procedure(self, name: str | None) -> Procedure

Internal helper in Parser for procedure.

Defined at line 252.

Parser._collect_until_balanced_rparen
def _collect_until_balanced_rparen(self) -> list[Token]

Internal helper in Parser for collect until balanced rparen.

Defined at line 286.

Parser._do_group
def _do_group(self) -> DoGroup

Internal helper in Parser for do group.

Defined at line 303.

Parser._do_control_condition
def _do_control_condition(self, tokens: list[Token], keyword: str) -> Expression | None

Internal helper in Parser for do control condition.

Defined at line 323.

Parser._if_statement
def _if_statement(self) -> IfStatement

Internal helper in Parser for if statement.

Defined at line 332.

Parser._call_statement
def _call_statement(self) -> Call

Internal helper in Parser for call statement.

Defined at line 339.

Parser._io_statement
def _io_statement(self) -> IOStatement

Internal helper in Parser for io statement.

Defined at line 358.

Parser._select_statement
def _select_statement(self) -> SelectStatement

Internal helper in Parser for select statement.

Defined at line 368.

Parser._assignment
def _assignment(self) -> Assignment

Internal helper in Parser for assignment.

Defined at line 395.

Parser._raw_statement
def _raw_statement(self) -> RawStatement

Internal helper in Parser for raw statement.

Defined at line 400.

Parser._expression
def _expression(self) -> Expression

Internal helper in Parser for expression.

Defined at line 405.

Parser._logical_or
def _logical_or(self) -> Expression

Internal helper in Parser for logical or.

Defined at line 408.

Parser._logical_and
def _logical_and(self) -> Expression

Internal helper in Parser for logical and.

Defined at line 416.

Parser._comparison
def _comparison(self) -> Expression

Internal helper in Parser for comparison.

Defined at line 424.

Parser._concatenation
def _concatenation(self) -> Expression

Internal helper in Parser for concatenation.

Defined at line 432.

Parser._term
def _term(self) -> Expression

Internal helper in Parser for term.

Defined at line 440.

Parser._factor
def _factor(self) -> Expression

Internal helper in Parser for factor.

Defined at line 448.

Parser._unary
def _unary(self) -> Expression

Internal helper in Parser for unary.

Defined at line 456.

Parser._power
def _power(self) -> Expression

Internal helper in Parser for power.

Defined at line 464.

Parser._primary
def _primary(self) -> Expression

Internal helper in Parser for primary.

Defined at line 472.

Parser._expression_from_tokens
def _expression_from_tokens(self, tokens: list[Token]) -> Expression

Internal helper in Parser for expression from tokens.

Defined at line 485.

Parser._expressions_until_rparen
def _expressions_until_rparen(self) -> list[Expression]

Internal helper in Parser for expressions until rparen.

Defined at line 489.

Parser._option_value
def _option_value(self, tokens: list[Token], keyword: str) -> str | None

Internal helper in Parser for option value.

Defined at line 500.

Parser._option_tokens
def _option_tokens(self, tokens: list[Token], keyword: str) -> list[Token]

Internal helper in Parser for option tokens.

Defined at line 506.

Parser._io_options_from_tokens
def _io_options_from_tokens(self, tokens: list[Token]) -> dict[str, Expression]

Internal helper in Parser for io options from tokens.

Defined at line 531.

Parser._identifier_list_until
def _identifier_list_until(self, end: TokenType) -> list[str]

Internal helper in Parser for identifier list until.

Defined at line 539.

Parser._type_text
def _type_text(self, tokens: list[Token]) -> str

Internal helper in Parser for type text.

Defined at line 549.

Parser._collect_until_semicolon
def _collect_until_semicolon(self) -> list[Token]

Internal helper in Parser for collect until semicolon.

Defined at line 552.

Parser._collect_until_keyword
def _collect_until_keyword(self, *keywords: str) -> list[Token]

Internal helper in Parser for collect until keyword.

Defined at line 566.

Parser._looks_like_label
def _looks_like_label(self) -> bool

Internal helper in Parser for looks like label.

Defined at line 580.

Parser._starts_raw_statement
def _starts_raw_statement(self) -> bool

Internal helper in Parser for starts raw statement.

Defined at line 583.

Parser._match
def _match(self, *types: TokenType) -> bool

Internal helper in Parser for match.

Defined at line 609.

Parser._match_semicolon
def _match_semicolon(self) -> bool

Internal helper in Parser for match semicolon.

Defined at line 615.

Parser._match_keyword
def _match_keyword(self, *keywords: str) -> bool

Internal helper in Parser for match keyword.

Defined at line 618.

Parser._previous_keyword
def _previous_keyword(self, keyword: str) -> bool

Internal helper in Parser for previous keyword.

Defined at line 624.

Parser._check
def _check(self, token_type: TokenType) -> bool

Internal helper in Parser for check.

Defined at line 627.

Parser._check_next
def _check_next(self, token_type: TokenType) -> bool

Internal helper in Parser for check next.

Defined at line 630.

Parser._check_keyword
def _check_keyword(self, *keywords: str) -> bool

Internal helper in Parser for check keyword.

Defined at line 635.

Parser._check_next_keyword
def _check_next_keyword(self, *keywords: str) -> bool

Internal helper in Parser for check next keyword.

Defined at line 639.

Parser._consume
def _consume(self, token_type: TokenType, message: str) -> Token

Internal helper in Parser for consume.

Defined at line 645.

Parser._consume_identifier
def _consume_identifier(self, message: str) -> Token

Internal helper in Parser for consume identifier.

Defined at line 650.

Parser._advance
def _advance(self) -> Token

Internal helper in Parser for advance.

Defined at line 655.

Parser._peek
def _peek(self) -> Token

Internal helper in Parser for peek.

Defined at line 660.

Parser._previous
def _previous(self) -> Token

Internal helper in Parser for previous.

Defined at line 663.

Parser._error
def _error(self, token: Token, message: str) -> ParserError

Internal helper in Parser for error.

Defined at line 666.

pl1compinpy.runtime

Source: pl1compinpy/runtime/__init__.py

Runtime normalization and calling-convention support.

pl1compinpy.runtime.arrays

Source: pl1compinpy/runtime/arrays.py

Module containing arrays support for the PL/I compiler.

Classes

ArrayRuntimeError

class ArrayRuntimeError(ValueError)

Exception type raised for array runtime errors.

Defined at line 10.

ArrayValue

class ArrayValue

Data container describing array value values used by the compiler.

Defined at line 15.

Methods:

ArrayValue.__post_init__
def __post_init__(self) -> None

Internal helper in ArrayValue for post init.

Defined at line 22.

ArrayValue.element_count
def element_count(self) -> int

Performs element count behavior in ArrayValue.

Defined at line 28.

ArrayValue.index
def index(self, *subscripts: int) -> int

Performs index behavior in ArrayValue.

Defined at line 31.

ArrayValue.get
def get(self, *subscripts: int) -> int

Performs get behavior in ArrayValue.

Defined at line 43.

ArrayValue.set
def set(self, value: int, *subscripts: int) -> None

Performs set behavior in ArrayValue.

Defined at line 46.

ArrayRuntime

class ArrayRuntime

Class implementing array runtime behavior in the PL/I compiler.

Defined at line 50.

Methods:

ArrayRuntime.__init__
def __init__(self, heap: HeapRuntime | None = None) -> None

Initializes an instance of ArrayRuntime.

Defined at line 51.

ArrayRuntime.allocate_array
def allocate_array(self, name: str, dimensions: list[int], element_size: int = 4) -> ArrayValue

Performs allocate array behavior in ArrayRuntime.

Defined at line 55.

ArrayRuntime.free_array
def free_array(self, name: str) -> None

Performs free array behavior in ArrayRuntime.

Defined at line 64.

pl1compinpy.runtime.based

Source: pl1compinpy/runtime/based.py

Module containing based support for the PL/I compiler.

Classes

BasedRuntimeError

class BasedRuntimeError(ValueError)

Exception type raised for based runtime errors.

Defined at line 8.

PointerValue

class PointerValue

Data container describing pointer value values used by the compiler.

Defined at line 13.

Methods:

PointerValue.is_null
def is_null(self) -> bool

Performs is null behavior in PointerValue.

Defined at line 18.

BasedRecord

class BasedRecord

Data container describing based record values used by the compiler.

Defined at line 23.

BasedRuntime

class BasedRuntime

Class implementing based runtime behavior in the PL/I compiler.

Defined at line 29.

Methods:

BasedRuntime.__init__
def __init__(self, heap: HeapRuntime | None = None) -> None

Initializes an instance of BasedRuntime.

Defined at line 30.

BasedRuntime.declare_pointer
def declare_pointer(self, name: str) -> PointerValue

Performs declare pointer behavior in BasedRuntime.

Defined at line 35.

BasedRuntime.declare_based_record
def declare_based_record(self, name: str, size: int, pointer_name: str | None = None) -> BasedRecord

Performs declare based record behavior in BasedRuntime.

Defined at line 39.

BasedRuntime.allocate_based
def allocate_based(self, record_name: str, pointer_name: str | None = None) -> PointerValue

Performs allocate based behavior in BasedRuntime.

Defined at line 48.

BasedRuntime.set_pointer
def set_pointer(self, pointer_name: str, handle: int, offset: int = 0) -> PointerValue

Performs set pointer behavior in BasedRuntime.

Defined at line 59.

BasedRuntime.set_pointer_to_record
def set_pointer_to_record(self, pointer_name: str, record_name: str, source_pointer: str | None = None) -> PointerValue

Performs set pointer to record behavior in BasedRuntime.

Defined at line 71.

BasedRuntime.pointer_for_record
def pointer_for_record(self, record_name: str, pointer_name: str | None = None) -> PointerValue

Performs pointer for record behavior in BasedRuntime.

Defined at line 77.

BasedRuntime.storage_for
def storage_for(self, record_name: str, pointer_name: str | None = None) -> memoryview

Performs storage for behavior in BasedRuntime.

Defined at line 87.

BasedRuntime.write_record
def write_record(self, record_name: str, data: bytes, pointer_name: str | None = None) -> None

Performs write record behavior in BasedRuntime.

Defined at line 96.

BasedRuntime.read_record
def read_record(self, record_name: str, pointer_name: str | None = None) -> bytes

Performs read record behavior in BasedRuntime.

Defined at line 104.

BasedRuntime._record
def _record(self, name: str) -> BasedRecord

Internal helper in BasedRuntime for record.

Defined at line 107.

pl1compinpy.runtime.calculation

Source: pl1compinpy/runtime/calculation.py

Module containing calculation support for the PL/I compiler.

Classes

CalculationError

class CalculationError(ValueError)

Exception type raised for calculation errors.

Defined at line 10.

PL1Type

class PL1Type(str, Enum)

Class implementing pl1 type behavior in the PL/I compiler.

Defined at line 14.

PL1Value

class PL1Value

Data container describing pl1 value values used by the compiler.

Defined at line 23.

Methods:

PL1Value.truthy
def truthy(self) -> bool

Performs truthy behavior in PL1Value.

Defined at line 28.

NumericTower

class NumericTower

Class implementing numeric tower behavior in the PL/I compiler.

Defined at line 36.

Methods:

NumericTower.value
def value(self, raw: object, type_name: PL1Type | str | None = None) -> PL1Value

Performs value behavior in NumericTower.

Defined at line 44.

NumericTower.cast
def cast(self, value: PL1Value, target: PL1Type | str) -> PL1Value

Performs cast behavior in NumericTower.

Defined at line 51.

NumericTower.promote
def promote(self, left: PL1Value, right: PL1Value) -> tuple[PL1Value, PL1Value, PL1Type]

Performs promote behavior in NumericTower.

Defined at line 75.

NumericTower._infer
def _infer(self, raw: object) -> PL1Type

Internal helper in NumericTower for infer.

Defined at line 83.

CalculationEngine

class CalculationEngine

Class implementing calculation engine behavior in the PL/I compiler.

Defined at line 97.

Methods:

CalculationEngine.__init__
def __init__(self, variables: dict[str, PL1Value | object] | None = None) -> None

Initializes an instance of CalculationEngine.

Defined at line 98.

CalculationEngine.evaluate
def evaluate(self, expression: Expression) -> PL1Value

Performs evaluate behavior in CalculationEngine.

Defined at line 102.

CalculationEngine.cast
def cast(self, value: PL1Value | object, target: PL1Type | str) -> PL1Value

Performs cast behavior in CalculationEngine.

Defined at line 117.

CalculationEngine._number
def _number(self, text: str) -> PL1Value

Internal helper in CalculationEngine for number.

Defined at line 120.

CalculationEngine._unary
def _unary(self, expression: UnaryExpression) -> PL1Value

Internal helper in CalculationEngine for unary.

Defined at line 125.

CalculationEngine._binary
def _binary(self, expression: BinaryExpression) -> PL1Value

Internal helper in CalculationEngine for binary.

Defined at line 138.

CalculationEngine._compare
def _compare(self, left: PL1Value, right: PL1Value, op: str) -> bool

Internal helper in CalculationEngine for compare.

Defined at line 166.

pl1compinpy.runtime.calling

Source: pl1compinpy/runtime/calling.py

Module containing calling support for the PL/I compiler.

Classes

RuntimeError

class RuntimeError(ValueError)

Exception type raised for runtime errors.

Defined at line 16.

Functions

normalize_calls

def normalize_calls(program: Program) -> Program

Performs normalize calls behavior in pl1compinpy.runtime.calling.

Defined at line 20.

_procedure_table

def _procedure_table(statements: list[Statement]) -> dict[str, Procedure]

Internal helper in pl1compinpy.runtime.calling for procedure table.

Defined at line 27.

_normalize_statement

def _normalize_statement(statement: Statement, procedures: dict[str, Procedure], table: FunctionTable) -> Statement

Internal helper in pl1compinpy.runtime.calling for normalize statement.

Defined at line 38.

_normalize_call

def _normalize_call(call: Call, procedures: dict[str, Procedure], table: FunctionTable) -> Call

Internal helper in pl1compinpy.runtime.calling for normalize call.

Defined at line 65.

_descriptor_parameter_names

def _descriptor_parameter_names(descriptor: FunctionDescriptor) -> list[str]

Internal helper in pl1compinpy.runtime.calling for descriptor parameter names.

Defined at line 85.

pl1compinpy.runtime.function_table

Source: pl1compinpy/runtime/function_table.py

Module containing function table support for the PL/I compiler.

Classes

FunctionTableError

class FunctionTableError(ValueError)

Exception type raised for function table errors.

Defined at line 9.

ParameterDescriptor

class ParameterDescriptor

Data container describing parameter descriptor values used by the compiler.

Defined at line 14.

FunctionDescriptor

class FunctionDescriptor

Data container describing function descriptor values used by the compiler.

Defined at line 22.

Methods:

FunctionDescriptor.normalized_name
def normalized_name(self) -> str

Performs normalized name behavior in FunctionDescriptor.

Defined at line 33.

FunctionTable

class FunctionTable

Data container describing function table values used by the compiler.

Defined at line 38.

Methods:

FunctionTable.add_function
def add_function(self, descriptor: FunctionDescriptor) -> FunctionDescriptor

Performs add function behavior in FunctionTable.

Defined at line 42.

FunctionTable.add_runtime
def add_runtime(self, name: str, pointer: Callable[..., Any] | str, parameters: list[ParameterDescriptor] | None = None, returns: str | None = None, *, default_mode: str = 'reference', variadic: bool = False) -> FunctionDescriptor

Performs add runtime behavior in FunctionTable.

Defined at line 46.

FunctionTable.add_builtin
def add_builtin(self, name: str, pointer: Callable[..., Any] | str, parameters: list[ParameterDescriptor] | None = None, returns: str | None = None, *, default_mode: str = 'reference', variadic: bool = False) -> FunctionDescriptor

Performs add builtin behavior in FunctionTable.

Defined at line 68.

FunctionTable.add_procedure
def add_procedure(self, name: str, procedure: Procedure) -> FunctionDescriptor

Performs add procedure behavior in FunctionTable.

Defined at line 91.

FunctionTable.merge
def merge(self, other: 'FunctionTable') -> 'FunctionTable'

Performs merge behavior in FunctionTable.

Defined at line 104.

FunctionTable.declare_builtin
def declare_builtin(self, name: str) -> None

Performs declare builtin behavior in FunctionTable.

Defined at line 110.

FunctionTable.get
def get(self, name: str) -> FunctionDescriptor

Performs get behavior in FunctionTable.

Defined at line 113.

FunctionTable.validate_call
def validate_call(self, call: Call) -> FunctionDescriptor

Performs validate call behavior in FunctionTable.

Defined at line 119.

FunctionTable.call
def call(self, name: str, *arguments: Any, mode: str = 'reference', **keyword_arguments: Any) -> Any

Performs call behavior in FunctionTable.

Defined at line 134.

FunctionTable._validate_by_name
def _validate_by_name(self, call: Call, descriptor: FunctionDescriptor) -> None

Internal helper in FunctionTable for validate by name.

Defined at line 144.

Functions

build_dynamic_function_table

def build_dynamic_function_table(program: Program) -> FunctionTable

Performs build dynamic function table behavior in pl1compinpy.runtime.function_table.

Defined at line 151.

declare_program_builtins

def declare_program_builtins(program: Program, table: FunctionTable) -> FunctionTable

Performs declare program builtins behavior in pl1compinpy.runtime.function_table.

Defined at line 158.

declared_builtins

def declared_builtins(program: Program) -> set[str]

Performs declared builtins behavior in pl1compinpy.runtime.function_table.

Defined at line 164.

_declare_statement_builtins

def _declare_statement_builtins(statement: Statement | None, table: FunctionTable) -> None

Internal helper in pl1compinpy.runtime.function_table for declare statement builtins.

Defined at line 170.

_add_statement_function

def _add_statement_function(table: FunctionTable, statement: Statement) -> None

Internal helper in pl1compinpy.runtime.function_table for add statement function.

Defined at line 199.

validate_program_calls

def validate_program_calls(program: Program, table: FunctionTable) -> None

Performs validate program calls behavior in pl1compinpy.runtime.function_table.

Defined at line 207.

_validate_statement_calls

def _validate_statement_calls(statement: Statement | None, table: FunctionTable) -> None

Internal helper in pl1compinpy.runtime.function_table for validate statement calls.

Defined at line 212.

runtime_function_table

def runtime_function_table() -> FunctionTable

Performs runtime function table behavior in pl1compinpy.runtime.function_table.

Defined at line 236.

pl1compinpy.runtime.generics

Source: pl1compinpy/runtime/generics.py

Module containing generics support for the PL/I compiler.

Classes

GenericRuntimeError

class GenericRuntimeError(ValueError)

Exception type raised for generic runtime errors.

Defined at line 7.

GenericFunction

class GenericFunction

Data container describing generic function values used by the compiler.

Defined at line 24.

Methods:

GenericFunction.when
def when(self, parameter_types: list[str], implementation: Callable[..., object]) -> 'GenericFunction'

Performs when behavior in GenericFunction.

Defined at line 28.

GenericFunction.__call__
def __call__(self, *arguments: object) -> object

Internal helper in GenericFunction for call.

Defined at line 32.

GenericRuntime

class GenericRuntime

Class implementing generic runtime behavior in the PL/I compiler.

Defined at line 41.

Methods:

GenericRuntime.__init__
def __init__(self) -> None

Initializes an instance of GenericRuntime.

Defined at line 42.

GenericRuntime.define
def define(self, name: str) -> GenericFunction

Performs define behavior in GenericRuntime.

Defined at line 45.

GenericRuntime.call
def call(self, name: str, *arguments: object) -> object

Performs call behavior in GenericRuntime.

Defined at line 49.

Functions

pl1_type

def pl1_type(value: object) -> str

Performs pl1 type behavior in pl1compinpy.runtime.generics.

Defined at line 11.

pl1compinpy.runtime.heap

Source: pl1compinpy/runtime/heap.py

Module containing heap support for the PL/I compiler.

Classes

HeapRuntimeError

class HeapRuntimeError(ValueError)

Exception type raised for heap runtime errors.

Defined at line 6.

HeapBlock

class HeapBlock

Data container describing heap block values used by the compiler.

Defined at line 11.

Methods:

HeapBlock.size
def size(self) -> int

Performs size behavior in HeapBlock.

Defined at line 16.

HeapRuntime

class HeapRuntime

Class implementing heap runtime behavior in the PL/I compiler.

Defined at line 20.

Methods:

HeapRuntime.__init__
def __init__(self) -> None

Initializes an instance of HeapRuntime.

Defined at line 21.

HeapRuntime.allocate
def allocate(self, size: int) -> int

Performs allocate behavior in HeapRuntime.

Defined at line 25.

HeapRuntime.free
def free(self, handle: int) -> None

Performs free behavior in HeapRuntime.

Defined at line 33.

HeapRuntime.block
def block(self, handle: int) -> HeapBlock

Performs block behavior in HeapRuntime.

Defined at line 38.

pl1compinpy.runtime.io

Source: pl1compinpy/runtime/io.py

Module containing io support for the PL/I compiler.

Classes

FileRuntimeError

class FileRuntimeError(ValueError)

Exception type raised for file runtime errors.

Defined at line 10.

FileDescriptor

class FileDescriptor

Data container describing file descriptor values used by the compiler.

Defined at line 15.

Methods:

FileDescriptor.from_declaration
def from_declaration(cls, declaration: Declaration, base_path: Path | None = None) -> 'FileDescriptor'

Performs from declaration behavior in FileDescriptor.

Defined at line 25.

StdioRuntime

class StdioRuntime

Class implementing stdio runtime behavior in the PL/I compiler.

Defined at line 46.

Methods:

StdioRuntime.__init__
def __init__(self) -> None

Initializes an instance of StdioRuntime.

Defined at line 47.

StdioRuntime.open
def open(self, descriptor: FileDescriptor) -> None

Performs open behavior in StdioRuntime.

Defined at line 50.

StdioRuntime.close
def close(self, descriptor: FileDescriptor) -> None

Performs close behavior in StdioRuntime.

Defined at line 54.

StdioRuntime.write_record
def write_record(self, descriptor: FileDescriptor, data: bytes | str) -> None

Performs write record behavior in StdioRuntime.

Defined at line 59.

StdioRuntime.read_record
def read_record(self, descriptor: FileDescriptor) -> bytes | str

Performs read record behavior in StdioRuntime.

Defined at line 81.

StdioRuntime.execute
def execute(self, statement: IOStatement, descriptors: dict[str, FileDescriptor], variables: dict[str, object] | None = None) -> None

Performs execute behavior in StdioRuntime.

Defined at line 100.

StdioRuntime._io_value
def _io_value(self, statement: IOStatement, variables: dict[str, object]) -> bytes | str

Internal helper in StdioRuntime for io value.

Defined at line 118.

StdioRuntime._handle
def _handle(self, descriptor: FileDescriptor) -> BinaryIO

Internal helper in StdioRuntime for handle.

Defined at line 129.

pl1compinpy.runtime.picture

Source: pl1compinpy/runtime/picture.py

Module containing picture support for the PL/I compiler.

Classes

PictureRuntimeError

class PictureRuntimeError(ValueError)

Exception type raised for picture runtime errors.

Defined at line 7.

PictureSpec

class PictureSpec

Data container describing picture spec values used by the compiler.

Defined at line 12.

Methods:

PictureSpec.scale
def scale(self) -> int

Performs scale behavior in PictureSpec.

Defined at line 16.

PictureSpec.integer_digits
def integer_digits(self) -> int

Performs integer digits behavior in PictureSpec.

Defined at line 25.

PictureSpec.storage_width
def storage_width(self) -> int

Performs storage width behavior in PictureSpec.

Defined at line 31.

PictureSpec.format
def format(self, value: int | float | Decimal | str) -> str

Performs format behavior in PictureSpec.

Defined at line 34.

PictureSpec.parse
def parse(self, text: str) -> Decimal

Parses lexer tokens into the compiler's AST representation.

Defined at line 67.

PictureSpec._first_required_integer_index
def _first_required_integer_index(self) -> int

Internal helper in PictureSpec for first required integer index.

Defined at line 79.

PictureSpec._digit_count
def _digit_count(self, text: str) -> int

Internal helper in PictureSpec for digit count.

Defined at line 87.

PictureRuntime

class PictureRuntime

Class implementing picture runtime behavior in the PL/I compiler.

Defined at line 91.

Methods:

PictureRuntime.compile
def compile(self, pattern: str) -> PictureSpec

Performs compile behavior in PictureRuntime.

Defined at line 92.

PictureRuntime.fixed_to_picture
def fixed_to_picture(self, value: int | Decimal, pattern: str) -> str

Performs fixed to picture behavior in PictureRuntime.

Defined at line 99.

PictureRuntime.float_to_picture
def float_to_picture(self, value: float, pattern: str) -> str

Performs float to picture behavior in PictureRuntime.

Defined at line 102.

PictureRuntime.picture_to_fixed
def picture_to_fixed(self, text: str, pattern: str) -> Decimal

Performs picture to fixed behavior in PictureRuntime.

Defined at line 105.

PictureRuntime.picture_to_float
def picture_to_float(self, text: str, pattern: str) -> float

Performs picture to float behavior in PictureRuntime.

Defined at line 108.

pl1compinpy.runtime.socket_io

Source: pl1compinpy/runtime/socket_io.py

Module containing socket io support for the PL/I compiler.

Classes

SocketRuntimeError

class SocketRuntimeError(ValueError)

Exception type raised for socket runtime errors.

Defined at line 11.

SocketSecureMode

class SocketSecureMode(str, Enum)

Class implementing socket secure mode behavior in the PL/I compiler.

Defined at line 15.

SocketDescriptor

class SocketDescriptor

Data container describing socket descriptor values used by the compiler.

Defined at line 22.

Methods:

SocketDescriptor.tcp_client
def tcp_client(cls, name: str, host: str, port: int, timeout: float | None = None) -> 'SocketDescriptor'

Performs tcp client behavior in SocketDescriptor.

Defined at line 36.

SocketDescriptor.tcp_server
def tcp_server(cls, name: str, host: str = '127.0.0.1', port: int = 0, timeout: float | None = None) -> 'SocketDescriptor'

Performs tcp server behavior in SocketDescriptor.

Defined at line 40.

SocketDescriptor.ssl_client
def ssl_client(cls, name: str, host: str, port: int, timeout: float | None = None, verify: bool = True) -> 'SocketDescriptor'

Performs ssl client behavior in SocketDescriptor.

Defined at line 44.

SocketDescriptor.tls_client
def tls_client(cls, name: str, host: str, port: int, timeout: float | None = None, verify: bool = True) -> 'SocketDescriptor'

Performs tls client behavior in SocketDescriptor.

Defined at line 48.

SocketHandle

class SocketHandle

Data container describing socket handle values used by the compiler.

Defined at line 53.

Methods:

SocketHandle.address
def address(self) -> tuple[str, int]

Performs address behavior in SocketHandle.

Defined at line 59.

SocketFileDescriptor

class SocketFileDescriptor

Data container describing socket file descriptor values used by the compiler.

Defined at line 65.

Methods:

SocketFileDescriptor.from_endpoint
def from_endpoint(cls, endpoint: SocketDescriptor, *, recfm: str = 'UNIX', lrecl: int | None = None, text: bool = False) -> 'SocketFileDescriptor'

Performs from endpoint behavior in SocketFileDescriptor.

Defined at line 73.

SocketRuntime

class SocketRuntime

Class implementing socket runtime behavior in the PL/I compiler.

Defined at line 84.

Methods:

SocketRuntime.__init__
def __init__(self) -> None

Initializes an instance of SocketRuntime.

Defined at line 85.

SocketRuntime.open
def open(self, descriptor: SocketDescriptor) -> SocketHandle

Performs open behavior in SocketRuntime.

Defined at line 88.

SocketRuntime.listen
def listen(self, descriptor: SocketDescriptor, backlog: int = 1) -> SocketHandle

Performs listen behavior in SocketRuntime.

Defined at line 93.

SocketRuntime.connect
def connect(self, descriptor: SocketDescriptor) -> SocketHandle

Performs connect behavior in SocketRuntime.

Defined at line 108.

SocketRuntime.accept
def accept(self, listener_name: str, client_name: str) -> SocketHandle

Performs accept behavior in SocketRuntime.

Defined at line 117.

SocketRuntime.send
def send(self, name: str, data: bytes | str) -> None

Performs send behavior in SocketRuntime.

Defined at line 139.

SocketRuntime.receive
def receive(self, name: str, size: int = 4096) -> bytes

Performs receive behavior in SocketRuntime.

Defined at line 143.

SocketRuntime.close
def close(self, name: str) -> None

Performs close behavior in SocketRuntime.

Defined at line 146.

SocketRuntime.adopt
def adopt(self, name: str, stream: socket.socket | ssl.SSLSocket, secure: SocketSecureMode | str = SocketSecureMode.NONE) -> SocketHandle

Performs adopt behavior in SocketRuntime.

Defined at line 151.

SocketRuntime.close_all
def close_all(self) -> None

Performs close all behavior in SocketRuntime.

Defined at line 157.

SocketRuntime._handle
def _handle(self, name: str) -> SocketHandle

Internal helper in SocketRuntime for handle.

Defined at line 161.

SocketRuntime._secure_mode
def _secure_mode(self, descriptor: SocketDescriptor) -> SocketSecureMode

Internal helper in SocketRuntime for secure mode.

Defined at line 167.

SocketRuntime._client_context
def _client_context(self, descriptor: SocketDescriptor) -> ssl.SSLContext

Internal helper in SocketRuntime for client context.

Defined at line 170.

SocketRuntime._server_context
def _server_context(self, descriptor: SocketDescriptor) -> ssl.SSLContext

Internal helper in SocketRuntime for server context.

Defined at line 179.

SocketStreamRuntime

class SocketStreamRuntime

Class implementing socket stream runtime behavior in the PL/I compiler.

Defined at line 187.

Methods:

SocketStreamRuntime.__init__
def __init__(self, primitive: SocketRuntime | None = None) -> None

Initializes an instance of SocketStreamRuntime.

Defined at line 188.

SocketStreamRuntime.open
def open(self, descriptor: SocketFileDescriptor) -> SocketHandle

Performs open behavior in SocketStreamRuntime.

Defined at line 191.

SocketStreamRuntime.close
def close(self, descriptor: SocketFileDescriptor) -> None

Performs close behavior in SocketStreamRuntime.

Defined at line 196.

SocketStreamRuntime.adopt
def adopt(self, name: str, stream: socket.socket | ssl.SSLSocket, secure: SocketSecureMode | str = SocketSecureMode.NONE) -> SocketHandle

Performs adopt behavior in SocketStreamRuntime.

Defined at line 199.

SocketStreamRuntime.write_payload
def write_payload(self, descriptor: SocketFileDescriptor, data: bytes | str) -> None

Performs write payload behavior in SocketStreamRuntime.

Defined at line 202.

SocketStreamRuntime.read_payload
def read_payload(self, descriptor: SocketFileDescriptor, size: int | None = None) -> bytes | str

Performs read payload behavior in SocketStreamRuntime.

Defined at line 205.

SocketStreamRuntime.write_record
def write_record(self, descriptor: SocketFileDescriptor, data: bytes | str) -> None

Performs write record behavior in SocketStreamRuntime.

Defined at line 208.

SocketStreamRuntime.read_record
def read_record(self, descriptor: SocketFileDescriptor, size: int | None = None) -> bytes | str

Performs read record behavior in SocketStreamRuntime.

Defined at line 225.

SocketStreamRuntime.execute
def execute(self, statement: IOStatement, descriptors: dict[str, SocketFileDescriptor], variables: dict[str, object] | None = None) -> None

Performs execute behavior in SocketStreamRuntime.

Defined at line 243.

SocketStreamRuntime.close_all
def close_all(self) -> None

Performs close all behavior in SocketStreamRuntime.

Defined at line 261.

SocketStreamRuntime._read_exact
def _read_exact(self, name: str, size: int) -> bytes

Internal helper in SocketStreamRuntime for read exact.

Defined at line 264.

SocketStreamRuntime._io_value
def _io_value(self, statement: IOStatement, variables: dict[str, object]) -> bytes | str

Internal helper in SocketStreamRuntime for io value.

Defined at line 277.

pl1compinpy.runtime.strings

Source: pl1compinpy/runtime/strings.py

Module containing strings support for the PL/I compiler.

Classes

StringRuntimeError

class StringRuntimeError(ValueError)

Exception type raised for string runtime errors.

Defined at line 8.

StringValue

class StringValue

Data container describing string value values used by the compiler.

Defined at line 13.

Methods:

StringValue.storage
def storage(self) -> bytearray

Performs storage behavior in StringValue.

Defined at line 18.

StringValue.length
def length(self) -> int

Performs length behavior in StringValue.

Defined at line 22.

StringValue.payload
def payload(self) -> bytes

Performs payload behavior in StringValue.

Defined at line 26.

StringValue.text
def text(self, encoding: str = 'utf-8') -> str

Performs text behavior in StringValue.

Defined at line 29.

StringRuntime

class StringRuntime

Class implementing string runtime behavior in the PL/I compiler.

Defined at line 33.

Methods:

StringRuntime.__init__
def __init__(self, heap: HeapRuntime | None = None) -> None

Initializes an instance of StringRuntime.

Defined at line 34.

StringRuntime.allocate
def allocate(self, data: bytes | str, encoding: str = 'utf-8') -> StringValue

Performs allocate behavior in StringRuntime.

Defined at line 37.

StringRuntime.substr
def substr(self, value: StringValue, start: int, count: int | None = None) -> StringValue

Performs substr behavior in StringRuntime.

Defined at line 47.

pl1compinpy.vsam

Source: pl1compinpy/vsam/__init__.py

Local VSAM-style catalog and binary data component runtime.

pl1compinpy.vsam.catalog

Source: pl1compinpy/vsam/catalog.py

Module containing catalog support for the PL/I compiler.

Classes

VSAMError

class VSAMError(ValueError)

Exception type raised for compiler errors.

Defined at line 9.

VSAMType

class VSAMType(str, Enum)

Class implementing vsamtype behavior in the PL/I compiler.

Defined at line 13.

VSAMDefinition

class VSAMDefinition

Data container describing vsamdefinition values used by the compiler.

Defined at line 21.

VSAMCatalog

class VSAMCatalog

Class implementing vsamcatalog behavior in the PL/I compiler.

Defined at line 34.

Methods:

VSAMCatalog.__init__
def __init__(self, root: Path | str) -> None

Initializes an instance of VSAMCatalog.

Defined at line 35.

VSAMCatalog.define
def define(cls, root: Path | str, name: str, organization: VSAMType | str, *, key_offset: int = 0, key_length: int = 0, record_length: int | None = None) -> 'VSAMCatalog'

Performs define behavior in VSAMCatalog.

Defined at line 43.

VSAMCatalog.write
def write(self, record: bytes, *, key: bytes | str | None = None, rrn: int | None = None, rba: int | None = None) -> int

Performs write behavior in VSAMCatalog.

Defined at line 65.

VSAMCatalog.read
def read(self, *, key: bytes | str | None = None, rrn: int | None = None, rba: int | None = None, length: int | None = None) -> bytes

Performs read behavior in VSAMCatalog.

Defined at line 77.

VSAMCatalog._write_ksds
def _write_ksds(self, record: bytes, key: bytes | str | None) -> int

Internal helper in VSAMCatalog for write ksds.

Defined at line 99.

VSAMCatalog._write_rrds
def _write_rrds(self, record: bytes, rrn: int | None) -> int

Internal helper in VSAMCatalog for write rrds.

Defined at line 110.

VSAMCatalog._write_lds
def _write_lds(self, payload: bytes, rba: int | None) -> int

Internal helper in VSAMCatalog for write lds.

Defined at line 122.

VSAMCatalog._append_record
def _append_record(self, record: bytes) -> int

Internal helper in VSAMCatalog for append record.

Defined at line 129.

VSAMCatalog._append_raw
def _append_raw(self, payload: bytes) -> int

Internal helper in VSAMCatalog for append raw.

Defined at line 134.

VSAMCatalog._read_record_at
def _read_record_at(self, rba: int) -> bytes

Internal helper in VSAMCatalog for read record at.

Defined at line 140.

VSAMCatalog._read_at
def _read_at(self, rba: int, length: int) -> bytes

Internal helper in VSAMCatalog for read at.

Defined at line 149.

VSAMCatalog._key_text
def _key_text(self, key: bytes | str) -> str

Internal helper in VSAMCatalog for key text.

Defined at line 158.

VSAMCatalog._load
def _load(self) -> VSAMDefinition | None

Internal helper in VSAMCatalog for load.

Defined at line 161.

VSAMCatalog._save
def _save(self) -> None

Internal helper in VSAMCatalog for save.

Defined at line 167.

pl1compinpy.vsam.io

Source: pl1compinpy/vsam/io.py

Module containing io support for the PL/I compiler.

Classes

VSAMFileDescriptor

class VSAMFileDescriptor

Data container describing vsamfile descriptor values used by the compiler.

Defined at line 11.

Methods:

VSAMFileDescriptor.from_declaration
def from_declaration(cls, declaration: Declaration, base_path: Path | None = None) -> 'VSAMFileDescriptor'

Performs from declaration behavior in VSAMFileDescriptor.

Defined at line 21.

VSAMRuntime

class VSAMRuntime

Class implementing vsamruntime behavior in the PL/I compiler.

Defined at line 43.

Methods:

VSAMRuntime.__init__
def __init__(self) -> None

Initializes an instance of VSAMRuntime.

Defined at line 44.

VSAMRuntime.open
def open(self, descriptor: VSAMFileDescriptor) -> None

Performs open behavior in VSAMRuntime.

Defined at line 47.

VSAMRuntime.close
def close(self, descriptor: VSAMFileDescriptor) -> None

Performs close behavior in VSAMRuntime.

Defined at line 62.

VSAMRuntime.write_record
def write_record(self, descriptor: VSAMFileDescriptor, data: bytes | str, *, key: bytes | str | None = None, rrn: int | None = None, rba: int | None = None) -> int

Performs write record behavior in VSAMRuntime.

Defined at line 65.

VSAMRuntime.read_record
def read_record(self, descriptor: VSAMFileDescriptor, *, key: bytes | str | None = None, rrn: int | None = None, rba: int | None = None, length: int | None = None) -> bytes

Performs read record behavior in VSAMRuntime.

Defined at line 77.

VSAMRuntime.execute
def execute(self, statement: IOStatement, descriptors: dict[str, VSAMFileDescriptor], variables: dict[str, object] | None = None) -> None

Performs execute behavior in VSAMRuntime.

Defined at line 88.

VSAMRuntime._catalog
def _catalog(self, descriptor: VSAMFileDescriptor) -> VSAMCatalog

Internal helper in VSAMRuntime for catalog.

Defined at line 118.

VSAMRuntime._optional_value
def _optional_value(self, expression: Expression | None, variables: dict[str, object]) -> bytes | str | None

Internal helper in VSAMRuntime for optional value.

Defined at line 124.

VSAMRuntime._optional_key
def _optional_key(self, descriptor: VSAMFileDescriptor, expression: Expression | None, variables: dict[str, object]) -> bytes | str | None

Internal helper in VSAMRuntime for optional key.

Defined at line 130.

VSAMRuntime._optional_int
def _optional_int(self, expression: Expression | None, variables: dict[str, object]) -> int | None

Internal helper in VSAMRuntime for optional int.

Defined at line 136.

VSAMRuntime._value
def _value(self, expression: Expression | None, variables: dict[str, object]) -> object

Internal helper in VSAMRuntime for value.

Defined at line 142.