# Well-parenthesized language parser This project is a JavaCC parser configuration which generates a parser for a language with well-balanced parentheses. The features that this language has is: - Each string accepted by the language consists of multiple lines (but at least 1 line). - Lines must not be empty. - Lines must contain well-balanced parentheses, e.g. `()`, `()()()`, `(()())`, `(((())))`. - Only parentheses are allowed, so any other character makes the input invalid. - (As an exception to the first rule) there must be a blank final line at the end of the input. E.g. the following is a good input to the parser: ``` ()(()) (())(((()()))) ((((((((((())))))))))) (())()()()()() ((()()())()()(()(())))() ``` ## How to run To build the Java code and run: `./run.sh`. This is an alias for: ```bash javacc assignment.jj && javac *.java && java Assignment < test.txt > output.txt 2> err.txt ``` ### Output The standard output stream will contain the parser's decision as to whether the string is valid — the output will either be `PASS` or `FAIL`. If it is `FAIL`, the standard error will also contain the line number of the first error that caused the invalidity.