Compare commits
2 Commits
a07a80883c
...
4bede63054
Author | SHA1 | Date | |
---|---|---|---|
|
4bede63054 | ||
|
43254adcf2 |
@ -1,7 +1,5 @@
|
|||||||
package edu.jt_kb.cs4308.compiler;
|
package edu.jt_kb.cs4308.compiler;
|
||||||
|
|
||||||
import edu.jt_kb.cs4308.compiler.models.Token;
|
|
||||||
|
|
||||||
public class Driver {
|
public class Driver {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("Default Setup");
|
System.out.println("Default Setup");
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package edu.jt_kb.cs4308.compiler.models;
|
package edu.jt_kb.cs4308.compiler.models;
|
||||||
|
|
||||||
public enum Token {
|
public enum TokenType {
|
||||||
IDENT(0),ASS_OP(1),SUB_OP(2),DIV_OP(3),INT_LITERAL(4),SEMICOLON(5);
|
INT_LIT(10),IDENT(11),ASSIGN_OP(20),ADD_OP(21),SUB_OP(22),MULT_OP(23),
|
||||||
|
DIV_OP(24),LEFT_PAREN(26),RIGHT_PAREN(27),SEMI_COLON(28);
|
||||||
|
|
||||||
|
|
||||||
public final int value; /* represents which Token you are referencing. */
|
public final int value; /* represents which Token you are referencing. */
|
||||||
|
|
||||||
@ -13,7 +15,7 @@ public enum Token {
|
|||||||
*
|
*
|
||||||
* @param value - the integer value for the token.
|
* @param value - the integer value for the token.
|
||||||
*/
|
*/
|
||||||
Token(int value) {
|
TokenType(int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +26,7 @@ public enum Token {
|
|||||||
* @return if the values are the same, true
|
* @return if the values are the same, true
|
||||||
* else, false
|
* else, false
|
||||||
*/
|
*/
|
||||||
public boolean equals(Token other) {
|
public boolean equals(TokenType other) {
|
||||||
return this.value == other.value;
|
return this.value == other.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user