public static void main(String[] args) {
        Generator generator = new Generator();
        boolean showTree = false;
        if (args.length > 0 && args[0].equalsIgnoreCase("-t")) {
            showTree = true;
        }
        try {
            String input = generator.in.readLine();
            while (input != null) {
                try {
                    generator.parser.parse(input);
                    List<Sentence> sentences = generator.parser
                            .generateSentences();
                    for (Sentence sentence : sentences) {
                        System.out.println(sentence);
                    }

                    if (showTree) {
                        System.out.println(generator.parser);
                    }
                } catch (CouldNotParseException e) {
                    System.err.println(e.getMessage());
                }
                input = generator.in.readLine();
            }
        }

        catch (IOException e2) {
            System.err.println("Error: Could not read from STDIN.");
        }

        finally {
            generator.closeStream();
        }
    }