Commit 08e84686 authored by Matthew Dawson's avatar Matthew Dawson
Browse files

Add first run of java side of 704 assignment.

First run of java code for generating better verification code.
Currently pre-PoC, but matlab talks to it and start of parser 
works.  Uses maven to build.


git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/branches/TableTool_javization@9607 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parents
Loading
Loading
Loading
Loading

pom.xml

0 → 100644
+83 −0
Original line number Diff line number Diff line
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>ca.mcmaster.cas</groupId>
    <artifactId>Matlab2SMT</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Matlab2SMT</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr4-runtime</artifactId>
            <version>4.0</version>
        </dependency>
    </dependencies>
  
    <build>
        <plugins>
            <plugin>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-maven-plugin</artifactId>
                <version>4.0</version>
                <configuration>
                    <sourceDirectory>src/main/java</sourceDirectory>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>antlr4</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <showDeprecation>true</showDeprecation>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-4</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>ca.mcmaster.cas.matlab2smt.App</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
+27 −0
Original line number Diff line number Diff line
package ca.mcmaster.cas.matlab2smt;

import java.util.logging.Level;
import java.util.logging.Logger;
import org.antlr.v4.runtime.misc.TestRig;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        String[] args2 = {"ca.mcmaster.cas.matlab2smt.VariableParser", "varlist", "-tree"};
        try {
            TestRig.main(args2);
        } catch (Exception ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println( "Hello World!" );
    }

    public int test(Object p) {
        return 5;
    }
}
+6 −0
Original line number Diff line number Diff line

// Define a grammar called Hello
grammar Hello;
r  : 'hello' ID ;         // match keyword hello followed by an identifier
ID : [a-z]+ ;             // match lower-case identifiers
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
+7 −0
Original line number Diff line number Diff line
grammar VariableParser;

varlist: var (',' var)*; //Build list of variables
var:    ID;

ID: [a-zA-Z][a-zA-Z0-9]*; //Variable identifier.  Start with letter, then alpha numerical allowed.
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
+46 −0
Original line number Diff line number Diff line
package ca.mcmaster.cas.matlab2smt;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * Unit test for simple App.
 */
public class AppTest 
    extends TestCase
{
    /**
     * Create the test case
     *
     * @param testName name of the test case
     */
    public AppTest( String testName )
    {
        super( testName );
    }

    /**
     * @return the suite of tests being tested
     */
    public static Test suite()
    {
        return new TestSuite( AppTest.class );
    }

    /**
     * Rigourous Test :-)
     */
    public void testApp()
    {
        assertTrue( true );
    }

    /**
     * Rigourous Test :-)
     */
    public void testAppFail()
    {
        assertFalse( false );
    }
}