summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-05-08PicoRec: add test for garbage, remove unused codeHEADmasterPeter Wu1-6/+7
2016-05-08PicoRec: add a bunch more tests, fix bugsPeter Wu1-3/+41
2016-05-08PicoRec: fully implementedPeter Wu1-14/+67
Removed the LAYOUT matching from tokenRegex, these are not part of the token and should be removed before. Add an auxilliary function that tests whether a token that matches ID really is a non-keyword. Implement remaining expressions.
2016-05-08PicoRec: begin implementing parsingPeter Wu1-10/+37
Remove keywordRegex, it is not used now. To do: make sure that ID not match keywords, implement parseExp.
2016-05-08PicoRec: propagate errorsPeter Wu1-14/+13
2016-05-08PicoRec: add basic parser plumbing for our languagePeter Wu1-5/+96
Add a next() function that returns the next scanned token and match() to consume the token from input. next() takes an automaton such that you can match "begin" in the beginning, but any other string (including "begin" prefixes) for ID.
2016-05-08Add skeleton for PicoRecPeter Wu2-1/+76
NAT and ID regexes were taken from RegexTest.java. Tests are added before the implementation (test-driven development).
2016-05-08grammar-l11: remove left-recursionPeter Wu1-8/+10
In the original change, the EXP in PROD-EXP should have been PROD-EXP, similarly EXP in SINGLE-EXP should have been SINGLE-EXP. Otherwise the operator precedence is not applied correctly (consider 1+2*3, it should be interpreted as 1+(2*3), not (1+2)*3). Anyway, this change removes left-recursion as described in 2.12.1.
2016-05-07Attempt to convert grammar to LL(1)Peter Wu1-11/+8
Needs more verification, but the idea is that the expressions with lowest precedence (+) should be the first one in the parse tree (implying that non-terminals with highest precedence should be just above a terminal). Left-associativity is achieved by the trick in section 2.3.1 of Intro2CD which results in the left operand being recursed instead of the right one.
2016-05-07Initialize LL(1) grammar from current grammarPeter Wu1-0/+41
2016-05-07Oops, accidentally dropped EXP from prioritiesPeter Wu1-2/+2
2016-05-07grammar: remove EBNF constructsPeter Wu1-5/+16
I guess that this satisfies "A description of the grammar resulting from the transformation to remove EBNF constructs". It does not mention something about the left-associativity and priority rules, that is probably the next step.
2016-05-07Add original grammer for part 4Peter Wu1-0/+30
This grammar looks like SDF[0]. Explanation of some constructs: - "start-symbol" refers to the start symbol (a non-terminal). - Lines below "context-free syntax" refers to the non-terminals. - Lines below "lexical syntax" refers to the terminals. - "context-free priorities" provides disambiguation constructs. Note that the "EXP ::= " part really belongs to each individual operand, so it means something like "A > B > C" (where A, B, C are the unary minus, multiplication and plus expressions respectively). I have no idea why Mark van den Brand chose to use multiple "context-free syntax" and "lexical syntax" groups (if that is appropriate terminology), as far as I can see all such blocks can be merged into one group. Maybe he wanted to emphasize the difference between the left-hand side names? [0]: http://releases.strategoxt.org/strategoxt-manual/unstable/manual/chunk-chapter/tutorial-sdf.html
2016-05-04Simplify NAT test, check for 0 tooPeter Wu1-2/+2
2016-04-30Add Java comments checkPeter Wu1-0/+64
2016-04-29Implement Matlab commentsPeter Wu1-0/+58
2016-04-29Add more tests matching slidesPeter Wu1-5/+9
Also remove tests with letters "s" and "Id" in it, these are not interesting to test. Add some more tests to catch capital "E" and reject a lone "e7".
2016-04-29Fix typo in commentPeter Wu1-4/+5
2016-04-29Add our names to the topPeter Wu1-1/+3
2016-04-29added checkFLOAT() and checkString()andrea1-11/+36
Signed-off-by: andrea <andrea.evangelista.1989@gmail.com>
2016-04-29Check for StringPeter Wu1-0/+19
2016-04-29Disallow prefix match for IdPeter Wu1-0/+1
2016-04-29checkNAT() addedandrea1-0/+11
2016-04-29Fix matchPeter Wu1-2/+2
Do not look for longest match, but for the exact match. Documented at http://www.brics.dk/automaton/doc/dk/brics/automaton/RunAutomaton.html#run%28java.lang.String%29
2016-04-29Makefile: create bin folder firstPeter Wu1-3/+6
Also ensure that "classes" is the default target
2016-04-29Make tests "generate sufficient output"Peter Wu1-4/+3
...such that the tests can be reviewed based upon the generated output. (as required for the assignment).
2016-04-29Implement lexical definition for "ID" (Q1)Peter Wu1-0/+26
ID ::= [a-z] [a-z0-9]*
2016-04-29Add Makefile and gitignorePeter Wu2-0/+16
I don't know ant well enough to write a build.xml, so let's just use a Makefile for now.
2016-04-25Initial commitPeter Wu5-0/+83
Unzipped from OASE (2IMP20), excluding the bin/ folder. size: 158596 bytes sha256: 179253d2bfec243bc5294372ce0ad1c5d82a30ef32ad108f6c9fd0aee73fe4df assignment1.zip