UNPKG

js-slang

Version:

Javascript-based implementations of Source, written in Typescript

28 lines (27 loc) 2.15 kB
/** * Utility functions for creating the various control instructions. */ import type es from 'estree'; import type { Environment, Node } from '../types'; import { Transformers } from './interpreter'; import { type AppInstr, type ArrLitInstr, type BinOpInstr, type BranchInstr, type DeclAssmtInstr, type EnvInstr, type ForInstr, type Instr, type RegularAssmtInstr, type UnOpInstr, type WhileInstr } from './types'; export declare const resetInstr: (srcNode: Node) => Instr; export declare const whileInstr: (test: es.Expression, body: es.Statement, srcNode: Node) => WhileInstr; export declare const forInstr: (init: es.VariableDeclaration | es.Expression, test: es.Expression, update: es.Expression, body: es.Statement, srcNode: es.ForStatement) => ForInstr; export declare function assmtInstr(symbol: string, srcNode: es.VariableDeclaration): DeclAssmtInstr; export declare function assmtInstr(symbol: string, srcNode: es.AssignmentExpression): RegularAssmtInstr; export declare const unOpInstr: (symbol: es.UnaryOperator, srcNode: es.UnaryExpression) => UnOpInstr; export declare const binOpInstr: (symbol: es.BinaryOperator, srcNode: Node) => BinOpInstr; export declare const popInstr: (srcNode: Node) => Instr; export declare const appInstr: (numOfArgs: number, srcNode: es.CallExpression) => AppInstr; export declare const branchInstr: (consequent: es.Expression | es.Statement, alternate: es.Expression | es.Statement | null | undefined, srcNode: Node) => BranchInstr; export declare const envInstr: (env: Environment, transformers: Transformers, srcNode: Node) => EnvInstr; export declare const arrLitInstr: (arity: number, srcNode: Node) => ArrLitInstr; export declare const arrAccInstr: (srcNode: Node) => Instr; export declare const arrAssmtInstr: (srcNode: Node) => Instr; export declare const markerInstr: (srcNode: Node) => Instr; export declare const contInstr: (srcNode: Node) => Instr; export declare const contMarkerInstr: (srcNode: Node) => Instr; export declare const breakInstr: (srcNode: Node) => Instr; export declare const breakMarkerInstr: (srcNode: Node) => Instr; export declare const spreadInstr: (srcNode: Node) => Instr;