python2ib
Version:
Convert Python code to IB Pseudocode format
50 lines • 2.06 kB
TypeScript
/**
* Main visitor for converting Python AST to IR
*/
import { BaseVisitor } from './base-visitor.js';
import { PythonASTNode } from '../ast-parser.js';
import { IR } from '../../types/ir.js';
import { ConvertOptions } from '../../types/config.js';
/** Main Python to IR visitor */
export declare class PythonToIRVisitor extends BaseVisitor {
constructor(config: Required<ConvertOptions>);
/** Visit Module (root node) */
visitModule(node: PythonASTNode): IR;
/** Visit Assignment statement */
visitAssign(node: PythonASTNode): IR;
/** Visit tuple assignment (multiple assignment) */
private visitTupleAssignment;
/** Visit Expression statement */
visitExpr(node: PythonASTNode): IR;
/** Visit Print function call */
private visitPrintCall;
/** Visit Input function call */
private visitInputCall;
/** Visit Input function call in assignment */
private visitInputCallAssignment;
/** Visit If statement */
visitIf(node: PythonASTNode): IR;
/** Visit While statement */
visitWhile(node: PythonASTNode): IR;
/** Visit For statement */
visitFor(node: PythonASTNode): IR;
/** Visit Function definition */
visitFunctionDef(node: PythonASTNode): IR;
/** Visit Return statement */
visitReturn(node: PythonASTNode): IR;
/** Visit Pass statement */
visitPass(node: PythonASTNode): IR;
/** Visit Comment */
visitComment(node: PythonASTNode): IR;
/** Visit Call expression */
visitCall(node: PythonASTNode): IR;
/** Override extractBinaryOperation to handle operator precedence */
protected extractBinaryOperation(node: PythonASTNode, depth?: number): string;
/** Override extractCall to handle special cases */
protected extractCall(node: PythonASTNode): string;
/** Visit List node (array literal) */
visitList(node: PythonASTNode): IR;
/** Handle unsupported constructs with more specific messages */
protected visitUnsupported(node: PythonASTNode): IR;
}
//# sourceMappingURL=python-to-ir-visitor.d.ts.map