<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_ebnf_parser(files):
 """Create EBNF files and EBNF-based parsers"""


    flag = False
    for belspec_fn in files:
        # Get EBNF Jinja template from Github if enabled
        if config["bel"]["lang"]["specification_github_repo"]:
            tmpl_fn = get_ebnf_template()

        # Check if EBNF file is more recent than belspec_fn
        ebnf_fn = belspec_fn.replace(".yaml", ".ebnf")
        if not os.path.exists(ebnf_fn) or os.path.getmtime(belspec_fn) > os.path.getmtime(ebnf_fn):
            with open(belspec_fn, "r") as f:
                belspec = yaml.load(f, Loader=yaml.SafeLoader)

            tmpl_dir = os.path.dirname(tmpl_fn)
            tmpl_basename = os.path.basename(tmpl_fn)

            bel_major_version = belspec["version"].split(".")[0]

            env = jinja2.Environment(
                loader=jinja2.FileSystemLoader(tmpl_dir)
            )  # create environment for template
            template = env.get_template(tmpl_basename)  # get the template

            # replace template placeholders with appropriate variables
            relations_list = [
                (relation, belspec["relations"]["info"][relation]["abbreviation"])
                for relation in belspec["relations"]["info"]
            ]
            relations_list = sorted(list(itertools.chain(*relations_list)), key=len, reverse=True)

            functions_list = [
                (function, belspec["functions"]["info"][function]["abbreviation"])
                for function in belspec["functions"]["info"]
                if belspec["functions"]["info"][function]["type"] == "primary"
            ]
            functions_list = sorted(list(itertools.chain(*functions_list)), key=len, reverse=True)

            modifiers_list = [
                (function, belspec["functions"]["info"][function]["abbreviation"])
                for function in belspec["functions"]["info"]
                if belspec["functions"]["info"][function]["type"] == "modifier"
            ]
            modifiers_list = sorted(list(itertools.chain(*modifiers_list)), key=len, reverse=True)

            created_time = datetime.datetime.now().strftime("%B %d, %Y - %I:%M:%S%p")

            ebnf = template.render(
                functions=functions_list,
                m_functions=modifiers_list,
                relations=relations_list,
                bel_version=belspec["version"],
                bel_major_version=bel_major_version,
                created_time=created_time,
            )

            with open(ebnf_fn, "w") as f:
                f.write(ebnf)

            parser_fn = ebnf_fn.replace(".ebnf", "_parser.py")

            parser = tatsu.to_python_sourcecode(ebnf, filename=parser_fn)
            flag = True
            with open(parser_fn, "wt") as f:
                f.write(parser)

    if flag:
        # In case we created new parser modules
        importlib.invalidate_caches()