Skip to content

Commit

Permalink
Mavenized the project, removed Ant build file.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkiers committed Jul 8, 2014
1 parent d956491 commit f379faf
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 70 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.iml
.idea/
target/
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A small expression parser, using ANTLR 4. It supports most basic operators
and `for`-, `while`- and `log`- (print) statements. It is just a basic
demonstration of how to use the `-visitor` functionality of ANTLR 4.

To run [the demo script](https://github.com/bkiers/Mu/blob/master/src/scripts/test.mu):
To run [the demo script](https://github.com/bkiers/Mu/blob/master/src/main/mu/test.mu):

```
n = 9;
Expand All @@ -28,7 +28,8 @@ do:

```
git clone git://github.com/bkiers/Mu.git
ant -e run
mvn clean install
mvn -q exec:java
```

which will print the following to your console:
Expand Down
60 changes: 0 additions & 60 deletions build.xml

This file was deleted.

Binary file removed lib/antlr-4.0-complete.jar
Binary file not shown.
80 changes: 80 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>nl.big-o</groupId>
<artifactId>mu</artifactId>
<packaging>jar</packaging>
<version>0.1.1</version>
<name>mu</name>

<properties>
<antlr4.version>4.3</antlr4.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<dependencies>

<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>${antlr4.version}</version>
</dependency>

<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>${antlr4.version}</version>
<scope>compile</scope>
</dependency>

</dependencies>

<build>

<plugins>

<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>${antlr4.version}</version>
<configuration>
<arguments>
<argument>-visitor</argument>
</arguments>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>mu.Main</mainClass>
</configuration>
</plugin>

</plugins>

</build>

</project>
8 changes: 0 additions & 8 deletions src/grammar/Mu.g4 → src/main/antlr4/mu/Mu.g4
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
grammar Mu;

@parser::header {
package mu;
}

@lexer::header {
package mu;
}

parse
: block EOF
;
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions src/main/mu/Main.java → src/main/java/mu/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ public class Main {

public static void main(String[] args) throws Exception {

if (args.length == 0) {
args = new String[]{"src/main/mu/test.mu"};
}

System.out.println("parsing: " + args[0]);

MuLexer lexer = new MuLexer(new ANTLRFileStream(args[0]));
MuParser parser = new MuParser(new CommonTokenStream(lexer));
ParseTree tree = parser.parse();
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit f379faf

Please sign in to comment.