First version of parser; Generates AST in XML and HTML format.
authorrtrimana <rtrimana@uci.edu>
Sat, 17 Sep 2016 02:46:38 +0000 (19:46 -0700)
committerrtrimana <rtrimana@uci.edu>
Sat, 17 Sep 2016 02:46:38 +0000 (19:46 -0700)
15 files changed:
README.md [new file with mode: 0644]
common.mk [new file with mode: 0644]
config/iotparser/policy.pol [new file with mode: 0644]
config/iotparser/tree-view.xsl [new file with mode: 0644]
config/iotparser/tree.xsl [new file with mode: 0644]
iotjava/Makefile [new file with mode: 0644]
iotjava/iotparser/Lexer.java [new file with mode: 0644]
iotjava/iotparser/Parser.java [new file with mode: 0644]
iotjava/iotparser/sym.java [new file with mode: 0644]
jars/java-cup-bin-11b-20160615/java-cup-11b-runtime.jar [new file with mode: 0644]
jars/java-cup-bin-11b-20160615/java-cup-11b.jar [new file with mode: 0644]
others/javacup/README [new file with mode: 0644]
others/javacup/iotparser.cup [new file with mode: 0644]
others/jflex/README [new file with mode: 0644]
others/jflex/iotparser.jflex [new file with mode: 0644]

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/common.mk b/common.mk
new file mode 100644 (file)
index 0000000..ed6efc9
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,12 @@
+JAVA := java
+JAR := jar
+JAVADOC := javadoc
+JAVAC := javac
+BIN_DIR := $(BASE)/bin
+DOCS_DIR := $(BASE)/doc
+RUNTIMEJARS := $(BASE)/jars/asm-all-5.0.3.jar
+CHECKERJARS := $(BASE)/jars/checker.jar:$(BASE)/jars/javac.jar
+PHONEJARS := $(BASE)/jars/java-json.jar
+ZIPJARS := $(BASE)/jars/zip4j_1.3.2.jar
+BRILLOJARS := $(BASE)/jars/brillo/*:$(BASE)/jars/brillo/libs/*
+PARSERJARS := $(BASE)/jars/java-cup-bin-11b-20160615/*
diff --git a/config/iotparser/policy.pol b/config/iotparser/policy.pol
new file mode 100644 (file)
index 0000000..7bcefcd
--- /dev/null
@@ -0,0 +1,30 @@
+public interface Camera {
+    public void MethodA(int A, int B);
+    public int MethodB(int C, string D);
+    public string MethodC(string E, int F);
+    public float MethodD(int G, float H);
+    public boolean MethodE(Camera I, boolean J);
+       public void MethodF();
+}
+
+capability Camera.ImageCapture {
+       description = "The quick brown fox jumps over the smart dog";
+       description = "Another description";
+       method = MethodA;
+       method = MethodB;
+}
+
+capability Camera.VideoRecording {
+       description = "The quick brown fox jumps over the cool dog";
+       method = MethodC;
+       method = MethodD;
+}
+
+capability Camera.BackupData {
+       description = "The quick brown fox jumps over the clever dog";
+       method = MethodE;
+}
+
+requires Camera with VideoRecording, ImageCapture as interface CameraWithCaptureAndData;
+
+requires Camera with ImageCapture, VideoRecording as interface CameraWithCaptureAndRecording;
diff --git a/config/iotparser/tree-view.xsl b/config/iotparser/tree-view.xsl
new file mode 100644 (file)
index 0000000..0a2e141
--- /dev/null
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:output method="html" 
+             encoding="UTF-8"
+             indent="no"/>
+
+  <xsl:variable name="apos">'</xsl:variable>
+
+  <xsl:template match="/">
+    <html>
+      <head>
+       <meta charset="UTF-8" />
+        <title>Parse-Tree</title>
+        <link type="text/css" rel="stylesheet" href="tree-view.css"/>
+      </head>
+      <body>
+        <h3>Parse-Tree</h3>
+        <xsl:apply-templates select="." mode="render"/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="/" mode="render">
+    <xsl:apply-templates mode="render"/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="render">
+    <xsl:call-template name="ascii-art-hierarchy"/>
+    <br/>
+    <xsl:call-template name="ascii-art-hierarchy"/>
+    <span class='connector'>___</span>
+    <span class="element"><xsl:value-of select="local-name()"/></span>
+    <xsl:text>&#160;</xsl:text>
+    <br/>
+    <xsl:apply-templates select="@*" mode="render"/>
+    <xsl:apply-templates mode="render"/>
+  </xsl:template>
+
+  <xsl:template match="@*" mode="render">
+    <xsl:call-template name="ascii-art-hierarchy"/>
+    <span class='connector'>&#160;&#160;</span>
+    <span class='connector'>\___</span>
+
+    <xsl:text>&#160;</xsl:text>
+    <span class="name">
+      <xsl:value-of select="local-name()"/>
+    </span>
+    <xsl:text> = </xsl:text>
+    <span class="value">
+      <xsl:call-template name="escape-ws">
+        <xsl:with-param name="text" select="translate(.,' ','&#160;')"/>
+      </xsl:call-template>
+    </span>
+    <br/>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="render">
+    <xsl:call-template name="ascii-art-hierarchy"/>
+    <br/>
+    <xsl:call-template name="ascii-art-hierarchy"/>
+    <span class='connector'>___</span>
+    <xsl:text>&#160;</xsl:text>
+    <span class="value">
+      <xsl:call-template name="escape-ws">
+        <xsl:with-param name="text" select="translate(.,' ','&#160;')"/>
+      </xsl:call-template>
+    </span>
+    <br/>
+  </xsl:template>
+
+  <xsl:template match="comment()" mode="render" />
+  <xsl:template match="processing-instruction()" mode="render" />
+
+
+  <xsl:template name="ascii-art-hierarchy">
+    <xsl:for-each select="ancestor::*">
+      <xsl:choose>
+        <xsl:when test="following-sibling::node()">
+          <span class='connector'>&#160;&#160;</span>|<span class='connector'>&#160;&#160;</span>
+          <xsl:text>&#160;</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <span class='connector'>&#160;&#160;&#160;&#160;</span>
+          <span class='connector'>&#160;&#160;</span>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+    <xsl:choose>
+      <xsl:when test="parent::node() and ../child::node()">
+        <span class='connector'>&#160;&#160;</span>
+        <xsl:text>|</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class='connector'>&#160;&#160;&#160;</span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- recursive template to escape linefeeds, tabs -->
+  <xsl:template name="escape-ws">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="contains($text, '&#xA;')">
+        <xsl:call-template name="escape-ws">
+          <xsl:with-param name="text" select="substring-before($text, '&#xA;')"/>
+        </xsl:call-template>
+        <span class="escape">\n</span>
+        <xsl:call-template name="escape-ws">
+          <xsl:with-param name="text" select="substring-after($text, '&#xA;')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($text, '&#x9;')">
+        <xsl:value-of select="substring-before($text, '&#x9;')"/>
+        <span class="escape">\t</span>
+        <xsl:call-template name="escape-ws">
+          <xsl:with-param name="text" select="substring-after($text, '&#x9;')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/config/iotparser/tree.xsl b/config/iotparser/tree.xsl
new file mode 100644 (file)
index 0000000..05e1b27
--- /dev/null
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" 
+               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               xmlns:exsl="http://exslt.org/common"
+               >
+<xsl:output method="xml" version="1.0" encoding="UTF-8" />
+
+<xsl:include href="tree-view.xsl"/>
+
+<xsl:template match="blacklist"  mode="flatten" />
+
+<xsl:template match="document"  mode="flatten">
+      <xsl:apply-templates  mode="flatten" select="parsetree"/>
+</xsl:template>
+
+<xsl:template match="nonterminal" mode="flatten">
+  <xsl:variable name="temp" select="@id" />
+  <xsl:choose>
+    
+    <xsl:when test="count(*)=3 and contains($temp,'expr') and *[contains(@id,'expr')]"> 
+      <xsl:apply-templates  mode="flatten"/>
+    </xsl:when>
+
+    <!-- collapses degenerated trees like lists, conserving the blacklist subtrees-->
+    <xsl:when test="../@id = @id and count(/document/blacklist[1]/symbol[text() = $temp])=0"> 
+      <xsl:apply-templates  mode="flatten"/>
+    </xsl:when>
+
+    <!-- collapses unary productions -->
+    <xsl:when test="count(*)=3 and count(/document/blacklist[1]/symbol[text() = $temp])=0"> 
+      <xsl:apply-templates  mode="flatten"/>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:element name="{@id}" >
+       <xsl:attribute name="variant"><xsl:value-of select="@variant" /></xsl:attribute>
+       <xsl:apply-templates mode="flatten"/>
+      </xsl:element>
+    </xsl:otherwise>
+
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="terminal" mode="flatten">
+  <xsl:element name="{@id}">
+    <xsl:apply-templates  mode="flatten"/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="/">
+ <xsl:variable name="flatten">
+     <xsl:apply-templates  mode="flatten"/>
+ </xsl:variable>
+ <xsl:variable name="rendered">
+    <xsl:apply-templates mode="rendered" select="exsl:node-set($flatten)"/>
+ </xsl:variable>
+
+ <!--xsl:copy-of select="$rendered" /-->
+ <xsl:copy-of select="$flatten" />
+</xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/iotjava/Makefile b/iotjava/Makefile
new file mode 100644 (file)
index 0000000..fa16fc7
--- /dev/null
@@ -0,0 +1,20 @@
+BASE := ..
+
+include $(BASE)/common.mk
+
+all: iotparser
+
+PHONY += iotparser
+iotparser:
+       $(JAVAC) -cp .:$(PARSERJARS) -d $(BIN_DIR) iotparser/*.java
+       cp ../config/iotparser/* $(BIN_DIR)/iotparser/
+
+PHONY += iotparse
+iotparse:
+       cd $(BIN_DIR)/iotparser; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotparser.Parser policy.pol out.xml
+
+PHONY += doc
+doc: iotruntime iotinstaller
+       $(JAVADOC) -d $(DOCS_DIR) iotparser/*.java
+
+.PHONY: $(PHONY)
diff --git a/iotjava/iotparser/Lexer.java b/iotjava/iotparser/Lexer.java
new file mode 100644 (file)
index 0000000..c527efb
--- /dev/null
@@ -0,0 +1,901 @@
+package iotparser;
+
+/* The following code was generated by JFlex 1.6.1 */
+
+// JFlex parser specification written by
+// Rahmadi Trimananda
+// for Sentinel system
+// University of California, Irvine
+
+// Technische Universitaet Muenchen 
+// Fakultaet fuer Informatik 
+
+import java_cup.runtime.Symbol;
+import java_cup.runtime.ComplexSymbolFactory;
+import java_cup.runtime.ComplexSymbolFactory.Location;
+
+
+/**
+ * This class is a scanner generated by 
+ * <a href="http://www.jflex.de/">JFlex</a> 1.6.1
+ * from the specification file <tt>iotparser.jflex</tt>
+ */
+public class Lexer implements java_cup.runtime.Scanner, sym {
+
+  /** This character denotes the end of file */
+  public static final int YYEOF = -1;
+
+  /** initial size of the lookahead buffer */
+  private static final int ZZ_BUFFERSIZE = 16384;
+
+  /** lexical states */
+  public static final int YYINITIAL = 0;
+  public static final int STRING = 2;
+
+  /**
+   * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
+   * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
+   *                  at the beginning of a line
+   * l is of the form l = 2*k, k a non negative integer
+   */
+  private static final int ZZ_LEXSTATE[] = { 
+     0,  0,  1, 1
+  };
+
+  /** 
+   * Translates characters to character classes
+   */
+  private static final String ZZ_CMAP_PACKED = 
+    "\11\0\1\6\1\4\1\46\1\6\1\3\22\0\1\6\1\0\1\35"+
+    "\1\0\1\1\3\0\1\40\1\41\2\0\1\36\1\0\1\37\1\0"+
+    "\12\2\1\0\1\5\1\0\1\44\3\0\32\1\1\0\1\45\2\0"+
+    "\1\1\1\0\1\24\1\16\1\27\1\25\1\20\1\23\1\22\1\13"+
+    "\1\7\2\1\1\21\1\32\1\10\1\14\1\31\1\33\1\15\1\12"+
+    "\1\11\1\26\1\30\1\34\1\1\1\17\1\1\1\42\1\0\1\43"+
+    "\7\0\1\46\u1fa2\0\1\46\1\46\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\udfe6\0";
+
+  /** 
+   * Translates characters to character classes
+   */
+  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
+
+  /** 
+   * Translates DFA states to action switch labels.
+   */
+  private static final int [] ZZ_ACTION = zzUnpackAction();
+
+  private static final String ZZ_ACTION_PACKED_0 =
+    "\2\0\1\1\1\2\2\3\1\4\15\2\1\5\1\6"+
+    "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\1\16"+
+    "\1\17\1\0\10\2\1\20\10\2\1\21\1\22\1\23"+
+    "\1\24\1\25\24\2\1\26\1\27\3\2\1\30\1\2"+
+    "\1\31\2\2\1\32\2\2\1\33\2\2\1\34\6\2"+
+    "\1\35\2\2\1\36\2\2\1\37\1\40\2\2\1\41"+
+    "\3\2\1\42\2\2\1\43\3\2\1\44\1\45";
+
+  private static int [] zzUnpackAction() {
+    int [] result = new int[120];
+    int offset = 0;
+    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackAction(String packed, int offset, int [] result) {
+    int i = 0;       /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int count = packed.charAt(i++);
+      int value = packed.charAt(i++);
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+
+  /** 
+   * Translates a state to a row index in the transition table
+   */
+  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
+
+  private static final String ZZ_ROWMAP_PACKED_0 =
+    "\0\0\0\47\0\116\0\165\0\234\0\116\0\116\0\303"+
+    "\0\352\0\u0111\0\u0138\0\u015f\0\u0186\0\u01ad\0\u01d4\0\u01fb"+
+    "\0\u0222\0\u0249\0\u0270\0\u0297\0\116\0\116\0\116\0\116"+
+    "\0\116\0\116\0\116\0\116\0\u02be\0\116\0\u02e5\0\u030c"+
+    "\0\u0333\0\u035a\0\u0381\0\u03a8\0\u03cf\0\u03f6\0\u041d\0\u0444"+
+    "\0\165\0\u046b\0\u0492\0\u04b9\0\u04e0\0\u0507\0\u052e\0\u0555"+
+    "\0\u057c\0\116\0\116\0\116\0\116\0\u05a3\0\u05ca\0\u05f1"+
+    "\0\u0618\0\u063f\0\u0666\0\u068d\0\u06b4\0\u06db\0\u0702\0\u0729"+
+    "\0\u0750\0\u0777\0\u079e\0\u07c5\0\u07ec\0\u0813\0\u083a\0\u0861"+
+    "\0\u0888\0\u08af\0\165\0\165\0\u08d6\0\u08fd\0\u0924\0\165"+
+    "\0\u094b\0\165\0\u0972\0\u0999\0\165\0\u09c0\0\u09e7\0\165"+
+    "\0\u0a0e\0\u0a35\0\165\0\u0a5c\0\u0a83\0\u0aaa\0\u0ad1\0\u0af8"+
+    "\0\u0b1f\0\165\0\u0b46\0\u0b6d\0\165\0\u0b94\0\u0bbb\0\165"+
+    "\0\165\0\u0be2\0\u0c09\0\165\0\u0c30\0\u0c57\0\u0c7e\0\165"+
+    "\0\u0ca5\0\u0ccc\0\165\0\u0cf3\0\u0d1a\0\u0d41\0\165\0\165";
+
+  private static int [] zzUnpackRowMap() {
+    int [] result = new int[120];
+    int offset = 0;
+    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
+    int i = 0;  /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int high = packed.charAt(i++) << 16;
+      result[j++] = high | packed.charAt(i++);
+    }
+    return j;
+  }
+
+  /** 
+   * The transition table of the DFA
+   */
+  private static final int [] ZZ_TRANS = zzUnpackTrans();
+
+  private static final String ZZ_TRANS_PACKED_0 =
+    "\1\3\1\4\1\3\1\5\1\6\1\7\1\6\1\10"+
+    "\2\4\1\11\2\4\1\12\1\13\2\4\1\14\1\4"+
+    "\1\15\1\16\1\17\1\4\1\20\1\21\1\22\1\23"+
+    "\1\4\1\24\1\25\1\26\1\27\1\30\1\31\1\32"+
+    "\1\33\1\34\1\3\1\0\3\35\1\0\1\3\30\35"+
+    "\1\36\7\35\1\37\1\35\50\0\2\4\4\0\26\4"+
+    "\16\0\1\40\43\0\2\4\4\0\1\4\1\41\24\4"+
+    "\13\0\2\4\4\0\2\4\1\42\1\4\1\43\21\4"+
+    "\13\0\2\4\4\0\11\4\1\44\14\4\13\0\2\4"+
+    "\4\0\5\4\1\45\2\4\1\46\15\4\13\0\2\4"+
+    "\4\0\5\4\1\47\20\4\13\0\2\4\4\0\12\4"+
+    "\1\50\13\4\13\0\2\4\4\0\3\4\1\51\22\4"+
+    "\13\0\2\4\4\0\5\4\1\52\3\4\1\53\14\4"+
+    "\13\0\2\4\4\0\4\4\1\54\10\4\1\55\10\4"+
+    "\13\0\2\4\4\0\5\4\1\56\20\4\13\0\2\4"+
+    "\4\0\17\4\1\57\6\4\13\0\2\4\4\0\11\4"+
+    "\1\60\14\4\13\0\2\4\4\0\1\61\25\4\12\0"+
+    "\3\35\2\0\30\35\1\0\7\35\1\0\1\35\10\0"+
+    "\1\62\1\63\3\0\1\64\17\0\1\65\16\0\1\6"+
+    "\42\0\2\4\4\0\2\4\1\66\23\4\13\0\2\4"+
+    "\4\0\6\4\1\67\17\4\13\0\2\4\4\0\5\4"+
+    "\1\70\20\4\13\0\2\4\4\0\24\4\1\71\1\4"+
+    "\13\0\2\4\4\0\5\4\1\72\20\4\13\0\2\4"+
+    "\4\0\2\4\1\73\23\4\13\0\2\4\4\0\1\4"+
+    "\1\74\24\4\13\0\2\4\4\0\5\4\1\75\20\4"+
+    "\13\0\2\4\4\0\17\4\1\76\6\4\13\0\2\4"+
+    "\4\0\3\4\1\77\22\4\13\0\2\4\4\0\15\4"+
+    "\1\100\10\4\13\0\2\4\4\0\22\4\1\101\3\4"+
+    "\13\0\2\4\4\0\1\102\25\4\13\0\2\4\4\0"+
+    "\7\4\1\103\16\4\13\0\2\4\4\0\2\4\1\104"+
+    "\23\4\13\0\2\4\4\0\2\4\1\105\23\4\13\0"+
+    "\2\4\4\0\11\4\1\106\14\4\13\0\2\4\4\0"+
+    "\1\107\25\4\13\0\2\4\4\0\6\4\1\110\17\4"+
+    "\13\0\2\4\4\0\17\4\1\111\6\4\13\0\2\4"+
+    "\4\0\12\4\1\112\13\4\13\0\2\4\4\0\11\4"+
+    "\1\113\14\4\13\0\2\4\4\0\13\4\1\114\12\4"+
+    "\13\0\2\4\4\0\15\4\1\115\10\4\13\0\2\4"+
+    "\4\0\7\4\1\116\16\4\13\0\2\4\4\0\20\4"+
+    "\1\117\5\4\13\0\2\4\4\0\6\4\1\120\17\4"+
+    "\13\0\2\4\4\0\15\4\1\121\10\4\13\0\2\4"+
+    "\4\0\16\4\1\122\7\4\13\0\2\4\4\0\12\4"+
+    "\1\123\13\4\13\0\2\4\4\0\4\4\1\124\21\4"+
+    "\13\0\2\4\4\0\4\4\1\125\21\4\13\0\2\4"+
+    "\4\0\6\4\1\126\17\4\13\0\2\4\4\0\1\4"+
+    "\1\127\24\4\13\0\2\4\4\0\2\4\1\130\23\4"+
+    "\13\0\2\4\4\0\1\131\25\4\13\0\2\4\4\0"+
+    "\11\4\1\132\14\4\13\0\2\4\4\0\2\4\1\133"+
+    "\23\4\13\0\2\4\4\0\12\4\1\134\13\4\13\0"+
+    "\2\4\4\0\6\4\1\135\17\4\13\0\2\4\4\0"+
+    "\7\4\1\136\16\4\13\0\2\4\4\0\1\137\25\4"+
+    "\13\0\2\4\4\0\5\4\1\140\20\4\13\0\2\4"+
+    "\4\0\14\4\1\141\11\4\13\0\2\4\4\0\13\4"+
+    "\1\142\12\4\13\0\2\4\4\0\6\4\1\143\17\4"+
+    "\13\0\2\4\4\0\15\4\1\144\10\4\13\0\2\4"+
+    "\4\0\11\4\1\145\14\4\13\0\2\4\4\0\1\146"+
+    "\25\4\13\0\2\4\4\0\1\147\25\4\13\0\2\4"+
+    "\4\0\20\4\1\150\5\4\13\0\2\4\4\0\16\4"+
+    "\1\151\7\4\13\0\2\4\4\0\15\4\1\152\10\4"+
+    "\13\0\2\4\4\0\11\4\1\153\14\4\13\0\2\4"+
+    "\4\0\1\4\1\154\24\4\13\0\2\4\4\0\22\4"+
+    "\1\155\3\4\13\0\2\4\4\0\12\4\1\156\13\4"+
+    "\13\0\2\4\4\0\20\4\1\157\5\4\13\0\2\4"+
+    "\4\0\3\4\1\160\22\4\13\0\2\4\4\0\2\4"+
+    "\1\161\23\4\13\0\2\4\4\0\1\162\25\4\13\0"+
+    "\2\4\4\0\11\4\1\163\14\4\13\0\2\4\4\0"+
+    "\1\164\25\4\13\0\2\4\4\0\2\4\1\165\23\4"+
+    "\13\0\2\4\4\0\5\4\1\166\20\4\13\0\2\4"+
+    "\4\0\10\4\1\167\15\4\13\0\2\4\4\0\1\4"+
+    "\1\170\24\4\12\0";
+
+  private static int [] zzUnpackTrans() {
+    int [] result = new int[3432];
+    int offset = 0;
+    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackTrans(String packed, int offset, int [] result) {
+    int i = 0;       /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int count = packed.charAt(i++);
+      int value = packed.charAt(i++);
+      value--;
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+
+  /* error codes */
+  private static final int ZZ_UNKNOWN_ERROR = 0;
+  private static final int ZZ_NO_MATCH = 1;
+  private static final int ZZ_PUSHBACK_2BIG = 2;
+
+  /* error messages for the codes above */
+  private static final String ZZ_ERROR_MSG[] = {
+    "Unknown internal scanner error",
+    "Error: could not match input",
+    "Error: pushback value was too large"
+  };
+
+  /**
+   * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
+   */
+  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
+
+  private static final String ZZ_ATTRIBUTE_PACKED_0 =
+    "\2\0\1\11\2\1\2\11\15\1\10\11\1\1\1\11"+
+    "\1\1\1\0\21\1\4\11\103\1";
+
+  private static int [] zzUnpackAttribute() {
+    int [] result = new int[120];
+    int offset = 0;
+    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
+    int i = 0;       /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int count = packed.charAt(i++);
+      int value = packed.charAt(i++);
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+  /** the input device */
+  private java.io.Reader zzReader;
+
+  /** the current state of the DFA */
+  private int zzState;
+
+  /** the current lexical state */
+  private int zzLexicalState = YYINITIAL;
+
+  /** this buffer contains the current text to be matched and is
+      the source of the yytext() string */
+  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
+
+  /** the textposition at the last accepting state */
+  private int zzMarkedPos;
+
+  /** the current text position in the buffer */
+  private int zzCurrentPos;
+
+  /** startRead marks the beginning of the yytext() string in the buffer */
+  private int zzStartRead;
+
+  /** endRead marks the last character in the buffer, that has been read
+      from input */
+  private int zzEndRead;
+
+  /** number of newlines encountered up to the start of the matched text */
+  private int yyline;
+
+  /** the number of characters up to the start of the matched text */
+  private int yychar;
+
+  /**
+   * the number of characters from the last newline up to the start of the 
+   * matched text
+   */
+  private int yycolumn;
+
+  /** 
+   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
+   */
+  private boolean zzAtBOL = true;
+
+  /** zzAtEOF == true <=> the scanner is at the EOF */
+  private boolean zzAtEOF;
+
+  /** denotes if the user-EOF-code has already been executed */
+  private boolean zzEOFDone;
+  
+  /** 
+   * The number of occupied positions in zzBuffer beyond zzEndRead.
+   * When a lead/high surrogate has been read from the input stream
+   * into the final zzBuffer position, this will have a value of 1;
+   * otherwise, it will have a value of 0.
+   */
+  private int zzFinalHighSurrogate = 0;
+
+  /* user code: */
+    StringBuffer string = new StringBuffer();
+    public Lexer(java.io.Reader in, ComplexSymbolFactory sf){
+       this(in);
+       symbolFactory = sf;
+    }
+    ComplexSymbolFactory symbolFactory;
+
+  private Symbol symbol(String name, int sym) {
+      return symbolFactory.newSymbol(name, sym, new Location(yyline+1,yycolumn+1,yychar), new Location(yyline+1,yycolumn+yylength(),yychar+yylength()));
+  }
+  
+  private Symbol symbol(String name, int sym, Object val) {
+      Location left = new Location(yyline+1,yycolumn+1,yychar);
+      Location right= new Location(yyline+1,yycolumn+yylength(), yychar+yylength());
+      return symbolFactory.newSymbol(name, sym, left, right,val);
+  } 
+  private Symbol symbol(String name, int sym, Object val,int buflength) {
+      Location left = new Location(yyline+1,yycolumn+yylength()-buflength,yychar+yylength()-buflength);
+      Location right= new Location(yyline+1,yycolumn+yylength(), yychar+yylength());
+      return symbolFactory.newSymbol(name, sym, left, right,val);
+  }       
+  private void error(String message) {
+    System.out.println("Error at line "+(yyline+1)+", column "+(yycolumn+1)+" : "+message);
+  }
+
+
+  /**
+   * Creates a new scanner
+   *
+   * @param   in  the java.io.Reader to read input from.
+   */
+  public Lexer(java.io.Reader in) {
+    this.zzReader = in;
+  }
+
+
+  /** 
+   * Unpacks the compressed character translation table.
+   *
+   * @param packed   the packed character translation table
+   * @return         the unpacked character translation table
+   */
+  private static char [] zzUnpackCMap(String packed) {
+    char [] map = new char[0x110000];
+    int i = 0;  /* index in packed string  */
+    int j = 0;  /* index in unpacked array */
+    while (i < 164) {
+      int  count = packed.charAt(i++);
+      char value = packed.charAt(i++);
+      do map[j++] = value; while (--count > 0);
+    }
+    return map;
+  }
+
+
+  /**
+   * Refills the input buffer.
+   *
+   * @return      <code>false</code>, iff there was new input.
+   * 
+   * @exception   java.io.IOException  if any I/O-Error occurs
+   */
+  private boolean zzRefill() throws java.io.IOException {
+
+    /* first: make room (if you can) */
+    if (zzStartRead > 0) {
+      zzEndRead += zzFinalHighSurrogate;
+      zzFinalHighSurrogate = 0;
+      System.arraycopy(zzBuffer, zzStartRead,
+                       zzBuffer, 0,
+                       zzEndRead-zzStartRead);
+
+      /* translate stored positions */
+      zzEndRead-= zzStartRead;
+      zzCurrentPos-= zzStartRead;
+      zzMarkedPos-= zzStartRead;
+      zzStartRead = 0;
+    }
+
+    /* is the buffer big enough? */
+    if (zzCurrentPos >= zzBuffer.length - zzFinalHighSurrogate) {
+      /* if not: blow it up */
+      char newBuffer[] = new char[zzBuffer.length*2];
+      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
+      zzBuffer = newBuffer;
+      zzEndRead += zzFinalHighSurrogate;
+      zzFinalHighSurrogate = 0;
+    }
+
+    /* fill the buffer with new input */
+    int requested = zzBuffer.length - zzEndRead;
+    int numRead = zzReader.read(zzBuffer, zzEndRead, requested);
+
+    /* not supposed to occur according to specification of java.io.Reader */
+    if (numRead == 0) {
+      throw new java.io.IOException("Reader returned 0 characters. See JFlex examples for workaround.");
+    }
+    if (numRead > 0) {
+      zzEndRead += numRead;
+      /* If numRead == requested, we might have requested to few chars to
+         encode a full Unicode character. We assume that a Reader would
+         otherwise never return half characters. */
+      if (numRead == requested) {
+        if (Character.isHighSurrogate(zzBuffer[zzEndRead - 1])) {
+          --zzEndRead;
+          zzFinalHighSurrogate = 1;
+        }
+      }
+      /* potentially more input available */
+      return false;
+    }
+
+    /* numRead < 0 ==> end of stream */
+    return true;
+  }
+
+    
+  /**
+   * Closes the input stream.
+   */
+  public final void yyclose() throws java.io.IOException {
+    zzAtEOF = true;            /* indicate end of file */
+    zzEndRead = zzStartRead;  /* invalidate buffer    */
+
+    if (zzReader != null)
+      zzReader.close();
+  }
+
+
+  /**
+   * Resets the scanner to read from a new input stream.
+   * Does not close the old reader.
+   *
+   * All internal variables are reset, the old input stream 
+   * <b>cannot</b> be reused (internal buffer is discarded and lost).
+   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
+   *
+   * Internal scan buffer is resized down to its initial length, if it has grown.
+   *
+   * @param reader   the new input stream 
+   */
+  public final void yyreset(java.io.Reader reader) {
+    zzReader = reader;
+    zzAtBOL  = true;
+    zzAtEOF  = false;
+    zzEOFDone = false;
+    zzEndRead = zzStartRead = 0;
+    zzCurrentPos = zzMarkedPos = 0;
+    zzFinalHighSurrogate = 0;
+    yyline = yychar = yycolumn = 0;
+    zzLexicalState = YYINITIAL;
+    if (zzBuffer.length > ZZ_BUFFERSIZE)
+      zzBuffer = new char[ZZ_BUFFERSIZE];
+  }
+
+
+  /**
+   * Returns the current lexical state.
+   */
+  public final int yystate() {
+    return zzLexicalState;
+  }
+
+
+  /**
+   * Enters a new lexical state
+   *
+   * @param newState the new lexical state
+   */
+  public final void yybegin(int newState) {
+    zzLexicalState = newState;
+  }
+
+
+  /**
+   * Returns the text matched by the current regular expression.
+   */
+  public final String yytext() {
+    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
+  }
+
+
+  /**
+   * Returns the character at position <tt>pos</tt> from the 
+   * matched text. 
+   * 
+   * It is equivalent to yytext().charAt(pos), but faster
+   *
+   * @param pos the position of the character to fetch. 
+   *            A value from 0 to yylength()-1.
+   *
+   * @return the character at position pos
+   */
+  public final char yycharat(int pos) {
+    return zzBuffer[zzStartRead+pos];
+  }
+
+
+  /**
+   * Returns the length of the matched text region.
+   */
+  public final int yylength() {
+    return zzMarkedPos-zzStartRead;
+  }
+
+
+  /**
+   * Reports an error that occured while scanning.
+   *
+   * In a wellformed scanner (no or only correct usage of 
+   * yypushback(int) and a match-all fallback rule) this method 
+   * will only be called with things that "Can't Possibly Happen".
+   * If this method is called, something is seriously wrong
+   * (e.g. a JFlex bug producing a faulty scanner etc.).
+   *
+   * Usual syntax/scanner level error handling should be done
+   * in error fallback rules.
+   *
+   * @param   errorCode  the code of the errormessage to display
+   */
+  private void zzScanError(int errorCode) {
+    String message;
+    try {
+      message = ZZ_ERROR_MSG[errorCode];
+    }
+    catch (ArrayIndexOutOfBoundsException e) {
+      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
+    }
+
+    throw new Error(message);
+  } 
+
+
+  /**
+   * Pushes the specified amount of characters back into the input stream.
+   *
+   * They will be read again by then next call of the scanning method
+   *
+   * @param number  the number of characters to be read again.
+   *                This number must not be greater than yylength()!
+   */
+  public void yypushback(int number)  {
+    if ( number > yylength() )
+      zzScanError(ZZ_PUSHBACK_2BIG);
+
+    zzMarkedPos -= number;
+  }
+
+
+  /**
+   * Contains user EOF-code, which will be executed exactly once,
+   * when the end of file is reached
+   */
+  private void zzDoEOF() throws java.io.IOException {
+    if (!zzEOFDone) {
+      zzEOFDone = true;
+      yyclose();
+    }
+  }
+
+
+  /**
+   * Resumes scanning until the next regular expression is matched,
+   * the end of input is encountered or an I/O-Error occurs.
+   *
+   * @return      the next token
+   * @exception   java.io.IOException  if any I/O-Error occurs
+   */
+  public java_cup.runtime.Symbol next_token() throws java.io.IOException {
+    int zzInput;
+    int zzAction;
+
+    // cached fields:
+    int zzCurrentPosL;
+    int zzMarkedPosL;
+    int zzEndReadL = zzEndRead;
+    char [] zzBufferL = zzBuffer;
+    char [] zzCMapL = ZZ_CMAP;
+
+    int [] zzTransL = ZZ_TRANS;
+    int [] zzRowMapL = ZZ_ROWMAP;
+    int [] zzAttrL = ZZ_ATTRIBUTE;
+
+    while (true) {
+      zzMarkedPosL = zzMarkedPos;
+
+      yychar+= zzMarkedPosL-zzStartRead;
+
+      boolean zzR = false;
+      int zzCh;
+      int zzCharCount;
+      for (zzCurrentPosL = zzStartRead  ;
+           zzCurrentPosL < zzMarkedPosL ;
+           zzCurrentPosL += zzCharCount ) {
+        zzCh = Character.codePointAt(zzBufferL, zzCurrentPosL, zzMarkedPosL);
+        zzCharCount = Character.charCount(zzCh);
+        switch (zzCh) {
+        case '\u000B':
+        case '\u000C':
+        case '\u0085':
+        case '\u2028':
+        case '\u2029':
+          yyline++;
+          yycolumn = 0;
+          zzR = false;
+          break;
+        case '\r':
+          yyline++;
+          yycolumn = 0;
+          zzR = true;
+          break;
+        case '\n':
+          if (zzR)
+            zzR = false;
+          else {
+            yyline++;
+            yycolumn = 0;
+          }
+          break;
+        default:
+          zzR = false;
+          yycolumn += zzCharCount;
+        }
+      }
+
+      if (zzR) {
+        // peek one character ahead if it is \n (if we have counted one line too much)
+        boolean zzPeek;
+        if (zzMarkedPosL < zzEndReadL)
+          zzPeek = zzBufferL[zzMarkedPosL] == '\n';
+        else if (zzAtEOF)
+          zzPeek = false;
+        else {
+          boolean eof = zzRefill();
+          zzEndReadL = zzEndRead;
+          zzMarkedPosL = zzMarkedPos;
+          zzBufferL = zzBuffer;
+          if (eof) 
+            zzPeek = false;
+          else 
+            zzPeek = zzBufferL[zzMarkedPosL] == '\n';
+        }
+        if (zzPeek) yyline--;
+      }
+      zzAction = -1;
+
+      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
+  
+      zzState = ZZ_LEXSTATE[zzLexicalState];
+
+      // set up zzAction for empty match case:
+      int zzAttributes = zzAttrL[zzState];
+      if ( (zzAttributes & 1) == 1 ) {
+        zzAction = zzState;
+      }
+
+
+      zzForAction: {
+        while (true) {
+    
+          if (zzCurrentPosL < zzEndReadL) {
+            zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
+            zzCurrentPosL += Character.charCount(zzInput);
+          }
+          else if (zzAtEOF) {
+            zzInput = YYEOF;
+            break zzForAction;
+          }
+          else {
+            // store back cached positions
+            zzCurrentPos  = zzCurrentPosL;
+            zzMarkedPos   = zzMarkedPosL;
+            boolean eof = zzRefill();
+            // get translated positions and possibly new buffer
+            zzCurrentPosL  = zzCurrentPos;
+            zzMarkedPosL   = zzMarkedPos;
+            zzBufferL      = zzBuffer;
+            zzEndReadL     = zzEndRead;
+            if (eof) {
+              zzInput = YYEOF;
+              break zzForAction;
+            }
+            else {
+              zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
+              zzCurrentPosL += Character.charCount(zzInput);
+            }
+          }
+          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
+          if (zzNext == -1) break zzForAction;
+          zzState = zzNext;
+
+          zzAttributes = zzAttrL[zzState];
+          if ( (zzAttributes & 1) == 1 ) {
+            zzAction = zzState;
+            zzMarkedPosL = zzCurrentPosL;
+            if ( (zzAttributes & 8) == 8 ) break zzForAction;
+          }
+
+        }
+      }
+
+      // store back cached position
+      zzMarkedPos = zzMarkedPosL;
+
+      if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
+        zzAtEOF = true;
+            zzDoEOF();
+          {      return symbolFactory.newSymbol("EOF", EOF, new Location(yyline+1,yycolumn+1,yychar), new Location(yyline+1,yycolumn+1,yychar+1));
+ }
+      }
+      else {
+        switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
+          case 1: 
+            { /* throw new Error("Illegal character <"+ yytext()+">");*/
+                   error("Illegal character <"+ yytext()+">");
+            }
+          case 38: break;
+          case 2: 
+            { return symbol("Identifier",IDENT, yytext());
+            }
+          case 39: break;
+          case 3: 
+            { /* ignore */
+            }
+          case 40: break;
+          case 4: 
+            { return symbol("semicolon",SEMICOLON);
+            }
+          case 41: break;
+          case 5: 
+            { string.setLength(0); yybegin(STRING);
+            }
+          case 42: break;
+          case 6: 
+            { return symbol("comma",COMMA);
+            }
+          case 43: break;
+          case 7: 
+            { return symbol("dot",DOT);
+            }
+          case 44: break;
+          case 8: 
+            { return symbol("(",LPAR);
+            }
+          case 45: break;
+          case 9: 
+            { return symbol(")",RPAR);
+            }
+          case 46: break;
+          case 10: 
+            { return symbol("{",BEGIN);
+            }
+          case 47: break;
+          case 11: 
+            { return symbol("}",END);
+            }
+          case 48: break;
+          case 12: 
+            { return symbol("=",ASSIGN);
+            }
+          case 49: break;
+          case 13: 
+            { string.append( yytext() );
+            }
+          case 50: break;
+          case 14: 
+            { yybegin(YYINITIAL); 
+      return symbol("StringConst",STRINGCONST,string.toString(),string.length());
+            }
+          case 51: break;
+          case 15: 
+            { string.append('\\');
+            }
+          case 52: break;
+          case 16: 
+            { return symbol("as",AS);
+            }
+          case 53: break;
+          case 17: 
+            { string.append('\n');
+            }
+          case 54: break;
+          case 18: 
+            { string.append('\t');
+            }
+          case 55: break;
+          case 19: 
+            { string.append('\r');
+            }
+          case 56: break;
+          case 20: 
+            { string.append('\"');
+            }
+          case 57: break;
+          case 21: 
+            { return symbol("int",TYPE, "INT" );
+            }
+          case 58: break;
+          case 22: 
+            { return symbol("byte",TYPE, "BYTE" );
+            }
+          case 59: break;
+          case 23: 
+            { return symbol("long",TYPE, "LONG" );
+            }
+          case 60: break;
+          case 24: 
+            { return symbol("char",TYPE, "CHAR" );
+            }
+          case 61: break;
+          case 25: 
+            { return symbol("void",TYPE, "VOID" );
+            }
+          case 62: break;
+          case 26: 
+            { return symbol("with",WITH);
+            }
+          case 63: break;
+          case 27: 
+            { return symbol("short",TYPE, "SHORT" );
+            }
+          case 64: break;
+          case 28: 
+            { return symbol("float",TYPE, "FLOAT" );
+            }
+          case 65: break;
+          case 29: 
+            { return symbol("string",TYPE, "STRING" );
+            }
+          case 66: break;
+          case 30: 
+            { return symbol("double",TYPE, "DOUBLE" );
+            }
+          case 67: break;
+          case 31: 
+            { return symbol("public",PUBLIC);
+            }
+          case 68: break;
+          case 32: 
+            { return symbol("method",METHOD);
+            }
+          case 69: break;
+          case 33: 
+            { return symbol("boolean",TYPE, "BOOL" );
+            }
+          case 70: break;
+          case 34: 
+            { return symbol("requires",REQUIRES);
+            }
+          case 71: break;
+          case 35: 
+            { return symbol("interface",INTERFACE);
+            }
+          case 72: break;
+          case 36: 
+            { return symbol("capability",CAPABILITY);
+            }
+          case 73: break;
+          case 37: 
+            { return symbol("description",DESCRIPTION);
+            }
+          case 74: break;
+          default:
+            zzScanError(ZZ_NO_MATCH);
+        }
+      }
+    }
+  }
+
+
+}
diff --git a/iotjava/iotparser/Parser.java b/iotjava/iotparser/Parser.java
new file mode 100644 (file)
index 0000000..99b2ae1
--- /dev/null
@@ -0,0 +1,690 @@
+package iotparser;
+
+//----------------------------------------------------
+// The following code was generated by CUP v0.11b 20160615 (GIT 4ac7450)
+//----------------------------------------------------
+
+import java_cup.runtime.ComplexSymbolFactory;
+import java_cup.runtime.ScannerBuffer;
+import java_cup.runtime.XMLElement;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.*;
+import javax.xml.transform.*;
+import javax.xml.transform.stream.*;
+import java_cup.runtime.ComplexSymbolFactory.Location;
+import java_cup.runtime.XMLElement;
+
+/** CUP v0.11b 20160615 (GIT 4ac7450) generated parser.
+  */
+@SuppressWarnings({"rawtypes"})
+public class Parser extends java_cup.runtime.lr_parser {
+
+ public final Class getSymbolContainer() {
+    return sym.class;
+}
+
+  /** Default constructor. */
+  @Deprecated
+  public Parser() {super();}
+
+  /** Constructor which sets the default scanner. */
+  @Deprecated
+  public Parser(java_cup.runtime.Scanner s) {super(s);}
+
+  /** Constructor which sets the default scanner. */
+  public Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}
+
+  /** Production table. */
+  protected static final short _production_table[][] = 
+    unpackFromStrings(new String[] {
+    "\000\032\000\002\002\005\000\002\002\004\000\002\003" +
+    "\010\000\002\003\002\000\002\004\004\000\002\004\002" +
+    "\000\002\005\011\000\002\006\004\000\002\006\002\000" +
+    "\002\007\005\000\002\007\004\000\002\007\005\000\002" +
+    "\007\004\000\002\010\004\000\002\010\002\000\002\011" +
+    "\011\000\002\012\004\000\002\012\002\000\002\013\006" +
+    "\000\002\013\006\000\002\014\004\000\002\014\002\000" +
+    "\002\015\012\000\002\016\003\000\002\016\005\000\002" +
+    "\016\002" });
+
+  /** Access to production table. */
+  public short[][] production_table() {return _production_table;}
+
+  /** Parse-action table. */
+  protected static final short[][] _action_table = 
+    unpackFromStrings(new String[] {
+    "\000\070\000\012\002\ufffe\014\005\016\ufffe\021\ufffe\001" +
+    "\002\000\010\002\ufff3\016\ufff3\021\ufff3\001\002\000\004" +
+    "\015\010\001\002\000\004\002\007\001\002\000\004\002" +
+    "\000\001\002\000\004\025\011\001\002\000\004\011\012" +
+    "\001\002\000\006\012\ufffc\014\ufffc\001\002\000\006\012" +
+    "\016\014\015\001\002\000\006\012\ufffd\014\ufffd\001\002" +
+    "\000\004\024\017\001\002\000\010\002\uffff\016\uffff\021" +
+    "\uffff\001\002\000\004\025\020\001\002\000\004\007\021" +
+    "\001\002\000\010\010\ufff9\024\ufff9\025\ufff9\001\002\000" +
+    "\010\010\025\024\026\025\023\001\002\000\004\025\032" +
+    "\001\002\000\010\010\ufffa\024\ufffa\025\ufffa\001\002\000" +
+    "\004\004\031\001\002\000\004\025\027\001\002\000\012" +
+    "\005\030\010\ufff7\024\ufff7\025\ufff7\001\002\000\010\010" +
+    "\ufff8\024\ufff8\025\ufff8\001\002\000\006\012\ufffb\014\ufffb" +
+    "\001\002\000\012\005\033\010\ufff5\024\ufff5\025\ufff5\001" +
+    "\002\000\010\010\ufff6\024\ufff6\025\ufff6\001\002\000\010" +
+    "\002\uffec\016\037\021\uffec\001\002\000\010\002\ufff4\016" +
+    "\ufff4\021\ufff4\001\002\000\006\002\001\021\057\001\002" +
+    "\000\004\025\040\001\002\000\004\006\041\001\002\000" +
+    "\004\025\042\001\002\000\004\011\043\001\002\000\010" +
+    "\012\ufff0\017\ufff0\020\ufff0\001\002\000\010\012\047\017" +
+    "\046\020\050\001\002\000\010\012\ufff1\017\ufff1\020\ufff1" +
+    "\001\002\000\004\013\054\001\002\000\010\002\ufff2\016" +
+    "\ufff2\021\ufff2\001\002\000\004\013\051\001\002\000\004" +
+    "\025\052\001\002\000\004\004\053\001\002\000\010\012" +
+    "\uffee\017\uffee\020\uffee\001\002\000\004\026\055\001\002" +
+    "\000\004\004\056\001\002\000\010\012\uffef\017\uffef\020" +
+    "\uffef\001\002\000\004\025\061\001\002\000\006\002\uffed" +
+    "\021\uffed\001\002\000\004\022\062\001\002\000\010\005" +
+    "\uffe8\023\uffe8\025\063\001\002\000\006\005\uffea\023\uffea" +
+    "\001\002\000\006\005\065\023\066\001\002\000\004\025" +
+    "\072\001\002\000\004\015\067\001\002\000\004\025\070" +
+    "\001\002\000\004\004\071\001\002\000\006\002\uffeb\021" +
+    "\uffeb\001\002\000\006\005\uffe9\023\uffe9\001\002" });
+
+  /** Access to parse-action table. */
+  public short[][] action_table() {return _action_table;}
+
+  /** <code>reduce_goto</code> table. */
+  protected static final short[][] _reduce_table = 
+    unpackFromStrings(new String[] {
+    "\000\070\000\006\002\005\003\003\001\001\000\004\010" +
+    "\033\001\001\000\002\001\001\000\002\001\001\000\002" +
+    "\001\001\000\002\001\001\000\002\001\001\000\004\004" +
+    "\012\001\001\000\004\005\013\001\001\000\002\001\001" +
+    "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+    "\002\001\001\000\004\006\021\001\001\000\004\007\023" +
+    "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+    "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+    "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+    "\006\011\034\014\035\001\001\000\002\001\001\000\004" +
+    "\015\057\001\001\000\002\001\001\000\002\001\001\000" +
+    "\002\001\001\000\002\001\001\000\004\012\043\001\001" +
+    "\000\004\013\044\001\001\000\002\001\001\000\002\001" +
+    "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+    "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+    "\002\001\001\000\002\001\001\000\002\001\001\000\002" +
+    "\001\001\000\002\001\001\000\004\016\063\001\001\000" +
+    "\002\001\001\000\002\001\001\000\002\001\001\000\002" +
+    "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+    "\001\000\002\001\001" });
+
+  /** Access to <code>reduce_goto</code> table. */
+  public short[][] reduce_table() {return _reduce_table;}
+
+  /** Instance of action encapsulation class. */
+  protected CUP$Parser$actions action_obj;
+
+  /** Action encapsulation object initializer. */
+  protected void init_actions()
+    {
+      action_obj = new CUP$Parser$actions(this);
+    }
+
+  /** Invoke a user supplied parse action. */
+  public java_cup.runtime.Symbol do_action(
+    int                        act_num,
+    java_cup.runtime.lr_parser parser,
+    java.util.Stack            stack,
+    int                        top)
+    throws java.lang.Exception
+  {
+    /* call code in generated class */
+    return action_obj.CUP$Parser$do_action(act_num, parser, stack, top);
+  }
+
+  /** Indicates start state. */
+  public int start_state() {return 0;}
+  /** Indicates start production. */
+  public int start_production() {return 1;}
+
+  /** <code>EOF</code> Symbol index. */
+  public int EOF_sym() {return 0;}
+
+  /** <code>error</code> Symbol index. */
+  public int error_sym() {return 1;}
+
+
+
+  public Parser(Lexer lex, ComplexSymbolFactory sf) {
+    super(lex,sf);
+  }
+  public static void main(String[] args) throws Exception {
+      // initialize the symbol factory
+      ComplexSymbolFactory csf = new ComplexSymbolFactory();
+      // create a buffering scanner wrapper
+      ScannerBuffer lexer = new ScannerBuffer(new Lexer(new BufferedReader(new FileReader(args[0])),csf));
+      // start parsing
+      Parser p = new Parser(lexer,csf);
+      XMLElement e = (XMLElement)p.parse().value;
+      // create XML output file 
+      XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
+      XMLStreamWriter sw = outFactory.createXMLStreamWriter(new FileOutputStream(args[1]), "UTF-8");
+      // dump XML output to the file
+      XMLElement.dump(lexer,sw,e,"expr","stmt");
+
+       // transform the parse tree into an AST and a rendered HTML version
+      Transformer transformer = TransformerFactory.newInstance()
+           .newTransformer(new StreamSource(new File("tree.xsl")));
+      Source text = new StreamSource(new File(args[1]));
+      transformer.transform(text, new StreamResult(new File("output.xml")));
+      transformer = TransformerFactory.newInstance()
+           .newTransformer(new StreamSource(new File("tree-view.xsl")));
+      text = new StreamSource(new File("output.xml"));
+      transformer.transform(text, new StreamResult(new File("ast.html")));
+  }
+
+
+/** Cup generated class to encapsulate user supplied action code.*/
+@SuppressWarnings({"rawtypes", "unchecked", "unused"})
+class CUP$Parser$actions {
+  private final Parser parser;
+
+  /** Constructor */
+  CUP$Parser$actions(Parser parser) {
+    this.parser = parser;
+  }
+
+  /** Method 0 with the actual generated action code for actions 0 to 300. */
+  public final java_cup.runtime.Symbol CUP$Parser$do_action_part00000000(
+    int                        CUP$Parser$act_num,
+    java_cup.runtime.lr_parser CUP$Parser$parser,
+    java.util.Stack            CUP$Parser$stack,
+    int                        CUP$Parser$top)
+    throws java.lang.Exception
+    {
+      /* Symbol object for return from actions */
+      java_cup.runtime.Symbol CUP$Parser$result;
+
+      /* select the action based on the action number */
+      switch (CUP$Parser$act_num)
+        {
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 0: // policy ::= intface capablist reqlist 
+            {
+                XMLElement RESULT;
+               Location inxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location inxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object in = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location capxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location capxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object cap = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location rlxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location rlxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object rl = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("policy",0,(XMLElement)in,(XMLElement)cap,(XMLElement)rl);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("policy",0, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 1: // $START ::= policy EOF 
+            {
+                XMLElement RESULT;
+               Location start_valxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location start_valxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object start_val = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location EOF1xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location EOF1xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object EOF1 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("_START",0,(XMLElement)start_val);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("$START",0, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          /* ACCEPT */
+          CUP$Parser$parser.done_parsing();
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 2: // intface ::= PUBLIC INTERFACE IDENT BEGIN methlist END 
+            {
+                XMLElement RESULT;
+               Location PUBLIC0xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).xleft;
+               Location PUBLIC0xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).xright;
+               Object PUBLIC0 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               Location INTERFACE1xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).xleft;
+               Location INTERFACE1xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).xright;
+               Object INTERFACE1 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               Location idintxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xleft;
+               Location idintxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xright;
+               Object idint = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               Location BEGIN3xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location BEGIN3xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object BEGIN3 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location mlxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location mlxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object ml = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location END5xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location END5xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object END5 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("intface",0,new XMLElement.Terminal(idintxleft,"idint",idint,idintxright),(XMLElement)ml);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("intface",1, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 3: // intface ::= 
+            {
+                XMLElement RESULT;
+
+                RESULT = new XMLElement.NonTerminal("intface",1);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("intface",1, ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 4: // methlist ::= methlist meth 
+            {
+                XMLElement RESULT;
+               Location mlxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location mlxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object ml = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location mxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location mxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object m = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("methlist",0,(XMLElement)ml,(XMLElement)m);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("methlist",2, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 5: // methlist ::= 
+            {
+                XMLElement RESULT;
+
+                RESULT = new XMLElement.NonTerminal("methlist",1);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("methlist",2, ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 6: // meth ::= PUBLIC TYPE IDENT LPAR paramlist RPAR SEMICOLON 
+            {
+                XMLElement RESULT;
+               Location PUBLIC0xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).xleft;
+               Location PUBLIC0xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).xright;
+               Object PUBLIC0 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-6)).value;
+               Location typemethxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).xleft;
+               Location typemethxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).xright;
+               Object typemeth = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               Location idmethxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).xleft;
+               Location idmethxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).xright;
+               Object idmeth = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               Location LPAR3xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xleft;
+               Location LPAR3xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xright;
+               Object LPAR3 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               Location plxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location plxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object pl = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location RPAR5xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location RPAR5xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object RPAR5 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location SEMICOLON6xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location SEMICOLON6xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object SEMICOLON6 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("meth",0,new XMLElement.Terminal(typemethxleft,"typemeth",typemeth,typemethxright),new XMLElement.Terminal(idmethxleft,"idmeth",idmeth,idmethxright),(XMLElement)pl);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("meth",3, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 7: // paramlist ::= paramlist param 
+            {
+                XMLElement RESULT;
+               Location plxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location plxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object pl = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location pxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location pxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object p = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("paramlist",0,(XMLElement)pl,(XMLElement)p);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("paramlist",4, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 8: // paramlist ::= 
+            {
+                XMLElement RESULT;
+
+                RESULT = new XMLElement.NonTerminal("paramlist",1);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("paramlist",4, ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 9: // param ::= TYPE IDENT COMMA 
+            {
+                XMLElement RESULT;
+               Location typeprmxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location typeprmxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object typeprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location idprmxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location idprmxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location COMMA2xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location COMMA2xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object COMMA2 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("param",0,new XMLElement.Terminal(typeprmxleft,"typeprm",typeprm,typeprmxright),new XMLElement.Terminal(idprmxleft,"idprm",idprm,idprmxright));
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 10: // param ::= TYPE IDENT 
+            {
+                XMLElement RESULT;
+               Location typeprmxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location typeprmxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object typeprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location idprmxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location idprmxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("param",1,new XMLElement.Terminal(typeprmxleft,"typeprm",typeprm,typeprmxright),new XMLElement.Terminal(idprmxleft,"idprm",idprm,idprmxright));
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 11: // param ::= IDENT IDENT COMMA 
+            {
+                XMLElement RESULT;
+               Location clsprmxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location clsprmxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location idprmxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location idprmxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location COMMA2xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location COMMA2xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object COMMA2 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("param",2,new XMLElement.Terminal(clsprmxleft,"clsprm",clsprm,clsprmxright),new XMLElement.Terminal(idprmxleft,"idprm",idprm,idprmxright));
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 12: // param ::= IDENT IDENT 
+            {
+                XMLElement RESULT;
+               Location clsprmxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location clsprmxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location idprmxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location idprmxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("param",3,new XMLElement.Terminal(clsprmxleft,"clsprm",clsprm,clsprmxright),new XMLElement.Terminal(idprmxleft,"idprm",idprm,idprmxright));
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 13: // capablist ::= capablist capab 
+            {
+                XMLElement RESULT;
+               Location clistxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location clistxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object clist = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location capxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location capxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object cap = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("capablist",0,(XMLElement)clist,(XMLElement)cap);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("capablist",6, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 14: // capablist ::= 
+            {
+                XMLElement RESULT;
+
+                RESULT = new XMLElement.NonTerminal("capablist",1);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("capablist",6, ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 15: // capab ::= CAPABILITY IDENT DOT IDENT BEGIN capabcont END 
+            {
+                XMLElement RESULT;
+               Location CAPABILITY0xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).xleft;
+               Location CAPABILITY0xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).xright;
+               Object CAPABILITY0 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-6)).value;
+               Location idintxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).xleft;
+               Location idintxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).xright;
+               Object idint = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               Location DOT2xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).xleft;
+               Location DOT2xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).xright;
+               Object DOT2 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               Location idcapxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xleft;
+               Location idcapxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xright;
+               Object idcap = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               Location BEGIN4xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location BEGIN4xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object BEGIN4 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location ccontxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location ccontxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object ccont = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location END6xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location END6xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object END6 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("capab",0,new XMLElement.Terminal(idintxleft,"idint",idint,idintxright),new XMLElement.Terminal(idcapxleft,"idcap",idcap,idcapxright),(XMLElement)ccont);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("capab",7, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 16: // capabcont ::= capabcont cont 
+            {
+                XMLElement RESULT;
+               Location ccontxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location ccontxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object ccont = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location cntxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location cntxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object cnt = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("capabcont",0,(XMLElement)ccont,(XMLElement)cnt);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("capabcont",8, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 17: // capabcont ::= 
+            {
+                XMLElement RESULT;
+
+                RESULT = new XMLElement.NonTerminal("capabcont",1);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("capabcont",8, ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 18: // cont ::= DESCRIPTION ASSIGN STRINGCONST SEMICOLON 
+            {
+                XMLElement RESULT;
+               Location dscxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xleft;
+               Location dscxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xright;
+               Object dsc = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               Location ASSIGN1xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location ASSIGN1xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object ASSIGN1 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location STRINGCONST2xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location STRINGCONST2xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object STRINGCONST2 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location SEMICOLON3xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location SEMICOLON3xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object SEMICOLON3 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("cont",0,new XMLElement.Terminal(dscxleft,"dsc",dsc,dscxright));
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("cont",9, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 19: // cont ::= METHOD ASSIGN IDENT SEMICOLON 
+            {
+                XMLElement RESULT;
+               Location mtdxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xleft;
+               Location mtdxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xright;
+               Object mtd = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               Location ASSIGN1xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location ASSIGN1xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object ASSIGN1 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location idmethxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location idmethxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object idmeth = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location SEMICOLON3xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location SEMICOLON3xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object SEMICOLON3 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("cont",1,new XMLElement.Terminal(mtdxleft,"mtd",mtd,mtdxright),new XMLElement.Terminal(idmethxleft,"idmeth",idmeth,idmethxright));
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("cont",9, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 20: // reqlist ::= reqlist require 
+            {
+                XMLElement RESULT;
+               Location rlxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location rlxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object rl = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location reqxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location reqxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object req = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("reqlist",0,(XMLElement)rl,(XMLElement)req);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("reqlist",10, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 21: // reqlist ::= 
+            {
+                XMLElement RESULT;
+
+                RESULT = new XMLElement.NonTerminal("reqlist",1);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("reqlist",10, ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 22: // require ::= REQUIRES IDENT WITH capintlist AS INTERFACE IDENT SEMICOLON 
+            {
+                XMLElement RESULT;
+               Location REQUIRES0xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).xleft;
+               Location REQUIRES0xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).xright;
+               Object REQUIRES0 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-7)).value;
+               Location idintxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).xleft;
+               Location idintxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).xright;
+               Object idint = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-6)).value;
+               Location WITH2xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).xleft;
+               Location WITH2xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).xright;
+               Object WITH2 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               Location cilxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).xleft;
+               Location cilxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).xright;
+               Object cil = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               Location AS4xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xleft;
+               Location AS4xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).xright;
+               Object AS4 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               Location INTERFACE5xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location INTERFACE5xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object INTERFACE5 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location idnewintxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location idnewintxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object idnewint = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location SEMICOLON7xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location SEMICOLON7xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object SEMICOLON7 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("require",0,new XMLElement.Terminal(idintxleft,"idint",idint,idintxright),(XMLElement)cil,new XMLElement.Terminal(idnewintxleft,"idnewint",idnewint,idnewintxright));
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("require",11, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 23: // capintlist ::= IDENT 
+            {
+                XMLElement RESULT;
+               Location idcapxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location idcapxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object idcap = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("capintlist",0,new XMLElement.Terminal(idcapxleft,"idcap",idcap,idcapxright));
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("capintlist",12, ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 24: // capintlist ::= capintlist COMMA IDENT 
+            {
+                XMLElement RESULT;
+               Location cilxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xleft;
+               Location cilxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).xright;
+               Object cil = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               Location COMMA1xleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xleft;
+               Location COMMA1xright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).xright;
+               Object COMMA1 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               Location idcapxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xleft;
+               Location idcapxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$Parser$stack.peek()).xright;
+               Object idcap = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+
+                RESULT = new XMLElement.NonTerminal("capintlist",1,(XMLElement)cil,new XMLElement.Terminal(idcapxleft,"idcap",idcap,idcapxright));
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("capintlist",12, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 25: // capintlist ::= 
+            {
+                XMLElement RESULT;
+
+                RESULT = new XMLElement.NonTerminal("capintlist",2);
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("capintlist",12, ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /* . . . . . .*/
+          default:
+            throw new Exception(
+               "Invalid action number "+CUP$Parser$act_num+"found in internal parse table");
+
+        }
+    } /* end of method */
+
+  /** Method splitting the generated action code into several parts. */
+  public final java_cup.runtime.Symbol CUP$Parser$do_action(
+    int                        CUP$Parser$act_num,
+    java_cup.runtime.lr_parser CUP$Parser$parser,
+    java.util.Stack            CUP$Parser$stack,
+    int                        CUP$Parser$top)
+    throws java.lang.Exception
+    {
+              return CUP$Parser$do_action_part00000000(
+                               CUP$Parser$act_num,
+                               CUP$Parser$parser,
+                               CUP$Parser$stack,
+                               CUP$Parser$top);
+    }
+}
+
+}
diff --git a/iotjava/iotparser/sym.java b/iotjava/iotparser/sym.java
new file mode 100644 (file)
index 0000000..d34e748
--- /dev/null
@@ -0,0 +1,55 @@
+package iotparser;
+
+//----------------------------------------------------
+// The following code was generated by CUP v0.11b 20160615 (GIT 4ac7450)
+//----------------------------------------------------
+
+/** CUP generated interface containing symbol constants. */
+public interface sym {
+  /* terminals */
+  public static final int IDENT = 19;
+  public static final int SEMICOLON = 2;
+  public static final int STRINGCONST = 20;
+  public static final int REQUIRES = 15;
+  public static final int END = 8;
+  public static final int CAPABILITY = 12;
+  public static final int AS = 17;
+  public static final int WITH = 16;
+  public static final int PUBLIC = 10;
+  public static final int BEGIN = 7;
+  public static final int TYPE = 18;
+  public static final int DESCRIPTION = 13;
+  public static final int COMMA = 3;
+  public static final int EOF = 0;
+  public static final int METHOD = 14;
+  public static final int error = 1;
+  public static final int DOT = 4;
+  public static final int INTERFACE = 11;
+  public static final int ASSIGN = 9;
+  public static final int RPAR = 6;
+  public static final int LPAR = 5;
+  public static final String[] terminalNames = new String[] {
+  "EOF",
+  "error",
+  "SEMICOLON",
+  "COMMA",
+  "DOT",
+  "LPAR",
+  "RPAR",
+  "BEGIN",
+  "END",
+  "ASSIGN",
+  "PUBLIC",
+  "INTERFACE",
+  "CAPABILITY",
+  "DESCRIPTION",
+  "METHOD",
+  "REQUIRES",
+  "WITH",
+  "AS",
+  "TYPE",
+  "IDENT",
+  "STRINGCONST"
+  };
+}
+
diff --git a/jars/java-cup-bin-11b-20160615/java-cup-11b-runtime.jar b/jars/java-cup-bin-11b-20160615/java-cup-11b-runtime.jar
new file mode 100644 (file)
index 0000000..6f02157
Binary files /dev/null and b/jars/java-cup-bin-11b-20160615/java-cup-11b-runtime.jar differ
diff --git a/jars/java-cup-bin-11b-20160615/java-cup-11b.jar b/jars/java-cup-bin-11b-20160615/java-cup-11b.jar
new file mode 100644 (file)
index 0000000..f065a72
Binary files /dev/null and b/jars/java-cup-bin-11b-20160615/java-cup-11b.jar differ
diff --git a/others/javacup/README b/others/javacup/README
new file mode 100644 (file)
index 0000000..0ff3129
--- /dev/null
@@ -0,0 +1,8 @@
+Compiling JavaCUP source code into a parser java file:
+
+1) Read the manual to get the JavaCUP up and running on our system here: http://www2.cs.tum.edu/projects/cup/
+2) Download the JavaCUP library
+3) Compile the JavaCUP (.cup) file using this command:
+
+       java -jar <path-to-jar>/java-cup-xxb.jar -interface -parser Parser [-xmlactions] iotparser.cup
+4) A file, Parser.java, will be generated and it can be compiled with the Lexer.java from Jflex
diff --git a/others/javacup/iotparser.cup b/others/javacup/iotparser.cup
new file mode 100644 (file)
index 0000000..ca44aae
--- /dev/null
@@ -0,0 +1,100 @@
+/* Minijava Grammar */
+import java_cup.runtime.ComplexSymbolFactory;
+import java_cup.runtime.ScannerBuffer;
+import java_cup.runtime.XMLElement;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.*;
+
+import javax.xml.transform.*;
+import javax.xml.transform.stream.*;
+parser code {:
+  public Parser(Lexer lex, ComplexSymbolFactory sf) {
+    super(lex,sf);
+  }
+  public static void main(String[] args) throws Exception {
+      // initialize the symbol factory
+      ComplexSymbolFactory csf = new ComplexSymbolFactory();
+      // create a buffering scanner wrapper
+      ScannerBuffer lexer = new ScannerBuffer(new Lexer(new BufferedReader(new FileReader(args[0])),csf));
+      // start parsing
+      Parser p = new Parser(lexer,csf);
+      XMLElement e = (XMLElement)p.parse().value;
+      // create XML output file 
+      XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
+      XMLStreamWriter sw = outFactory.createXMLStreamWriter(new FileOutputStream(args[1]), "UTF-8");
+      // dump XML output to the file
+      XMLElement.dump(lexer,sw,e,"expr","stmt");
+
+       // transform the parse tree into an AST and a rendered HTML version
+      Transformer transformer = TransformerFactory.newInstance()
+           .newTransformer(new StreamSource(new File("tree.xsl")));
+      Source text = new StreamSource(new File(args[1]));
+      transformer.transform(text, new StreamResult(new File("output.xml")));
+      transformer = TransformerFactory.newInstance()
+           .newTransformer(new StreamSource(new File("tree-view.xsl")));
+      text = new StreamSource(new File("output.xml"));
+      transformer.transform(text, new StreamResult(new File("ast.html")));
+  }
+:};
+
+terminal SEMICOLON, COMMA, DOT, LPAR, RPAR, BEGIN, END, ASSIGN;
+terminal PUBLIC, INTERFACE, CAPABILITY, DESCRIPTION, METHOD, REQUIRES, WITH, AS; 
+terminal TYPE;
+terminal IDENT, STRINGCONST;
+
+non terminal policy, intface, methlist, meth, paramlist, param;
+non terminal capablist, capab, capabcont, cont;
+non terminal reqlist, require, capintlist;
+
+/**
+ * A policy file normally consists of 3 parts:
+ * 1) Interface (in Java syntax)
+ * 2) List of capabilities and their contents
+ * 3) List of interface generation definitions
+ */
+policy     ::= intface:in capablist:cap reqlist:rl
+    ;
+
+// Interface class definition
+intface    ::= PUBLIC INTERFACE IDENT:idint BEGIN methlist:ml END
+    | /* empty */
+    ;
+methlist   ::= methlist:ml meth:m
+    | /* empty */
+    ;
+meth       ::= PUBLIC TYPE:typemeth IDENT:idmeth LPAR paramlist:pl RPAR SEMICOLON
+    ;
+paramlist  ::= paramlist:pl param:p
+    | /* empty */
+    ;
+param      ::= TYPE:typeprm IDENT:idprm COMMA
+    | TYPE:typeprm IDENT:idprm
+    | IDENT:clsprm IDENT:idprm COMMA
+    | IDENT:clsprm IDENT:idprm
+    ;
+
+// List of capabilities and their respective contents, i.e. description, method, etc.
+capablist  ::= capablist:clist capab:cap
+       | /* empty */
+       ;
+capab      ::= CAPABILITY IDENT:idint DOT IDENT:idcap BEGIN capabcont:ccont END
+    ;
+capabcont  ::= capabcont:ccont cont:cnt
+       | /* empty */
+       ;
+cont       ::= DESCRIPTION:dsc ASSIGN STRINGCONST SEMICOLON
+       | METHOD:mtd ASSIGN IDENT:idmeth SEMICOLON
+       ;
+
+// List of interface generation definitions
+reqlist    ::= reqlist:rl require:req
+       | /* empty */
+       ;
+require    ::= REQUIRES IDENT:idint WITH capintlist:cil AS INTERFACE IDENT:idnewint SEMICOLON
+       ;
+capintlist ::= IDENT:idcap
+       | capintlist:cil COMMA IDENT:idcap
+       | /* empty */
+       ;
+
diff --git a/others/jflex/README b/others/jflex/README
new file mode 100644 (file)
index 0000000..af42080
--- /dev/null
@@ -0,0 +1,8 @@
+Compiling Jflex source code into a lexer java file:
+
+1) Read the manual to install Jflex on our system here: http://jflex.de/manual.html
+2) Don't forget to compile the JavaCUP (.cup) file first if we want to connect the Jflex lexer with a JavaCUP parser
+3) Compile the Jflex (.jflex) file using this command:
+
+       jflex <filename>.jflex
+4) A file, Lexer.java, will be generated and it can be compiled together with the Parser.java and sym.java from JavaCUP
diff --git a/others/jflex/iotparser.jflex b/others/jflex/iotparser.jflex
new file mode 100644 (file)
index 0000000..bad298e
--- /dev/null
@@ -0,0 +1,131 @@
+// JFlex parser specification written by
+// Rahmadi Trimananda
+// for Sentinel system
+// University of California, Irvine
+
+// Technische Universitaet Muenchen 
+// Fakultaet fuer Informatik 
+
+import java_cup.runtime.Symbol;
+import java_cup.runtime.ComplexSymbolFactory;
+import java_cup.runtime.ComplexSymbolFactory.Location;
+
+%%
+
+%public
+%class Lexer
+%cup
+%implements sym
+%char
+%line
+%column
+
+%{
+    StringBuffer string = new StringBuffer();
+    public Lexer(java.io.Reader in, ComplexSymbolFactory sf){
+       this(in);
+       symbolFactory = sf;
+    }
+    ComplexSymbolFactory symbolFactory;
+
+  private Symbol symbol(String name, int sym) {
+      return symbolFactory.newSymbol(name, sym, new Location(yyline+1,yycolumn+1,yychar), new Location(yyline+1,yycolumn+yylength(),yychar+yylength()));
+  }
+  
+  private Symbol symbol(String name, int sym, Object val) {
+      Location left = new Location(yyline+1,yycolumn+1,yychar);
+      Location right= new Location(yyline+1,yycolumn+yylength(), yychar+yylength());
+      return symbolFactory.newSymbol(name, sym, left, right,val);
+  } 
+  private Symbol symbol(String name, int sym, Object val,int buflength) {
+      Location left = new Location(yyline+1,yycolumn+yylength()-buflength,yychar+yylength()-buflength);
+      Location right= new Location(yyline+1,yycolumn+yylength(), yychar+yylength());
+      return symbolFactory.newSymbol(name, sym, left, right,val);
+  }       
+  private void error(String message) {
+    System.out.println("Error at line "+(yyline+1)+", column "+(yycolumn+1)+" : "+message);
+  }
+%} 
+
+%eofval{
+     return symbolFactory.newSymbol("EOF", EOF, new Location(yyline+1,yycolumn+1,yychar), new Location(yyline+1,yycolumn+1,yychar+1));
+%eofval}
+
+
+Ident = [a-zA-Z$_] [a-zA-Z0-9$_]*
+
+new_line = \r|\n|\r\n;
+
+white_space = {new_line} | [ \t\f]
+
+%state STRING
+
+%%
+
+<YYINITIAL>{
+/* keywords */
+"int"             { return symbol("int",TYPE, "INT" ); }
+"short"           { return symbol("short",TYPE, "SHORT" ); }
+"byte"            { return symbol("byte",TYPE, "BYTE" ); }
+"long"            { return symbol("long",TYPE, "LONG" ); }
+"float"           { return symbol("float",TYPE, "FLOAT" ); }
+"double"          { return symbol("double",TYPE, "DOUBLE" ); }
+"char"            { return symbol("char",TYPE, "CHAR" ); }
+"string"          { return symbol("string",TYPE, "STRING" ); }
+"boolean"         { return symbol("boolean",TYPE, "BOOL" ); }
+"void"            { return symbol("void",TYPE, "VOID" ); }
+"public"          { return symbol("public",PUBLIC); }
+"interface"       { return symbol("interface",INTERFACE); }
+"capability"      { return symbol("capability",CAPABILITY); }
+"description"     { return symbol("description",DESCRIPTION); }
+"method"          { return symbol("method",METHOD); }
+"requires"        { return symbol("requires",REQUIRES); }
+"with"            { return symbol("with",WITH); }
+"as"              { return symbol("as",AS); }
+
+/* names */
+{Ident}           { return symbol("Identifier",IDENT, yytext()); }
+
+  
+/* string literals */
+
+/* char literal */
+
+/* bool literal */
+
+/* literals */
+
+
+
+/* separators */
+  \"              { string.setLength(0); yybegin(STRING); }
+";"               { return symbol("semicolon",SEMICOLON); }
+","               { return symbol("comma",COMMA); }
+"."               { return symbol("dot",DOT); }
+"("               { return symbol("(",LPAR); }
+")"               { return symbol(")",RPAR); }
+"{"               { return symbol("{",BEGIN); }
+"}"               { return symbol("}",END); }
+"="               { return symbol("=",ASSIGN); }
+
+{white_space}     { /* ignore */ }
+
+}
+
+<STRING> {
+  \"                             { yybegin(YYINITIAL); 
+      return symbol("StringConst",STRINGCONST,string.toString(),string.length()); }
+  [^\n\r\"\\]+                   { string.append( yytext() ); }
+  \\t                            { string.append('\t'); }
+  \\n                            { string.append('\n'); }
+
+  \\r                            { string.append('\r'); }
+  \\\"                           { string.append('\"'); }
+  \\                             { string.append('\\'); }
+}
+
+
+/* error fallback */
+.|\n              {  /* throw new Error("Illegal character <"+ yytext()+">");*/
+                   error("Illegal character <"+ yytext()+">");
+                  }