I begin to write an interesting program, which returns funny statements, but I cannot continue, because I do not know how to implement the syntax rules in my code:
These are the rules:
<sentence> ::= <simple_sentence> [ <conjunction> <sentence> ]
It's a bit overwhelming to start thinking of this from the full grammar point of view. First try to implement the logic for this much simpler grammar:
When you are done, you'll have a working program with a main method and four grammar methods. (randomSentence, randomSimpleSentence, randomNounPhrase and randomVerbPhrase.) I know it may seem silly to separate these simple methods, but it will get the structure of your program all set up. You will be able to get random words from the relevant two lists.
Once you get this working, you can start adding pieces of the grammar one at a time. Testing your program after each new addition to make sure it still works. The most interesting ones will probably be implementing "or" and "optional" so do ask if you have questions about those parts specifically. Or anything else about this for that matter. Just post what point in the grammar you are up to and what code you have so far.
Note: It is Java convention to user all uppercase for constants (static final variables.)