diff --git a/compiler/Python_CodeGen.jrag b/compiler/Python_CodeGen.jrag index ed3f2c7f7fcf7181ead73ad0a7fc27e30a955c86..fd25e18b4c53063da1ae5bcae04f137e0feb9939 100644 --- a/compiler/Python_CodeGen.jrag +++ b/compiler/Python_CodeGen.jrag @@ -80,11 +80,19 @@ aspect Python_CodeGen { env.println("import labcomm"); env.println(); Python_genTypes(env); - env.println("signatures = ["); + env.println("typedef = ["); + env.indent(); + for (int i = 0 ; i < getNumDecl() ; i++) { + getDecl(i).Python_genTypedefListEntry(env); + } + env.unindent(); + env.println("]"); + env.println("sample = ["); + env.indent(); for (int i = 0 ; i < getNumDecl() ; i++) { - env.println(" ('" + getDecl(i).getName() + "', " + - getDecl(i).getName() + ".signature),"); + getDecl(i).Python_genSampleListEntry(env); } + env.unindent(); env.println("]"); } @@ -109,7 +117,7 @@ aspect PythonTypes { } public void TypeDecl.Python_genSignature(Python_env env) { - env.println("no_signature = labcomm.typedef('" + getName() + "',"); + env.println("signature = labcomm.typedef('" + getName() + "',"); env.indent(); getType().Python_genSignature(env); env.unindent(); @@ -181,6 +189,20 @@ aspect PythonTypes { env.print(")"); } + public void Decl.Python_genTypedefListEntry(Python_env env) { + } + + public void TypeDecl.Python_genTypedefListEntry(Python_env env) { + env.println("('" + getName() + "', " + getName() + ".signature),"); + } + + public void Decl.Python_genSampleListEntry(Python_env env) { + } + + public void SampleDecl.Python_genSampleListEntry(Python_env env) { + env.println("('" + getName() + "', " + getName() + ".signature),"); + } + public String Exp.Python_getValue() { throw new Error(this.getClass().getName() + ".Python_getValue()" +