{
int id = 0;
// fun new(p:ptr):void;
{
AbsFunDecl funDecl = new AbsFunDecl("new", null, null, null);
funDecl.frame = new Frame(funDecl, 0);
id--; funDecl.declId = id;
funDecl.semTyp = new SemFunTyp(new SemAtomTyp(SemAtomTyp.VOID));
((SemFunTyp)funDecl.semTyp).args.add(new SemPtrTyp(null));
try { SymTable.names.put(funDecl.name, funDecl); }
catch (SymDefinedAtThisScope _) {}
}
// fun free(p:ptr):void;
{
AbsFunDecl funDecl = new AbsFunDecl("free", null, null, null);
funDecl.frame = new Frame(funDecl, 0);
id--; funDecl.declId = id;
funDecl.semTyp = new SemFunTyp(new SemAtomTyp(SemAtomTyp.VOID));
((SemFunTyp)funDecl.semTyp).args.add(new SemPtrTyp(null));
try { SymTable.names.put(funDecl.name, funDecl); }
catch (SymDefinedAtThisScope _) {}
}
// fun read_char():char;
{
AbsFunDecl funDecl = new AbsFunDecl("read_char", null, null, null);
funDecl.frame = new Frame(funDecl, 0);
id--; funDecl.declId = id;
funDecl.semTyp = new SemFunTyp(new SemAtomTyp(SemAtomTyp.CHAR));
try { SymTable.names.put(funDecl.name, funDecl); }
catch (SymDefinedAtThisScope _) {}
}
// fun read_int():int;
{
AbsFunDecl funDecl = new AbsFunDecl("read_int", null, null, null);
funDecl.frame = new Frame(funDecl, 0);
id--; funDecl.declId = id;
funDecl.semTyp = new SemFunTyp(new SemAtomTyp(SemAtomTyp.INT));
try { SymTable.names.put(funDecl.name, funDecl); }
catch (SymDefinedAtThisScope _) {}
}
// fun print_char(c:char):void;
{
AbsFunDecl funDecl = new AbsFunDecl("print_char", null, null, null);
funDecl.frame = new Frame(funDecl, 0);
id--; funDecl.declId = id;
funDecl.semTyp = new SemFunTyp(new SemAtomTyp(SemAtomTyp.VOID));
((SemFunTyp)funDecl.semTyp).args.add(new SemAtomTyp(SemAtomTyp.CHAR));
try { SymTable.names.put(funDecl.name, funDecl); }
catch (SymDefinedAtThisScope _) {}
}
// fun print_int(i:int):void;
{
AbsFunDecl funDecl = new AbsFunDecl("print_int", null, null, null);
funDecl.frame = new Frame(funDecl, 0);
id--; funDecl.declId = id;
funDecl.semTyp = new SemFunTyp(new SemAtomTyp(SemAtomTyp.VOID));
((SemFunTyp)funDecl.semTyp).args.add(new SemAtomTyp(SemAtomTyp.INT));
try { SymTable.names.put(funDecl.name, funDecl); }
catch (SymDefinedAtThisScope _) {}