class Compiler {

    public Definition compile(SyntaxTree.Definition definition) {
        final String prefix = definition.prefix.orElse("");
        final Map<String, HWModule> modules = compileModules(definition.moduleDefinitions, prefix);
        final Pair<List<Dependency>, List<NoStrictDependency>> rules = compileRules(definition.rules, modules);
        final Optional<AnonymousModule> whitelist = compileRegexesOrFail(definition.whiteList,
                "Some of the whitelist regular expressions are malformed");
        final Optional<AnonymousModule> blacklist = compileRegexesOrFail(definition.blackList,
                "Some of the blacklist regular expressions are malformed");
        final AnalysisMode mode = compileAnalysisMode(definition.mode);

        return new Definition(whitelist, blacklist, mode, modules.values(), rules.first, rules.second);
    }

}