![]() |
| ||
| Syntax Analyser and General Java Help Hello, I am currently working on some coursework from which i have to write a syntax analyser to parse a grammer. Unfortunatly I am finding it hard to understand what I am meant to be doing - and if i am doing it right. I have looked through many tutorials but they don't fill me with confidence that what i have to do is right. So hopefully you guys will be able to put me in the right direction so i can do some cool coding. :) The main problem is: Write a Java class SyntaxAnalyser This will have: • a constructor with one String argument, the name of the file from which the tokens are to be read • a single public method parse (there will, of course, also be some private methods). This is a void method with no arguments, which is a recursive descent parser for this grammar applied to the file specified (or rather applied to the tokens returned by the LexicalAnalyser class from the file specified). This is my current attempt - package comp; As you can see i have created a new method for each "non terminal" in the grammar. It may help you see what the grammar is which is here. I am not so sure what to do next. I think i will have to fill these methods with actions depending on the grammar - but like i say i don't understand well. Does the above file look like the correct structure? Anyway thanks for any help you give. Below are some background links - coursework questions (pdf) Other java files. Once again thanks for any help you give in helping me understand what i have to do :) EDIT: i forgot to mention it is a "recrusive descent parser" which means it is a top down parser. The grammar is also in BNF form. Ill will keep you up to date with any changes i make because i will be working on this constantly :) |
| All times are GMT -4. The time now is 11:32 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC