Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .classpath

This file was deleted.

18 changes: 18 additions & 0 deletions .gitHooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# First: git config core.hooksPath `pwd`/.gitHooks

# Copy jar file to repo root
# JAR_FILE=Turtle-Interpreter/target/Turtle-Interpreter-0.1.0.jar

# cp ${JAR_FILE} .
# EXIT_CODES=( $? )
# git add -A
# EXIT_CODES+=( $? )

# for e in ${EXIT_CODES[@]}; do
# if [[ $e -gt 0 ]]
# then
# exit 1
# fi
# done
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/bin/
**/target/
17 changes: 0 additions & 17 deletions .project

This file was deleted.

36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# Turtle-Interpreter
Simple Turtle Interpter.
To build: import in Eclipse.
Run TurtleInterpreter.
A window should appear with button "Open File", click on button and a dialog box should appear.
Select from folder TurtlePrograms any sample program.
Simple Turtle Interpreter.

To run: `$ cd Turtle-Interpreter && make run`

A window should appear with button "Open Program File":
- Click on button and a dialog box should appear.
- Select from folder Programs any sample program.

The interpreter will go through the commands in file and move Turtles.
You can select more input files.
You can also write your input file using an editor of your choice and see how it behaves.

You can select more input files. You can also write your input file using an editor of your choice and see how it behaves.

```
Language commands:
turtle name - create a new turtle identified by the given name
move name x - moves the named turtle forward by x units
left name x - rotate the turtle anticlockwise by x degrees
right name x - rotate the turtle clockwise by x degrees
pen name up - lift the pen off the “paper”
pen name down - put the pen down so that subsequent moves draw of the screen
colour name c - set the drawing colour of the turtle appropriately
Possible colours: red, blue, cyan, orange and green. Default is black or argument is unspecified colour.
- turtle name -> create a new turtle identified by the given name
- move name x -> moves the named turtle forward by x units
- left name x -> rotate the turtle anticlockwise by x degrees
- right name x -> rotate the turtle clockwise by x degrees
- pen name up -> lift the pen off the “paper”
- pen name down -> put the pen down so that subsequent moves draw of the screen
- color name c -> set the drawing color of the turtle appropriately
- Possible colors: red, blue, cyan, orange and green. Default is black or argument is unspecified color.
```
10 changes: 10 additions & 0 deletions Turtle-Interpreter/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"cSpell.language": "en",
"cSpell.enabledLanguageIds": [
"markdown"
],
"files.exclude": {
"**/target": true
},
"java.configuration.updateBuildConfiguration": "automatic"
}
9 changes: 9 additions & 0 deletions Turtle-Interpreter/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test:
@mvn test

run:
@mvn compile && mvn package && java -jar -XX:+UseZGC -XX:+ZGenerational target/Turtle-Interpreter-0.1.0.jar

upgrade:
@mvn release:update-versions
@mvn versions:use-latest-releases
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
57 changes: 57 additions & 0 deletions Turtle-Interpreter/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>TurtleInterpreter</groupId>
<artifactId>Turtle-Interpreter</artifactId>
<name>Turtle-Interpreter</name>
<version>0.1.0</version>
<description>Turtle-Interpreter.</description>
<url>https://turtle.interpreter</url>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer>
<mainClass>TurtleInterpreter.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<properties>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
77 changes: 77 additions & 0 deletions Turtle-Interpreter/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>

<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>TurtleInterpreter</groupId>
<artifactId>Turtle-Interpreter</artifactId>
<version>0.1.0</version>

<name>Turtle-Interpreter</name>
<description>Turtle-Interpreter.</description>
<url>https://turtle.interpreter</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
</dependencies>

<build>
<plugins>

<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>

<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>

<!-- Uber-Jar builder -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>TurtleInterpreter.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>

<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>
77 changes: 77 additions & 0 deletions Turtle-Interpreter/pom.xml.versionsBackup
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>

<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>TurtleInterpreter</groupId>
<artifactId>Turtle-Interpreter</artifactId>
<version>0.1.1-SNAPSHOT</version>

<name>Turtle-Interpreter</name>
<description>Turtle-Interpreter.</description>
<url>https://turtle.interpreter</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>

<build>
<plugins>

<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>

<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>

<!-- Uber-Jar builder -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>TurtleInterpreter.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>

<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>
21 changes: 21 additions & 0 deletions Turtle-Interpreter/src/main/java/TurtleInterpreter/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package TurtleInterpreter;

import java.io.IOException;
import TurtleInterpreter.domain.Interpreter;

/**
* Turtle Interpreter
*/
public class App {

public static void main(String[] args){
Interpreter p = new Interpreter();
try {
p.run();
} catch (IOException e) {
System.err.println(e.getMessage());
}

}

}
Loading