ProjectCD is a project mainly written in Java, it's free.
Lab 4 Revision 2 Was worked on by both John and I. The file titled AST.java contains lab 4.
Lab 5 Worked on by John and I Language Grammar:
Valid Code: CONNECT 255.255.255.255:80 READ ALL DATA USE DATABASE testdb@localhost PUT INTO testdb READ ALL DATA FROM testdb.table PRESENT WITH FORMAT x
Invalid Code: Any other commands not listed above
Generated Code using GOLD Parser:
public interface SymbolConstants
{
final int SYMBOL_EOF = 0; // (EOF)
final int SYMBOL_ERROR = 1; // (Error)
final int SYMBOL_WHITESPACE = 2; // (Whitespace)
final int SYMBOL_LINE = 3; // Line
final int SYMBOL_NEW = 4; // New
final int SYMBOL_STRING = 5; // String
final int SYMBOL_ARG = 6; //
public interface RuleConstants
{
final int RULE_PROGRAM = 0; //
We were unable to get it working.
Lab 6 Semantics errors: Our program will catch if a person puts in more than one command and one argument.
public class SemanticAnalysisVisitor extends Visitor { public void visitCommandError (CommandError n) { System.out.println("ERROR: You cannot have more than one command per line."); } public void visitArguError (ArguError n) { System.out.println("ERROR: You cannot have more than one argument per line."); } public void visitDoubleError (DoubleError n) { System.out.println("ERROR: You cannot have more than one command and more than one argument per line."); } }
Test case: Connect 255.255.255.255:80 vs Connect 255.255.255.255 Port 80