-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jazzepi
authored and
Jazzepi
committed
Nov 5, 2009
1 parent
e3772dd
commit 6ec2f81
Showing
17 changed files
with
269 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>RobotWarsSVN</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#Wed Nov 04 12:00:17 GMT-05:00 2009 | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package lexer; | ||
|
||
import java.util.ArrayList; | ||
|
||
import lexer.Token.TokenType; | ||
|
||
public class Block { | ||
|
||
ArrayList<Statement> block = new ArrayList<Statement>(); | ||
|
||
Block(Token current, Token lookAhead, TextFile body) | ||
{ | ||
while(current != null && lookAhead != null && (current.getType() == TokenType.KEYWORD | current.getType() == TokenType.GAMEORDER) && !current.getText().equals("RETURN")) | ||
{ | ||
if(current.equals("IF")) | ||
{ | ||
if (lookAhead.equals("(")) | ||
{ | ||
current = body.getNonWSToken(); | ||
lookAhead = body.getNonWSToken(); | ||
IfOnly ifOnlyBlockToBeAdded = new IfOnly(current, lookAhead, body); | ||
block.add(ifOnlyBlockToBeAdded); | ||
} | ||
else | ||
{ | ||
System.out.println("ERROR: ( expected after IF on line" + body.getLine()); | ||
} | ||
} | ||
else if(current.equals("IFELSE")) | ||
{ | ||
if (lookAhead.equals("(")) | ||
{ | ||
current = body.getNonWSToken(); | ||
lookAhead = body.getNonWSToken(); | ||
IfElse ifElseBlockToBeAdded = new IfElse(current, lookAhead, body); | ||
block.add(ifElseBlockToBeAdded); | ||
} | ||
else | ||
{ | ||
System.out.println("ERROR: ( expected after IFELSE on line" + body.getLine()); | ||
} | ||
} | ||
else if(current.equals("WHILE")) | ||
{ | ||
if (lookAhead.equals("(")) | ||
{ | ||
current = body.getNonWSToken(); | ||
lookAhead = body.getNonWSToken(); | ||
While whileBlockToBeAdded = new While(current, lookAhead, body); | ||
block.add(whileBlockToBeAdded); | ||
} | ||
else | ||
{ | ||
System.out.println("ERROR: ( expected after WHILE on line" + body.getLine()); | ||
} | ||
} | ||
else if(current.equals("VAR")) | ||
{ | ||
if (lookAhead.getType() == TokenType.IDENTIFIER) | ||
{ | ||
current = body.getNonWSToken(); | ||
lookAhead = body.getNonWSToken(); | ||
VariableAssignment variableAssignmentStatementToBeAdded = new VariableAssignment(current, lookAhead, body); | ||
block.add(variableAssignmentStatementToBeAdded); | ||
} | ||
else | ||
{ | ||
System.out.println("ERROR: IDENTIFIER expected after VAR on line" + body.getLine()); | ||
} | ||
} | ||
else if(current.getType() == TokenType.GAMEORDER) | ||
{ | ||
if (lookAhead.equals("(")) | ||
{ | ||
current = body.getNonWSToken(); | ||
lookAhead = body.getNonWSToken(); | ||
GameCommand gameCommandStatementToBeAdded = new GameCommand(current, lookAhead, body); | ||
block.add(gameCommandStatementToBeAdded); | ||
} | ||
else | ||
{ | ||
System.out.println("ERROR: ( expected after GAMEORDER on line" + body.getLine()); | ||
} | ||
} | ||
else | ||
{ | ||
System.out.println("ERROR: IF, IFELSE, WHILE, VAR, or GAMEORDER command expected while parsing line "+ body.getLine()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package lexer; | ||
|
||
import java.util.ArrayList; | ||
|
||
import lexer.Token.TokenType; | ||
|
||
public class Expression { | ||
|
||
|
||
|
||
public Expression(Token current, Token lookAhead, TextFile body) { | ||
|
||
|
||
ArrayList<Term> terms; | ||
ArrayList<String> addops; | ||
|
||
Term first = new Term(current, lookAhead, body); | ||
|
||
while(!(current.getType() == TokenType.CONDITION)) | ||
{ | ||
|
||
Term tempT = new Term(current, lookAhead, body); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package lexer; | ||
|
||
public class MainProgram { | ||
|
||
public MainProgram(Token current, Token lookAhead, TextFile body) { | ||
// TODO Auto-generated constructor stub | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package lexer; | ||
|
||
import java.util.TreeSet; | ||
|
||
public class Routine { | ||
|
||
MainProgram main; | ||
TreeSet<RoutineProgram> subroutines = new TreeSet<RoutineProgram>(); | ||
|
||
Routine(TextFile body) | ||
{ | ||
Token current = body.getNonWSToken(); | ||
Token lookAhead = body.getNonWSToken(); | ||
|
||
if(current != null && lookAhead != null) | ||
{ | ||
if(current.getText().equals("MAIN")) | ||
{ | ||
main = new MainProgram(current, lookAhead, body); | ||
} | ||
else if(current.getText().equals("ROUTINE")) | ||
{ | ||
RoutineProgram temp = new RoutineProgram(current, lookAhead, body); | ||
subroutines.add(temp); | ||
} | ||
else | ||
{ | ||
System.out.println("ERROR: MAIN or SUBROUTINE keyword expected while parsing line "+ body.getLine()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package lexer; | ||
|
||
public class RoutineProgram { | ||
|
||
public RoutineProgram(Token current, Token lookAhead, TextFile body) { | ||
// TODO Auto-generated constructor stub | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package lexer; | ||
|
||
public class Term { | ||
|
||
public Term(Token current, Token lookAhead, TextFile body) | ||
{ | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
IF IFELSE ELSE VAR MAIN RETURN SUBROUTINE WHILE #Keywords | ||
+-/*% #operators | ||
{}()=;, #symbols | ||
0 1 2 3 4 5 6 7 8 9 10 34943 39924 -324933 00-2394 #digits | ||
!= == <= >= < > #conditions | ||
#white space | ||
isEnemyInRange isHealth directionOfClosestEnemy #game functions | ||
move turn skip selfDestruct attackWithWeapon useItem #game orders | ||
AHORSE A_3402aFdko230__ A_ A A439423 AGJFID IFF IFeLse IF4 WHILE9 While WHILE_#identifiers | ||
_fdishfs 3asdjkj 3943ajsdjajds \ [ ] ~ ` . ? ! #errors |