python2igcse
Version:
Convert Python code to IGCSE Pseudocode format
37 lines • 1.52 kB
TypeScript
/**
* Data types supported by IGCSE Pseudocode
*/
export type IGCSEDataType = 'INTEGER' | 'REAL' | 'STRING' | 'BOOLEAN' | 'CHAR' | 'ARRAY' | 'RECORD' | 'ANY';
/**
* IGCSE Pseudocode operators
*/
export type IGCSEOperator = '←' | '=' | '≠' | '<' | '>' | '≤' | '≥' | 'AND' | 'OR' | 'NOT' | '+' | '-' | '*' | '/' | 'MOD' | 'DIV';
/**
* IGCSE Pseudocode keywords
*/
export type IGCSEKeyword = 'IF' | 'THEN' | 'ELSE' | 'ENDIF' | 'FOR' | 'TO' | 'STEP' | 'NEXT' | 'WHILE' | 'ENDWHILE' | 'REPEAT' | 'UNTIL' | 'PROCEDURE' | 'ENDPROCEDURE' | 'FUNCTION' | 'RETURNS' | 'ENDFUNCTION' | 'RETURN' | 'INPUT' | 'OUTPUT' | 'CASE' | 'OF' | 'OTHERWISE' | 'ENDCASE' | 'TYPE' | 'ENDTYPE' | 'CLASS' | 'ENDCLASS' | 'DECLARE' | 'CONSTANT' | 'ARRAY' | 'RECORD';
/**
* Mapping from Python operators to IGCSE operators
*/
export declare const PYTHON_TO_IGCSE_OPERATORS: Record<string, IGCSEOperator>;
/**
* Mapping from Python types to IGCSE types
*/
export declare const PYTHON_TO_IGCSE_TYPES: Record<string, IGCSEDataType>;
/**
* Check IGCSE Pseudocode reserved words
*/
export declare function isIGCSEKeyword(word: string): boolean;
/**
* Convert Python operator to IGCSE operator
*/
export declare function convertOperator(pythonOp: string): IGCSEOperator;
/**
* Convert Python type to IGCSE type
*/
export declare function convertDataType(pythonType: string): IGCSEDataType;
/**
* Helper function for type inference
*/
export declare function inferDataType(value: any): IGCSEDataType;
//# sourceMappingURL=igcse.d.ts.map