dk.brics.grammar.main
Class Main

java.lang.Object
  extended by dk.brics.grammar.main.Main

public class Main
extends Object

Parser and grammar ambiguity checker.

This tool can be used to

See Also:
MainCommandLine, MainGUI, MainServlet

Method Summary
static void main(String[] args)
          Parser and grammar ambiguity checker.
static int run(String grammar, String grammar_location, String text, String text_location, boolean ambiguity_analysis, int unfold_level, String unfold_left, String unfold_right, boolean verbose, boolean dump_ast, boolean tokenize, boolean extrastats, PrintWriter out)
          Front-end for parser and grammar ambiguity checker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(String[] args)
Parser and grammar ambiguity checker. If no arguments are provided, the GUI is started; otherwise, the program runs in command-line mode. Run with -h to see the command-line usage.

Parameters:
args - arguments
See Also:
run(String, String, String, String, boolean, int, String, String, boolean, boolean, boolean, boolean, PrintWriter)

run

public static int run(String grammar,
                      String grammar_location,
                      String text,
                      String text_location,
                      boolean ambiguity_analysis,
                      int unfold_level,
                      String unfold_left,
                      String unfold_right,
                      boolean verbose,
                      boolean dump_ast,
                      boolean tokenize,
                      boolean extrastats,
                      PrintWriter out)
               throws InstantiationException,
                      IllegalAccessException,
                      ClassNotFoundException,
                      IllegalArgumentException
Front-end for parser and grammar ambiguity checker.

Parameters:
grammar - grammar
grammar_location - location of grammar (typically a directory path or a URL)
text - text to parse (null if none)
text_location - location of text (null if none)
ambiguity_analysis - if true, run ambiguity analysis
unfold_level - unfold number
unfold_left - unfolding left parentheses symbols
unfold_right - unfolding right parentheses symbols
verbose - if true, verbose output
extrastats - if true, print extra statistics
dump_ast - if true, dump AST after parsing
tokenize - if true, tokenize grammar before ambiguity analysis
out - print writer for output
Returns:
status code (0 = everything ok, -1 = illegal input, -2 = parse error in grammar, -3 = parse error in text, -4 = other error in grammar, -5 = potential ambiguity in grammar)
Throws:
ClassNotFoundException - if an approximation strategy class was not found
IllegalAccessException - if an approximation strategy class or its nullary constructor is not accessible
InstantiationException - if an approximation strategy class cannot be instantiated
IllegalArgumentException - if the grammar is not balanced with the given unfolding parentheses


Copyright © 2005-2008 Anders Møller.