Class RandomSentenceGenerator
java.lang.Object
RandomSentenceGenerator
public class RandomSentenceGenerator
- extends Object
A Random Sentence Generator
This class currently parses a grammar file from standard input.
Your job is to extend it to print random sentences from the
grammar.
RandomSentenceGenerator
public RandomSentenceGenerator(Scanner in)
- Create a new grammar from the given file.
toString
public String toString()
- Print out the grammar. Useful for debugging.
- Overrides:
toString
in class Object
main
public static void main(String[] args)