     exit(xr)
 } catch {}
 
-let sr = try parseSPARQL(qfile, printTokens: printTokens, pretty: pretty, silent: silent)
+let sr = try parseSPARQL(qfile, printTokens: printTokens, pretty: pretty, simplify: simplify, silent: silent)
 exit(sr)

        printTokens = true
    } else if next == "-p" {
        pretty = true
    }
}


}

@discardableResult
func parseQuery(_ qfile: String, simplify: Bool, silent: Bool = false, includeComments: Bool = false) throws -> Query {
    let url = URL(fileURLWithPath: qfile)
    let sparql = try Data(contentsOf: url)
    guard var p = SPARQLParser(data: sparql, includeComments: includeComments) else { fatalError("Failed to construct SPARQL parser") }
    var query = try p.parseQuery()
    if simplify {
        let r = SPARQLQueryRewriter()
        query = try r.simplify(query: query)
    }
    let s = query.serialize()
    if !silent {
        print(s)
