def METHOD_NAME(grammar, a4):
    """
    Generate parser for the input g4 file.
    :param grammar: grammar file
    :param a4: antlr4 runtime
    :return: None
    """
    grammar_folder = grammar[0:grammar.rindex("/") + 1]
    java_home = os.environ["JAVA_HOME"]
    java = java_home + "/bin/java"
    if not os.path.exists(java):
        antlr_complains("Cannot find java. Check your JAVA_HOME setting.")
        return
    check_call([java, "-jar", a4,
               "-Dlanguage=Swift", grammar, "-visitor",
               "-o", grammar_folder + "/gen"])