Skip to content

Commit bfa6c60

Browse files
Eric Prud'hommeauxclaude
andcommitted
+ Algae 3: parser, dual-mode evaluator, debugger REPL, differential tests
Port of ../algae3 (the Algae2 revival) into the SWObjects family: - lib/Algae3Parser.ypp + Algae3Scanner.lpp + Algae3Parser.bnf: house-style bison-C++/flex (yacker rule names), conflict-free; builds the a3:: AST (lib/Algae3.hpp) over SWObjects terms/triples/expressions instead of the reference parser's S-expression strings. bin/algae3 evaluates, dumps the mode-named action algebra (--algebra), and hosts the debugger (--debug). - lib/Algae3.cpp: the action pipeline (load with the merge/standardize-apart contract of sparql-to-algae3.md section 1, ask, test, assert, fwrule-to- fixpoint, let, bindings, collect with by-grouping / count(distinct) / group_concat(x, sep) / order/limit/offset, standalone {expr} as HAVING), per-row proof sets (munion pools them), and both evaluation modes: top-down correlated ./~/!/scope-lateral vs bottom-up Join/LeftJoin/Minus with unit-result-set isolation of connective operands and scopes. Flagged interpretations (file header): set-level orelse; |! as strict antijoin vs !'s SPARQL-Minus domain-disjoint vacuity. - Debugger: step/where/print/bindings/watch/try/mode/break/run/reset; `try ( pattern )` speculatively counts extended/dropped rows under the current mode and discards; `mode bottomup` mid-session replays the remaining pipeline under SPARQL algebra. - tests/Algae3: datasets for every manifesty.yaml entry, vendored .a3 with local loads, golden results, and differential mode tests: everything agrees across modes except the two documented divergences - nested-optional ({v=1,w=9,u=7} vs {v=1,w=9}) and negation-scoped, where the isolated union branch's naive MINUS cannot discriminate group members without a bound ?component and removes both neg conjuncts. The whole DNF rule-engine example (three nested aggregation layers, universal quantification by counting) evaluates correctly top-down. All 22 ctest suites pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 29f1b38 commit bfa6c60

42 files changed

Lines changed: 3930 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CMakeLists.txt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ set(PARSER_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/parsers)
140140
file(MAKE_DIRECTORY ${PARSER_GEN_DIR})
141141

142142
set(SWOBJ_PARSER_STEMS
143-
SPARQL SPARQLalgebra Turtle Trig MapSet SQL JSONresults ShExC)
143+
SPARQL SPARQLalgebra Turtle Trig MapSet SQL JSONresults ShExC Algae3)
144144

145145
set(SWOBJ_GENERATED_SOURCES "")
146146
foreach(stem IN LISTS SWOBJ_PARSER_STEMS)
@@ -167,6 +167,7 @@ add_library(SWObjects STATIC
167167
lib/ShExShapeMap.cpp
168168
lib/ShExManifest.cpp
169169
lib/ShExMap.cpp
170+
lib/Algae3.cpp
170171
lib/SWObjects.cpp
171172
${SWOBJ_GENERATED_SOURCES}
172173
)
@@ -230,7 +231,7 @@ target_precompile_headers(SWObjects PRIVATE lib/SWObjects.hpp)
230231

231232
# The tools land in the source-tree bin/ directory (gitignored), as with the
232233
# old Makefile; the tests shell out to ../bin/sparql .
233-
foreach(tool sparql parseAndFree)
234+
foreach(tool sparql parseAndFree algae3)
234235
add_executable(${tool} bin/${tool}.cpp)
235236
target_link_libraries(${tool} PRIVATE SWObjects
236237
Boost::program_options Boost::filesystem)

‎bin/algae3‎

19.7 MB
Binary file not shown.

0 commit comments

Comments
 (0)