The query syntax: a lexer, a Julia-flavoured parser, and printers for the
juliaanddatalogprofiles. Source:syntax.rs.Sources: SPEC-007 Sophia Query Language §5; SPEC-005 Rendering Profiles (the round-trip guarantee). code:
syntax.rs
parsereturns the IR in written order andNames. A file isquery NAME(p::Sort, …) … end, with ruleshead(args) = lit && litand oneselect outs where body. A bareselect … where …is an anonymous query.- Literals:
pred(args),!pred(args),a == b,a != b,startswith(a, b). Terms: variables,_(a fresh variable each time), parameters,"text",:Symbol(text), integers,0x+ 64 hex digits (an id). - Bounds (SR-50): 64 KiB of text, 256 rules, 64 literals per body, 16 arguments.
printinProfile::Juliaparses back to the same IR (tested).Profile::Datalogis for display, including the magic-set program inexplain.