diff --git a/compiler/2014/CS_CodeGen.jrag b/compiler/2014/CS_CodeGen.jrag
index 1dfb8189bb51b20a7a4b393bbce1d021d90820e7..c05e6b2fe7456c5e748c6d87dc95b1cf1162233d 100644
--- a/compiler/2014/CS_CodeGen.jrag
+++ b/compiler/2014/CS_CodeGen.jrag
@@ -176,11 +176,11 @@ aspect CS_StructName {
 
   inh int Decl.CS_Depth();
   inh int DataType.CS_Depth();
-  eq Program.getDecl(int i).CS_Depth() = 0;
+  eq Specification.getDecl(int i).CS_Depth() = 0;
   eq StructType.getField(int i).CS_Depth() = CS_Depth() + 1;
 
   inh String DataType.CS_structName();
-  eq Program.getDecl(int i).CS_structName() = getDecl(i).getName();
+  eq Specification.getDecl(int i).CS_structName() = getDecl(i).getName();
   eq StructType.getField(int i).CS_structName() {
     if (CS_Depth() == 0) {
       return "struct_" + getField(i).getName();
@@ -201,7 +201,7 @@ aspect CS_Void {
 
 aspect CS_CodeGen {
 
-  public void Program.CS_gen(String file, 
+  public void Specification.CS_gen(String file, 
 			     String namespace, int version) throws IOException {
     // Registration class
     CS_env env = new CS_env(new File(file), version);
@@ -230,7 +230,7 @@ aspect CS_CodeGen {
 
 aspect CS_Register {
 
-  public void Program.CS_emitTypeRegister(CS_env env) {
+  public void Specification.CS_emitTypeRegister(CS_env env) {
   }
 
   public void Decl.CS_emitTypeRegister(CS_env env) {
@@ -935,7 +935,7 @@ aspect CS_Signature {
 
 aspect CS_Info {
 
-  public void Program.CS_info(PrintStream out, String namespace, int version) {
+  public void Specification.CS_info(PrintStream out, String namespace, int version) {
     CS_env env = new CS_env(out, version);
     if (namespace == null) {
       namespace = ""; 
diff --git a/compiler/2014/C_CodeGen.jrag b/compiler/2014/C_CodeGen.jrag
index 526b2ad02d60c303a928e1f007d6632a9047c2af..afa7f042bb50abebf92e35cfa8ea30ddc1dad8a8 100644
--- a/compiler/2014/C_CodeGen.jrag
+++ b/compiler/2014/C_CodeGen.jrag
@@ -177,7 +177,7 @@ aspect C_IsDynamic {
 
 aspect C_CodeGen {
 
-  public void Program.C_genH(PrintStream out, Vector includes, 
+  public void Specification.C_genH(PrintStream out, Vector includes, 
 			     String lcName, String prefix, int version) {
     C_env env = new C_env("", lcName, prefix, out, version);
 
@@ -203,7 +203,7 @@ aspect C_CodeGen {
     env.println("#endif");
   }
 
-  public void Program.C_genC(PrintStream out, Vector includes, 
+  public void Specification.C_genC(PrintStream out, Vector includes, 
 			     String lcName, String prefix, int version) {
     C_env env = new C_env("", lcName, prefix, out, version);
 
@@ -219,7 +219,7 @@ aspect C_CodeGen {
     C_emitC(env);
   }
 
-  public void Program.C_emitH(C_env env) {
+  public void Specification.C_emitH(C_env env) {
     for (int i = 0; i < getNumDecl(); i++) {
       getDecl(i).C_emitType(env);
       getDecl(i).C_emitDecoderDeclaration(env);
@@ -233,7 +233,7 @@ aspect C_CodeGen {
     C_emitForAll(env);
   }
 
-  public void Program.C_emitC(C_env env) {
+  public void Specification.C_emitC(C_env env) {
     for (int i = 0; i < getNumDecl(); i++) {
       getDecl(i).C_emitSignature(env);
       getDecl(i).C_emitDecoder(env);
@@ -1462,7 +1462,7 @@ aspect C_Constructor {
 		    " not declared");
   }
 
-  public void Program.C_emitConstructor(C_env env) {
+  public void Specification.C_emitConstructor(C_env env) {
     env.println("LABCOMM_CONSTRUCTOR void init_" +
 		env.prefix + "_signatures(void)");
     env.println("{");
@@ -1499,7 +1499,7 @@ aspect C_Constructor {
 		    " not declared");
   }
 
-  public void Program.C_emitConstructorDeclaration(C_env env) {
+  public void Specification.C_emitConstructorDeclaration(C_env env) {
     env.println("void init_" + env.prefix + "_signatures(void);");
   }
 
@@ -1688,7 +1688,7 @@ aspect C_Sizeof {
 
 aspect C_forAll {
 
-  public void Program.C_emitForAll(C_env env) {
+  public void Specification.C_emitForAll(C_env env) {
     env.print("#define LABCOMM_FORALL_SAMPLES_" + env.lcName + 
 		"(func, sep)");
     env.indent();
@@ -1718,7 +1718,7 @@ aspect C_forAll {
 
 aspect C_Info {
 
-  public void Program.C_info(PrintStream out, String prefix, int version) {
+  public void Specification.C_info(PrintStream out, String prefix, int version) {
     C_env env = new C_env("", "", prefix, out, version);
     for (int i = 0; i < getNumDecl(); i++) {
       getDecl(i).C_info(env);
diff --git a/compiler/2014/DeclNames.jrag b/compiler/2014/DeclNames.jrag
index c448c6d7e73933815e0fbee438ac437f05f65561..c82ad18543e289b87a53da896d23ba87237f742e 100644
--- a/compiler/2014/DeclNames.jrag
+++ b/compiler/2014/DeclNames.jrag
@@ -1,6 +1,6 @@
 aspect DeclNames {
 	inh String DataType.declName();
-	eq Decl.DataType().declName() = getName();
+	eq Decl.getTypeInstance().declName() = getName();
 
 	inh String Field.declName();
 	eq StructType.getField(int i).declName() = declName();
@@ -9,6 +9,6 @@ aspect DeclNames {
 
         inh Decl DataType.parentDecl();
         inh Decl Field.parentDecl();
-        eq Decl.getDataType().parentDecl() = this;
+        eq Decl.getTypeInstance().parentDecl() = this;
         eq StructType.getField(int i).parentDecl() = parentDecl();
 }
diff --git a/compiler/2014/Java_CodeGen.jrag b/compiler/2014/Java_CodeGen.jrag
index 90a641d9f2c9ba8c2ddc9c1df6f5000ed7e08d7b..456ada22f63d8ec25551ae0481d7574776875244 100644
--- a/compiler/2014/Java_CodeGen.jrag
+++ b/compiler/2014/Java_CodeGen.jrag
@@ -179,11 +179,11 @@ aspect Java_StructName {
 
   inh int Decl.Java_Depth();
   inh int DataType.Java_Depth();
-  eq Program.getDecl(int i).Java_Depth() = 0;
+  eq Specification.getDecl(int i).Java_Depth() = 0;
   eq StructType.getField(int i).Java_Depth() = Java_Depth() + 1;
 
   inh String DataType.Java_structName();
-  eq Program.getDecl(int i).Java_structName() = getDecl(i).getName();
+  eq Specification.getDecl(int i).Java_structName() = getDecl(i).getName();
   eq StructType.getField(int i).Java_structName() {
     if (Java_Depth() == 0) {
       return "struct_" + getField(i).getName();
@@ -204,7 +204,7 @@ aspect Java_Void {
 
 aspect Java_CodeGen {
 
-  public void Program.J_gen(PrintStream ps, String pack, int version) throws IOException {
+  public void Specification.J_gen(PrintStream ps, String pack, int version) throws IOException {
     Java_env env;
     env = new Java_env(version, ps);
     for (int i = 0; i < getNumDecl(); i++) {
@@ -219,7 +219,7 @@ aspect Java_CodeGen {
     env.close();
   }
 
-  public void Program.J_gen(String dir, String pack, int version) throws IOException {
+  public void Specification.J_gen(String dir, String pack, int version) throws IOException {
     Java_env env;
     for (int i = 0; i < getNumDecl(); i++) {
       Decl d = getDecl(i);
@@ -236,7 +236,7 @@ aspect Java_CodeGen {
 
   /** Experimental method for generating code to a map <classname, source>
     */
-  public void Program.J_gen(Map<String,String> src, String pack, int version) throws IOException {
+  public void Specification.J_gen(Map<String,String> src, String pack, int version) throws IOException {
     Java_env env;
     for (int i = 0; i < getNumDecl(); i++) {
       Decl d = getDecl(i);
@@ -1032,7 +1032,7 @@ aspect Java_Signature {
 
 aspect Java_Info {
 
-  public void Program.Java_info(PrintStream out, int version) {
+  public void Specification.Java_info(PrintStream out, int version) {
     Java_env env = new Java_env(version, out);
     for (int i = 0; i < getNumDecl(); i++) {
       getDecl(i).Java_info(env);
diff --git a/compiler/2014/LabComm.ast b/compiler/2014/LabComm.ast
index e861eafaf9986a2d93241236faa8aca65241f6ad..3e1015e27cd75d5e632bbf42e39d575b65c280f5 100644
--- a/compiler/2014/LabComm.ast
+++ b/compiler/2014/LabComm.ast
@@ -1,6 +1,8 @@
-Program ::= Decl*;
+Specification ::= Decl*;
 
-abstract Decl ::= DataType <Name:String> /Signature/;
+abstract Decl ::= TypeInstance /Signature/;
+
+TypeInstance ::= DataType <Name:String>;
 
 TypeDecl   : Decl;
 SampleDecl : Decl;
@@ -17,7 +19,7 @@ IntSignatureLine           : DataSignatureLine ::= <Data:int>;
 StringSignatureLine        : DataSignatureLine ::= <Data:String>;
 TypeRefSignatureLine       : SignatureLine     ::= Decl;
 
-Field ::= DataType <Name:String>;
+Field : TypeInstance;
 
 abstract DataType;
 VoidType           : DataType;
diff --git a/compiler/2014/LabComm.java b/compiler/2014/LabComm.java
index 2844ed2b87e39b9e9e6a625498baf2bb130b89a1..de6f6199f01f291d1365d0b2b343241b1751eaf5 100644
--- a/compiler/2014/LabComm.java
+++ b/compiler/2014/LabComm.java
@@ -48,7 +48,7 @@ public class LabComm {
      }
   }
 
-  private static void genH(Program p, String hName, 
+  private static void genH(Specification p, String hName, 
 			   Vector cIncludes, String coreName, String prefix, int ver) {
     try {
       FileOutputStream f;
@@ -63,7 +63,7 @@ public class LabComm {
     }
   }
 
-  private static void genC(Program p, String cName, 
+  private static void genC(Specification p, String cName, 
 			   Vector cIncludes, String coreName, String prefix, int ver) {
     try {
       FileOutputStream f;
@@ -78,7 +78,7 @@ public class LabComm {
     }
   }
 
-  private static void genCS(Program p, String csName, String csNamespace, int ver) {
+  private static void genCS(Specification p, String csName, String csNamespace, int ver) {
 //      throw new Error("C# generation currently disabled");
     try {
       p.CS_gen(csName, csNamespace, ver);
@@ -88,7 +88,7 @@ public class LabComm {
     }
   }
 
-  private static void genJava(Program p,  String dirName, String packageName, int ver) {
+  private static void genJava(Specification p,  String dirName, String packageName, int ver) {
     try {
       p.J_gen(dirName, packageName, ver);
     } catch (IOException e) {
@@ -97,7 +97,7 @@ public class LabComm {
     }
   }
 
-  private static void genPython(Program p, String filename, String prefix, int ver) {
+  private static void genPython(Specification p, String filename, String prefix, int ver) {
     try {
       FileOutputStream f;
       PrintStream out;
@@ -111,7 +111,7 @@ public class LabComm {
     }
   }
 
-  private static void genRAPID(Program p, String filename, String prefix, int ver) {
+  private static void genRAPID(Specification p, String filename, String prefix, int ver) {
     try {
       p.RAPID_gen(filename, prefix, ver);
     } catch (IOException e) {
@@ -239,14 +239,14 @@ public class LabComm {
      }
    }
 
-   Program parseFile(){
-     Program ast = null;
+   Specification parseFile(){
+     Specification ast = null;
      try {
        // Check for errors
        LabCommScanner scanner = new LabCommScanner(
                                   new FileReader(fileName));
        LabCommParser parser = new LabCommParser();
-       Program p = (Program)parser.parse(scanner);
+       Specification p = (Specification)parser.parse(scanner);
        Collection errors = new LinkedList();
        p.errorCheck(errors);
          
@@ -268,7 +268,7 @@ public class LabComm {
      return ast;
    }
 
-   boolean generateC(Program ast) {
+   boolean generateC(Specification ast) {
      boolean wroteFile = false; 
      Vector hIncludes = new Vector(cIncludes);
      if (hFile != null) {
@@ -287,7 +287,7 @@ public class LabComm {
      return wroteFile;
    }
   
-   boolean generateCS(Program ast) {
+   boolean generateCS(Specification ast) {
      boolean wroteFile = false; 
      if (csFile != null) {
        printStatus("C#: " , csFile); 
@@ -297,7 +297,7 @@ public class LabComm {
      return wroteFile;
    }
   
-   boolean generateJava(Program ast) {
+   boolean generateJava(Specification ast) {
      boolean wroteFile = false; 
      if (javaDir != null) {
        printStatus("Java: " , javaDir);
@@ -307,7 +307,7 @@ public class LabComm {
      return wroteFile;
    }
   
-   boolean generatePython(Program ast) {
+   boolean generatePython(Specification ast) {
      boolean wroteFile = false; 
      if (pythonFile != null) {
        printStatus("Python: " , pythonFile); 
@@ -317,7 +317,7 @@ public class LabComm {
      return wroteFile;
    }
   
-   boolean generateRAPID(Program ast) {
+   boolean generateRAPID(Specification ast) {
      boolean wroteFile = false; 
      if (rapidFile != null) {
        printStatus("RAPID: " , rapidFile);
@@ -326,7 +326,7 @@ public class LabComm {
      }
      return wroteFile;
    }
-   boolean generatePrettyPrint(Program ast) {
+   boolean generatePrettyPrint(Specification ast) {
      boolean wroteFile = false; 
      if (prettyFile != null) {
        printStatus("Pretty: " , prettyFile); 
@@ -343,7 +343,7 @@ public class LabComm {
      return wroteFile;
    }
   
-   boolean generateTypeinfo(Program ast) {
+   boolean generateTypeinfo(Specification ast) {
      boolean wroteFile = false; 
      if (typeinfoFile != null) {
        printStatus("TypeInfo: " , typeinfoFile); 
@@ -376,7 +376,7 @@ public class LabComm {
       System.exit(1);
     } else {
       opts.processArgs();
-      Program ast =  opts.parseFile();
+      Specification ast =  opts.parseFile();
 
       if (ast != null) {
 	
diff --git a/compiler/2014/LabCommParser.parser b/compiler/2014/LabCommParser.parser
index 7719936e3d7fa5f36561937cba2bb8afb945bcde..b1252acc99ad701597684181669adffffbe25586 100644
--- a/compiler/2014/LabCommParser.parser
+++ b/compiler/2014/LabCommParser.parser
@@ -34,9 +34,9 @@
         }
 :};
 
-Program goal =
-     /* Empty program */               {: return new Program(); :}
-  |  decl_list.l                       {: return new Program(l); :}
+Specification goal =
+     /* Empty program */               {: return new Specification(); :}
+  |  decl_list.l                       {: return new Specification(l); :}
   ;
 
 List decl_list =
@@ -54,6 +54,12 @@ List var_decl_list =
   | var_decl_list.l var_decl.v      {: return l.add(v); :}
   ;
 
+TypeInstance type_instance =
+    type.t IDENTIFIER {: return new TypeInstance(t, IDENTIFIER); :}
+  | type.t IDENTIFIER dim_list.d
+    {: return new TypeInstance(new ParseArrayType(t, d), IDENTIFIER); :}
+  ;
+
 Field var_decl =
     type.t IDENTIFIER SEMICOLON     {: return new Field(t, IDENTIFIER); :}
   | type.t IDENTIFIER dim_list.d SEMICOLON
@@ -61,17 +67,10 @@ Field var_decl =
   ;
 
 TypeDecl type_decl =
-    TYPEDEF type.t IDENTIFIER SEMICOLON {: return new TypeDecl(t, IDENTIFIER); :}
-  | TYPEDEF type.t IDENTIFIER dim_list.d SEMICOLON
-    {: return new TypeDecl(new ParseArrayType(t, d), IDENTIFIER); :}
-  ;
+    TYPEDEF type_instance.t  SEMICOLON {: return new TypeDecl(t); :} ;
 
 SampleDecl sample_decl =
-    SAMPLE type.t IDENTIFIER SEMICOLON
-      {: return new SampleDecl(t, IDENTIFIER); :}
-  | SAMPLE type.t IDENTIFIER dim_list.d SEMICOLON
-      {: return new SampleDecl(new ParseArrayType(t, d), IDENTIFIER); :}
-  ;
+    SAMPLE type_instance.t SEMICOLON {: return new SampleDecl(t); :} ;
 
 DataType type =
     prim_type.p                     {: return p; :}
@@ -109,8 +108,8 @@ StructType struct_type =
     STRUCT LBRACE var_decl_list.l RBRACE {: return new StructType(l); :}
   ;
 
-VoidType void_type = 
-    VOID {: return new VoidType(); :} 
+VoidType void_type =
+    VOID {: return new VoidType(); :}
 ;
 
 List dim_list =
diff --git a/compiler/2014/NameAnalysis.jrag b/compiler/2014/NameAnalysis.jrag
index f9012108517f577686270a3fcbc6a7400a0121aa..dfa80a2d2bdac1807293ceab3a68e4c7fddc711e 100644
--- a/compiler/2014/NameAnalysis.jrag
+++ b/compiler/2014/NameAnalysis.jrag
@@ -2,7 +2,7 @@
 aspect NameAnalysis {
 
   inh String Decl.lookupName(String name);
-  eq Program.getDecl(int index).lookupName(String name) {
+  eq Specification.getDecl(int index).lookupName(String name) {
     for (int i = 0; i < index; i++) {
       String s = getDecl(i).getName();
       if (s.equals(name)) {
@@ -24,7 +24,7 @@ aspect NameAnalysis {
 
   inh TypeDecl Decl.lookupType(String name);
   inh TypeDecl UserType.lookupType(String name);
-  eq Program.getDecl(int index).lookupType(String name) {
+  eq Specification.getDecl(int index).lookupType(String name) {
     for(int i = 0; i < index; i++) {
       Decl d = getDecl(i);  
       if(d instanceof TypeDecl && d.getName().equals(name)) {
diff --git a/compiler/2014/PrettyPrint.jrag b/compiler/2014/PrettyPrint.jrag
index 35904daa2280e1c14acd35ec8172ea59e9570986..f778d00d161c2a62c00fe31aa3a7a9dddf63d94d 100644
--- a/compiler/2014/PrettyPrint.jrag
+++ b/compiler/2014/PrettyPrint.jrag
@@ -6,7 +6,7 @@ aspect PPIndentation {
   inh String Field.pp_indent();
   inh String StructType.pp_indent();
   eq StructType.getField(int index).pp_indent() = pp_indent() + "  ";
-  eq Program.getDecl(int index).pp_indent() = "";
+  eq Specification.getDecl(int index).pp_indent() = "";
   
 }
 
@@ -18,7 +18,7 @@ aspect PrettyPrint {
 		    " not declared");
   }
 
-  public void Program.pp(PrintStream out) {
+  public void Specification.pp(PrintStream out) {
     for(int i = 0; i < getNumDecl(); i++) {
     	getDecl(i).pp(out);
     }
diff --git a/compiler/2014/Python_CodeGen.jrag b/compiler/2014/Python_CodeGen.jrag
index cc238d798d307e574e8b9e7ee9f20ff625c43a4d..ac74601430639c648bcab466dea49ebc8e315770 100644
--- a/compiler/2014/Python_CodeGen.jrag
+++ b/compiler/2014/Python_CodeGen.jrag
@@ -72,7 +72,7 @@ aspect Python_CodeGenEnv {
 
 aspect Python_CodeGen {
 
-  public void Program.Python_gen(PrintStream out, String baseName, int version) {
+  public void Specification.Python_gen(PrintStream out, String baseName, int version) {
     Python_env env = new Python_env(out);
     env.println("#!/usr/bin/python");
     env.println("# Auto generated " + baseName);
@@ -100,7 +100,7 @@ aspect Python_CodeGen {
 
 aspect PythonTypes {
   
-  public void Program.Python_genTypes(Python_env env) {
+  public void Specification.Python_genTypes(Python_env env) {
     for (int i = 0 ; i < getNumDecl() ; i++) {
       getDecl(i).Python_genSignatureAndTypedef(env);
     }
diff --git a/compiler/2014/RAPID_CodeGen.jrag b/compiler/2014/RAPID_CodeGen.jrag
index dc3f343ac66067df0ddc746f9814e1b3963cb663..78f9c970014fc944268eee5bc070694cf3592b80 100644
--- a/compiler/2014/RAPID_CodeGen.jrag
+++ b/compiler/2014/RAPID_CodeGen.jrag
@@ -77,7 +77,7 @@ aspect RAPID_CodeGen {
 		throw new UnsupportedOperationException();
 	}
 
-	public void Program.RAPID_gen(String file, String prefix, int version)
+	public void Specification.RAPID_gen(String file, String prefix, int version)
 			throws IOException
 	{
 		PrintStream ps = new PrintStream(new FileOutputStream(new File(file)));
@@ -85,7 +85,7 @@ aspect RAPID_CodeGen {
 		RAPID_gen(env);
 	}
 
-	public void Program.RAPID_gen(RAPID_env env)
+	public void Specification.RAPID_gen(RAPID_env env)
 	{
 		for (int i = 0; i < getNumDecl(); i++) {
 			getDecl(i).RAPID_gen(env);
diff --git a/compiler/2014/Refactoring.jrag b/compiler/2014/Refactoring.jrag
new file mode 100644
index 0000000000000000000000000000000000000000..9f0d20c9c85f5c34631189b7e685b2d1b40031ae
--- /dev/null
+++ b/compiler/2014/Refactoring.jrag
@@ -0,0 +1,9 @@
+/* Temporary aspect with forwarding methods */
+aspect Refactoring {
+    syn String Decl.getName() = getTypeInstance().getName();
+    syn DataType Decl.getDataType() = getTypeInstance().getDataType();
+
+    public Field.Field(TypeInstance t) {
+        this(t.getDataType(), t.getName());
+    }
+}
diff --git a/compiler/2014/Signature.jrag b/compiler/2014/Signature.jrag
index f3f0119cadfc0968338b4d21c351f19ec2489691..fb911b61ddd9623106abf65fd1350b5933d5b8ab 100644
--- a/compiler/2014/Signature.jrag
+++ b/compiler/2014/Signature.jrag
@@ -1,6 +1,6 @@
 import java.util.*;
 
-aspect Signature {  
+aspect Signature {
 
   syn boolean Decl.isSampleDecl();
   eq TypeDecl.isSampleDecl() = false;
@@ -14,8 +14,7 @@ aspect Signature {
   inh Decl Signature.parentDecl();
   inh Decl SignatureList.parentDecl();
 
-
-  syn nta Signature Decl.getSignature() { 
+  syn nta Signature Decl.getSignature() {
     SignatureList sl = new SignatureList();
     genSigLineForDecl(sl, true);
     SignatureList fsl = new SignatureList();
@@ -90,7 +89,7 @@ aspect Signature {
 	    //add(packed, comment);
             data = packed;
         break;
-        default: 
+        default:
             throw new RuntimeException("Unsupported version = "+version+". This should never happen.");
       }
       return data;
@@ -152,8 +151,8 @@ aspect Signature {
 
 
   public void ASTNode.genSigLineForDecl(SignatureList list, boolean decl) {
-    throw new Error(this.getClass().getName() + 
-                    ".genSigLineForDecl(SignatureList list)" + 
+    throw new Error(this.getClass().getName() +
+                    ".genSigLineForDecl(SignatureList list)" +
                     " not declared");
   }
 
@@ -185,7 +184,7 @@ aspect Signature {
    * will always be a TypeRef
    */
   public void UserType.genSigLineForDecl(SignatureList list, boolean decl) {
-      
+
       TypeDecl thet = lookupType(getName());
       list.addTypeRef(thet, null);
   }
diff --git a/doc/.gitignore b/doc/.gitignore
index df2a6e60dbf0dc336f4bc67ea1ef1b99119b2bda..5021072672fc665c75baab966be3909932b35e93 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -4,4 +4,4 @@ tech_report.blg
 tech_report.fdb_latexmk
 tech_report.fls
 tech_report.log
-tech_report.pdf
\ No newline at end of file
+tech_report.pdf
diff --git a/doc/tech_report.tex b/doc/tech_report.tex
index 883fd4c3f951339188b1ee0f63372c97a36c41c0..e55ecc21badaeb3f9b456416edb66d3f1f8ea6ca 100644
--- a/doc/tech_report.tex
+++ b/doc/tech_report.tex
@@ -778,7 +778,7 @@ Avro has multiple codecs (for compression of the data):
 
 \subsection{Abstract syntax}
 \begin{verbatim}
-Program ::= Decl*;
+Specification ::= Decl*;
 
 abstract Decl ::= DataType <Name:String>;
 TypeDecl : Decl;
diff --git a/examples/duck_typing/animal.lc b/examples/duck_typing/animal.lc
index 3272ae98ecdb765f67651db557704e399222b115..187c772052eeeda7df5154115b409d1edd04e008 100644
--- a/examples/duck_typing/animal.lc
+++ b/examples/duck_typing/animal.lc
@@ -6,4 +6,4 @@ sample animal cow;
 sample animal dog;
 sample struct {
   string says;
-} duck;
\ No newline at end of file
+} duck;
diff --git a/examples/dynamic/test/DynamicPart.java b/examples/dynamic/test/DynamicPart.java
index 8a420aae7114b74342454819efa4b8e84debbcdb..d245cbc6d53be4413d18f52baf95e9709eeca6b9 100644
--- a/examples/dynamic/test/DynamicPart.java
+++ b/examples/dynamic/test/DynamicPart.java
@@ -158,7 +158,7 @@ public class DynamicPart {
 	}
 
 	public static InRAMCompiler generateCode(String lcDecl, HashMap<String, String> handlers) {
-		Program ast = null;
+		Specification ast = null;
 		InputStream in = new ByteArrayInputStream(lcDecl.getBytes());
 		LabCommScanner scanner = new LabCommScanner(in);
 		LabCommParser parser = new LabCommParser();
@@ -166,7 +166,7 @@ public class DynamicPart {
 
 		InRAMCompiler irc = null;
 		try {
-			Program p = (Program)parser.parse(scanner);
+			Specification p = (Specification)parser.parse(scanner);
 			p.errorCheck(errors);
 			if (errors.isEmpty()) {
 				ast = p;
@@ -197,7 +197,7 @@ public class DynamicPart {
 	 * @param handlers - a map <name, source> of handlers for the types in ast
 	 * @return an InRAMCompiler object containing the generated clases
 	 */
-	private static InRAMCompiler handleAst(Program lcAST, HashMap<String, String> handlers) {
+	private static InRAMCompiler handleAst(Specification lcAST, HashMap<String, String> handlers) {
 		Map<String, String> genCode = new HashMap<String, String>();
 		try {
 			lcAST.J_gen(genCode, "labcomm.generated", 2014);
diff --git a/examples/dynamic/test/TestLabCommCompiler.java b/examples/dynamic/test/TestLabCommCompiler.java
index b0783456c36e03c103485c1e19c6adcdd54ed9f5..6141cff09e04306fa3db7da9aeec6c030f46f0a3 100644
--- a/examples/dynamic/test/TestLabCommCompiler.java
+++ b/examples/dynamic/test/TestLabCommCompiler.java
@@ -22,7 +22,7 @@ import se.lth.control.labcomm2014.Encoder;
 import se.lth.control.labcomm2014.EncoderChannel;
 import AST.Parser;
 import AST.Scanner;
-import AST.Program;
+import AST.Specification;
 import beaver.Parser.Exception;
 
 
@@ -121,7 +121,7 @@ public class TestCompiler {
 
 	}
 	public static InRAMCompiler generateCode(String lcDecl, HashMap<String, String> handlers) {
-		Program ast = null;
+		Specification ast = null;
 		InputStream in = new ByteArrayInputStream(lcDecl.getBytes());
 		Scanner scanner = new Scanner(in);
 		Parser parser = new Parser();
@@ -129,7 +129,7 @@ public class TestCompiler {
 
 		InRAMCompiler irc = null;
 		try {
-			Program p = (Program)parser.parse(scanner);
+			Specification p = (Specification)parser.parse(scanner);
 			p.errorCheck(errors);
 			if (errors.isEmpty()) {
 				ast = p;
@@ -207,7 +207,7 @@ public class TestCompiler {
 	 * @param handlers - a map <name, source> of handlers for the types in ast
 	 * @return an InRAMCompiler object containing the generated clases
 	 */
-	private static InRAMCompiler handleAst(Program lcAST, HashMap<String, String> handlers) {
+	private static InRAMCompiler handleAst(Specification lcAST, HashMap<String, String> handlers) {
 		Map<String, String> genCode = new HashMap<String, String>();
 		try {
 			lcAST.J_gen(genCode, "labcomm.generated", 2013);
diff --git a/examples/dynamic/test/TestLabcommGen.java b/examples/dynamic/test/TestLabcommGen.java
index 3f968d944b366ac24a6c89922092d94c884b66b3..f5b100565a20ba0c261c3fef4924f2beecea372a 100644
--- a/examples/dynamic/test/TestLabcommGen.java
+++ b/examples/dynamic/test/TestLabcommGen.java
@@ -161,7 +161,7 @@ public class TestLabcommGen {
 	}
 
 	public static InRAMCompiler generateCode(String lcDecl, HashMap<String, String> handlers) {
-		Program ast = null;
+		Specification ast = null;
 		InputStream in = new ByteArrayInputStream(lcDecl.getBytes());
 		LabCommScanner scanner = new LabCommScanner(in);
 		LabCommParser parser = new LabCommParser();
@@ -169,7 +169,7 @@ public class TestLabcommGen {
 
 		InRAMCompiler irc = null;
 		try {
-			Program p = (Program)parser.parse(scanner);
+			Specification p = (Specification)parser.parse(scanner);
 			p.errorCheck(errors);
 			if (errors.isEmpty()) {
 				ast = p;
@@ -200,7 +200,7 @@ public class TestLabcommGen {
 	 * @param handlers - a map <name, source> of handlers for the types in ast
 	 * @return an InRAMCompiler object containing the generated clases
 	 */
-	private static InRAMCompiler handleAst(Program lcAST, HashMap<String, String> handlers) {
+	private static InRAMCompiler handleAst(Specification lcAST, HashMap<String, String> handlers) {
 		Map<String, String> genCode = new HashMap<String, String>();
 		try {
 			lcAST.J_gen(genCode, "labcomm.generated", 2014);
@@ -284,7 +284,7 @@ public class TestLabcommGen {
 	 * @param handlers - a map <name, source> of handlers for the types in ast
 	 * @return an InRAMCompiler object containing the generated clases
 	 */
-	private static InRAMCompiler handleAstSeparate(Program lcAST, HashMap<String, String> handlers) {
+	private static InRAMCompiler handleAstSeparate(Specification lcAST, HashMap<String, String> handlers) {
 		Map<String, String> genCode = new HashMap<String, String>();
 		try {
 			lcAST.J_gen(genCode, "labcomm.generated", 2013);
diff --git a/examples/robot/App.config b/examples/robot/App.config
index 8e15646352ec1d9a84bbc6504ef6b46e16bf7823..6a845b905cc6086965db7653bcccf1417be20069 100644
--- a/examples/robot/App.config
+++ b/examples/robot/App.config
@@ -3,4 +3,4 @@
     <startup> 
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
     </startup>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/examples/robot/Follow.mod b/examples/robot/Follow.mod
index fb86d9f6b81cb2104e9f1722828c4132f8046d2c..200a0cb7a9f7184c8bf8e0350097a3acb628e3f6 100644
--- a/examples/robot/Follow.mod
+++ b/examples/robot/Follow.mod
@@ -46,4 +46,4 @@ MODULE Follow
         RETURN;
     ENDPROC
     
-ENDMODULE
\ No newline at end of file
+ENDMODULE
diff --git a/examples/robot/LCRobot.lc b/examples/robot/LCRobot.lc
index 971767d85e923881e5a3e5f28c66f3b302374a39..fd0eefa718d755084c696fa9f5788b605a040e7f 100644
--- a/examples/robot/LCRobot.lc
+++ b/examples/robot/LCRobot.lc
@@ -35,4 +35,4 @@ sample struct {
 		float eax_e;
 		float eax_f;
 	} extax;
-} jointtarget;
\ No newline at end of file
+} jointtarget;
diff --git a/examples/robot/Program.cs b/examples/robot/Program.cs
index 49a0a925070f3f1a2feca2b5bcb9356574019235..5468019c0eac87693748782456aa82bac731cbc0 100644
--- a/examples/robot/Program.cs
+++ b/examples/robot/Program.cs
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
 
 namespace RobotCtrl
 {
-    class Program
+    class Specification
     {
 
         public static string IP_ADDRESS = "127.0.0.1";
@@ -20,7 +20,7 @@ namespace RobotCtrl
         {
             jointtarget val = new jointtarget { robax = new jointtarget.struct_robax(), extax = new jointtarget.struct_extax() };
             TcpClient client = new TcpClient();
-            IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(Program.IP_ADDRESS), Program.PORT);
+            IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(Specification.IP_ADDRESS), Specification.PORT);
             try
             {
                 client.Connect(serverEndPoint);
diff --git a/examples/robot/RobotCtrl.csproj b/examples/robot/RobotCtrl.csproj
index 7dcdcb0c06be2494f719ddb2d1d5f841fc7f3e2c..c8a12019dcfcf91b9dcd94ca84f8e11ea7a324f1 100644
--- a/examples/robot/RobotCtrl.csproj
+++ b/examples/robot/RobotCtrl.csproj
@@ -42,7 +42,7 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="LCRobot.cs" />
-    <Compile Include="Program.cs" />
+    <Compile Include="Specification.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -62,4 +62,4 @@
   <Target Name="AfterBuild">
   </Target>
   -->
-</Project>
\ No newline at end of file
+</Project>
diff --git a/examples/twoway/decimating_messages.lc b/examples/twoway/decimating_messages.lc
index 8763873e7eb5d18d6a5471ad6f52bb66051aee98..62dc70725f841864a49168075099195c89bfdc26 100644
--- a/examples/twoway/decimating_messages.lc
+++ b/examples/twoway/decimating_messages.lc
@@ -1,4 +1,4 @@
 sample struct {
   int decimation;
   int signature_index;
-} set_decimation;
\ No newline at end of file
+} set_decimation;
diff --git a/examples/twoway/types.lc b/examples/twoway/types.lc
index 54c03ec9e8c03953feef6274e7786ea279dffcac..ace9bd449d13dd2bfa0b672ea24503448fa982f2 100644
--- a/examples/twoway/types.lc
+++ b/examples/twoway/types.lc
@@ -3,4 +3,4 @@ sample int B;
 sample int Sum;
 sample int Diff;
 sample int Product;
-sample void Terminate;
\ No newline at end of file
+sample void Terminate;
diff --git a/examples/user_types/TDDecoder.java b/examples/user_types/TDDecoder.java
index 1c56a72eba5a351cd918b4e073da0158ffe99f8e..52b3eb967d6d796338ddb1859d006ed389586538 100644
--- a/examples/user_types/TDDecoder.java
+++ b/examples/user_types/TDDecoder.java
@@ -9,7 +9,7 @@ import se.lth.control.labcomm2014.TypeDefParser;
 import se.lth.control.labcomm2014.ASTbuilder;
 //import se.lth.control.labcomm2014.TypeBinding;
 
-import se.lth.control.labcomm2014.compiler.Program;
+import se.lth.control.labcomm2014.compiler.Specification;
 import java.io.FileOutputStream;
 import java.io.PrintStream;
 
@@ -79,7 +79,7 @@ public class TDDecoder
     if(d.isSampleDef()){
         System.out.println("onTypeDef (sample): ");
         ASTbuilder v = new ASTbuilder();
-        Program p = v.makeProgram((TypeDefParser.ParsedSampleDef) d);
+        Specification p = v.makeSpecification((TypeDefParser.ParsedSampleDef) d);
         try {
                 //FileOutputStream f = new FileOutputStream("/tmp/foopp"+d.getName()+".txt");
                 //PrintStream out = new PrintStream(f);
diff --git a/lib/RAPID/LabComm.sys b/lib/RAPID/LabComm.sys
index 8d31dce0ebea49dafbe574ea63d74ff5dd49569b..73f9d6624d1bccd460e127bdf90d644ee52ec926 100644
--- a/lib/RAPID/LabComm.sys
+++ b/lib/RAPID/LabComm.sys
@@ -314,4 +314,4 @@ MODULE LabComm(SYSMODULE)
         RAISE ;
     ENDPROC
 
-ENDMODULE
\ No newline at end of file
+ENDMODULE
diff --git a/lib/csharp/se/lth/control/labcomm2014/EncoderRegistry.cs b/lib/csharp/se/lth/control/labcomm2014/EncoderRegistry.cs
index 6c299296cf98aa5e63ff07feb6a712cb55e3a526..5d35ecb17235e656c258e8953862e719cd84653a 100644
--- a/lib/csharp/se/lth/control/labcomm2014/EncoderRegistry.cs
+++ b/lib/csharp/se/lth/control/labcomm2014/EncoderRegistry.cs
@@ -60,4 +60,4 @@ namespace se.lth.control.labcomm2014 {
 
   }
 
-}
\ No newline at end of file
+}
diff --git a/lib/csharp/se/lth/control/labcomm2014/SampleHandler.cs b/lib/csharp/se/lth/control/labcomm2014/SampleHandler.cs
index fa6e9a35b8ebfb0f309823591b485ddc3af5bc51..dfc08bd1fc870a623eddbae943490e5a990528de 100644
--- a/lib/csharp/se/lth/control/labcomm2014/SampleHandler.cs
+++ b/lib/csharp/se/lth/control/labcomm2014/SampleHandler.cs
@@ -3,4 +3,4 @@ namespace se.lth.control.labcomm2014 {
   public interface SampleHandler {
   }
 
-}
\ No newline at end of file
+}
diff --git a/lib/java/se/lth/control/labcomm2014/ASTbuilder.java b/lib/java/se/lth/control/labcomm2014/ASTbuilder.java
index 8e36736dfa212d60692ddf386a01db76771da289..c21c881c06cd0a6c009dd85fce1deae1fe1f4b0d 100644
--- a/lib/java/se/lth/control/labcomm2014/ASTbuilder.java
+++ b/lib/java/se/lth/control/labcomm2014/ASTbuilder.java
@@ -17,10 +17,11 @@ import se.lth.control.labcomm2014.compiler.LabComm;
 import se.lth.control.labcomm2014.compiler.LabCommParser;
 
 import se.lth.control.labcomm2014.compiler.List;
-import se.lth.control.labcomm2014.compiler.Program;
+import se.lth.control.labcomm2014.compiler.Specification;
 import se.lth.control.labcomm2014.compiler.Decl;
 import se.lth.control.labcomm2014.compiler.TypeDecl;
 import se.lth.control.labcomm2014.compiler.SampleDecl;
+import se.lth.control.labcomm2014.compiler.TypeInstance;
 import se.lth.control.labcomm2014.compiler.DataType;
 import se.lth.control.labcomm2014.compiler.VoidType;
 import se.lth.control.labcomm2014.compiler.PrimType;
@@ -94,8 +95,7 @@ public class ASTbuilder implements TypeDefParser.ParsedSymbolVisitor {
         }
         public void visit(TypeDefParser.ParsedField t){
             t.getType().accept(this);
-            fieldStack.push(new Field(typeStack.pop(),t.getName()));
-
+            fieldStack.push(new Field(new TypeInstance(typeStack.pop(),t.getName())));
         }
         public void visit(TypeDefParser.ArrayType t){
             boolean isFixed = true;
@@ -123,12 +123,12 @@ public class ASTbuilder implements TypeDefParser.ParsedSymbolVisitor {
 
        public Decl makeDecl(TypeDefParser.ParsedTypeDef d) {
            d.getType().accept(this);
-           Decl result = new TypeDecl(typeStack.pop(), d.getName());
+           Decl result = new TypeDecl(new TypeInstance(typeStack.pop(), d.getName()));
            return result;
        }
 
-       private Program createAndCheckProgram(List<Decl> ds) {
-            Program p = new Program(ds);
+       private Specification createAndCheckSpecification(List<Decl> ds) {
+            Specification p = new Specification(ds);
             LinkedList errors = new LinkedList();
             p.errorCheck(errors);
             if(errors.isEmpty()) {
@@ -145,21 +145,21 @@ public class ASTbuilder implements TypeDefParser.ParsedSymbolVisitor {
             }
        }
        
-       public Program makeProgram(TypeDefParser.ParsedTypeDef d) {
+       public Specification makeSpecification(TypeDefParser.ParsedTypeDef d) {
            assertStacksEmpty();
            List<Decl> ds = new List<Decl>();
 
            ds.add(makeDecl(d));
            assertStacksEmpty();
-           return createAndCheckProgram(ds);
+           return createAndCheckSpecification(ds);
        }
 
        public Decl makeDecl(TypeDefParser.ParsedSampleDef d) {
            d.getType().accept(this);
-           Decl result = new SampleDecl(typeStack.pop(), d.getName());
+           Decl result = new SampleDecl(new TypeInstance(typeStack.pop(), d.getName()));
            return result;
        }
-       public Program makeProgram(TypeDefParser.ParsedSampleDef d) {
+       public Specification makeSpecification(TypeDefParser.ParsedSampleDef d) {
            assertStacksEmpty();
            List<Decl> ds = new List<Decl>();
 
@@ -171,7 +171,7 @@ public class ASTbuilder implements TypeDefParser.ParsedSymbolVisitor {
            ds.add(makeDecl(d));
 
            assertStacksEmpty();
-           return createAndCheckProgram(ds);
+           return createAndCheckSpecification(ds);
        }
     }
 
diff --git a/test/basic.lc b/test/basic.lc
index 6c87af5df2f2f43d4cf2d33c6aeaa9f9aaaebf2e..de60d2c55c35b43078a331b7d457942209e3060e 100644
--- a/test/basic.lc
+++ b/test/basic.lc
@@ -6,4 +6,4 @@ sample long s_long;
 sample float s_float;
 sample double s_double;
 sample boolean s_boolean;
-sample string s_string;
\ No newline at end of file
+sample string s_string;
diff --git a/test/simple.lc b/test/simple.lc
index 30413198557348e6757c780c17883150adb5d938..d6ff7c71b6a8842efde3a060b075407365f7a248 100644
--- a/test/simple.lc
+++ b/test/simple.lc
@@ -9,4 +9,4 @@ sample struct {
   int a;
   int b;
 } an_int_struct;
-sample void a_void;
\ No newline at end of file
+sample void a_void;