import * as ast from "../ast"; export declare type GlobalEnv = { readonly libstructs: Set; readonly libfuncs: Set; readonly decls: ast.Declaration[]; }; /** * An ActualType is the (non-identifier) type that can be typedefed. */ export declare type ActualType = ast.IntType | ast.BoolType | ast.StringType | ast.CharType | ast.PointerType | ast.ArrayType | ast.StructType | { tag: "NamedFunctionType"; definition: ast.FunctionDeclaration; }; /** * Look at a typedef */ export declare function getTypeDef(genv: GlobalEnv, t: string): ActualType | ast.ValueType | null; export declare function initEmpty(): GlobalEnv; /** * Create an initial GlobalEnv with the correct type for main() */ export declare function initMain(): GlobalEnv; /** * Insert a (typechecked) declaration into the global environment. */ export declare function addDecl(library: boolean, genv: GlobalEnv, decl: ast.Declaration): void; /** * Checks if an identifier is a known library function. */ export declare function isLibraryFunction(genv: GlobalEnv, t: string): boolean; /** * Checks if an identifier is a known library struct. */ export declare function isLibraryStruct(genv: GlobalEnv, t: string): boolean; /** * Given an ostensible function name, get the relevant function definition (if one exists), or the * latest function declaration (if no definition exists). No declaration may exist; the function will * then return 'null'. */ export declare function getFunctionDeclaration(genv: GlobalEnv, t: string): ast.FunctionDeclaration | null; /** * Given 'struct foobar', this function looks up the operative definition or declaration for * 'foobar'. No declaration may exist; the function will then return 'null'. */ export declare function getStructDefinition(genv: GlobalEnv, t: string): ast.StructDeclaration | null; /** * Given an ast.Type, return an identifier-free variant of that type */ export declare function actualType(genv: GlobalEnv, t: ActualType | ast.Type): ActualType | ast.VoidType; export declare function fullTypeName(genv: GlobalEnv, t: ActualType | ast.Type): string; export declare function concreteType(genv: GlobalEnv, t: ActualType | ast.Type): ast.ConcreteType;