Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20230821 dataflow analysis #424

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
dfd3255
comments from well-typed
mengwong Aug 14, 2023
3ca1f7b
move the rule decision graph into XPileLog
mengwong Aug 14, 2023
87c930f
add debugging
mengwong Aug 14, 2023
41e3839
start to expand analysis of rule decision graph to other RP types
mengwong Aug 14, 2023
3e23926
start work on a data flow graph which will help us transpile to opera…
mengwong Aug 14, 2023
eddabed
move ruleGraph construction earlier into the Interpreter
mengwong Aug 15, 2023
8d55bbb
minor cleanups. broke tests due to extension of L4I Interpreted type
mengwong Aug 15, 2023
3c84373
move DataFlow module to LS, not LS.XPile
mengwong Aug 15, 2023
a98e205
output the decision rule graph to workdir
mengwong Aug 15, 2023
a8fa62a
preparing to construct the rule decision graph in two passes
mengwong Aug 15, 2023
89f23e7
bugfix in rp2bodytexts; this breaks 1 additional test
mengwong Aug 15, 2023
92a8068
filter for the leaf nodes and factor out the noisy logging mutters
mengwong Aug 15, 2023
fc4830c
attach leaf nodes into the expanded rule graph as reflexive nodes lol
mengwong Aug 15, 2023
1240740
bug remaining in ruleGraph, the stub rules are still not coming out o…
mengwong Aug 15, 2023
fed88aa
at first glance i think the data flow is being set up correctly, next…
mengwong Aug 15, 2023
5b2053a
fixed `dereflexed`, now happy with how the dotfiles are looking
mengwong Aug 15, 2023
2937f8b
minor documentation fix
mengwong Aug 16, 2023
aa5956c
new words and constructions
inariksit Aug 3, 2023
6d82902
update generated files
inariksit Aug 3, 2023
8c02b46
handle more RPConstraints
inariksit Aug 3, 2023
2c781a8
new structures so whole 10.3 parses
inariksit Aug 3, 2023
dca6185
parses Meng's encoding of §10
inariksit Aug 4, 2023
51c1246
new words + make more cats lexical in generated hs
inariksit Aug 7, 2023
56772c7
fix non-exhaustive pattern in rpRelToBComparOp
inariksit Aug 7, 2023
272d50e
init one example
ym-han Aug 10, 2023
44c92c0
simple-parentchild: unindent and add simple prefix
ym-han Aug 10, 2023
3f5deb6
rejig structure of LE testcases
ym-han Aug 10, 2023
9c42f72
parentchild.le: fix trailing space
ym-han Aug 10, 2023
4dfb671
indentation_databreach: add prelim draft of LE version
ym-han Aug 10, 2023
32cb240
indentation-databreach: forgot it should be kebab case
ym-han Aug 10, 2023
7043cb7
indentation-databreach: add putative Natural L4 input
ym-han Aug 10, 2023
9ba46c2
rejig test dir structure again -- just use the `nonlib*` pattern to d…
ym-han Aug 10, 2023
3d93bad
Started compiler to sCasp
Martin-Strecker Aug 9, 2023
bbb922d
Generation of a separate scasp directory during transpilation. Some d…
Martin-Strecker Aug 9, 2023
8a2c56c
removed an unmotivated import (introduced by vscode?)
Martin-Strecker Aug 11, 2023
00a9778
add test case for product
johsi-k Aug 13, 2023
d281258
add test case for rpnary AND
johsi-k Aug 13, 2023
eb42b05
feat: simple utils / convenience functions to facilitate development …
ym-han Aug 13, 2023
4dea73e
utils for deving at repl: include comment to credit source
ym-han Aug 13, 2023
42f6b6a
fix package.yaml
ym-han Aug 13, 2023
7cd196e
add one more convenience function for pretty printing the rules
ym-han Aug 13, 2023
1184ac6
modify not test case to include GIVEN
johsi-k Aug 13, 2023
669c6b7
modify rpnary-and to include GIVEN
johsi-k Aug 13, 2023
4d81aff
add simple sum le example; will add corresponding L4 when have more time
ym-han Aug 13, 2023
bb36a4a
lol, forgot to add the actual dataflow module
mengwong Aug 16, 2023
fdc12e4
Generation of a separate scasp directory during transpilation. Some d…
Martin-Strecker Aug 9, 2023
b33f7a6
clarify MIN MAX for RPnary vs < > RPlt RPgt
mengwong Aug 17, 2023
65890a6
finish clarifying MIN MAX vs < >
mengwong Aug 21, 2023
a16ddb0
strip leading and trailing whitespace from tokens
mengwong Aug 21, 2023
d0a1479
Merge branch 'main' into 20230821-dataflow-analysis
mengwong Aug 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/haskell/natural4/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import LS.Interpreter
l4interpret,
onlyTheItems,
)
import LS.DataFlow
import LS.NLP.NLG
( allLangs,
expandRulesForNLG,
Expand Down Expand Up @@ -95,7 +96,7 @@ main = do
workuuid = SFL4.workdir opts <> "/" <> SFL4.uuiddir opts

-- Bits that have to do with natural language processing and generation
nlgLangs <- unsafeInterleaveIO allLangs
nlgLangs <- unsafeInterleaveIO allLangs -- [TODO] Edsko is not a fan and has a whole talk about why we should not use this.
strLangs <- unsafeInterleaveIO $ printLangs allLangs
(engE,engErr) <- xpLog <$> langEng
-- [NOTE] the Production Haskell book gives better ways to integrate Logging with IO
Expand Down Expand Up @@ -194,6 +195,7 @@ main = do
(totsFN, (asTSpretty, asTSerr)) = (workuuid <> "/" <> "ts", xpLog $ asTypescript l4i)
(togroundsFN, asGrounds) = (workuuid <> "/" <> "grounds", show $ groundrules rc rules)
(toOrgFN, asOrg) = (workuuid <> "/" <> "org", toOrg l4i rules)
(toDFGFN, (asDFG, asDFGerr)) = (workuuid <> "/" <> "dataflow", xpLog $ dataFlowAsDot l4i)
(toNL_FN, asNatLang) = (workuuid <> "/" <> "natlang", toNatLang l4i)
(toMaudeFN, asMaude) = (workuuid <> "/" <> "maude", Maude.rules2maudeStr rules)
(tonativeFN, asNative) = (workuuid <> "/" <> "native", unlines
Expand Down Expand Up @@ -233,6 +235,7 @@ main = do
-- however, we can flag specific exclusions by adding the --tomd option which, counterintuitively, disables tomd
when (toworkdir && not (null $ SFL4.uuiddir opts) && (null $ SFL4.only opts)) $ do

when (SFL4.tonative opts) $ mywritefile2 True toDFGFN iso8601 "dot" asDFG asDFGerr
when (SFL4.tonative opts) $ mywritefile True toOrgFN iso8601 "org" asOrg
when (SFL4.tonative opts) $ mywritefile True tonativeFN iso8601 "hs" asNative
when ( SFL4.tocorel4 opts) $ mywritefile2 True tocorel4FN iso8601 "l4" (commentIfError "--" asCoreL4) asCoreL4Err
Expand Down Expand Up @@ -340,6 +343,8 @@ main = do
when (SFL4.toProlog rc) $ pPrint asProlog
when (SFL4.toSCasp rc) $ pPrint asSCasp

when (SFL4.toTS rc) $ print $ asTypescript rules

when (SFL4.only opts == "" && SFL4.workdir opts == "") $ pPrint rules
when (SFL4.only opts == "native") $ pPrint rules
when (SFL4.only opts == "classes") $ pPrint (SFL4.classtable l4i)
Expand Down
136 changes: 66 additions & 70 deletions lib/haskell/natural4/doc/Interpreter.dot
Original file line number Diff line number Diff line change
@@ -1,89 +1,87 @@
strict digraph deps {
node [colorscheme=set312, style=filled];

subgraph cluster_2 {
label = "src/LS/Interpreter.hs";
"unleaf" [label= "unleaf", color=2];
"topsortedClasses" [label= "topsortedClasses", color=2];
"symbolTable" [label= "symbolTable", color=2];
"stitchRules" [label= "stitchRules", color=2];
"ruleNameStr" [label= "ruleNameStr", color=2];
"ruleDecisionGraph" [label= "ruleDecisionGraph", color=2];
"relPredRefsAll" [label= "relPredRefsAll", color=2];
"relPredRefs" [label= "relPredRefs", color=2];
"onlyTheItems" [label= "onlyTheItems", color=2];
"onlyItemNamed" [label= "onlyItemNamed", color=2];
"musings" [label= "musings", color=2];
"l4interpret" [label= "l4interpret", color=2];
"itemsByRule" [label= "itemsByRule", color=2];
"isRuleAlias" [label= "isRuleAlias", color=2];
"groupedByAOTree" [label= "groupedByAOTree", color=2];
"getRuleByName" [label= "getRuleByName", color=2];
"getRuleByLabelName" [label= "getRuleByLabelName", color=2];
"getRuleByLabel" [label= "getRuleByLabel", color=2];
"getInheritances" [label= "getInheritances", color=2];
"getCTkeys" [label= "getCTkeys", color=2];
"getAttrTypesIn" [label= "getAttrTypesIn", color=2];
"getAndOrTree" [label= "getAndOrTree", color=2];
"extractRPMT2Text" [label= "extractRPMT2Text", color=2];
"exposedRoots" [label= "exposedRoots", color=2];
"expandTraceDebugging" [label= "expandTraceDebugging", color=2];
"expandTrace" [label= "expandTrace", color=2];
"expandRulesByLabel" [label= "expandRulesByLabel", color=2];
"expandRule" [label= "expandRule", color=2];
"expandRP" [label= "expandRP", color=2];
"expandMT" [label= "expandMT", color=2];
"expandClauses\'" [label= "expandClauses\'", color=2];
"expandClauses" [label= "expandClauses", color=2];
"expandClause" [label= "expandClause", color=2];
"expandBody" [label= "expandBody", color=2];
"expandBSR\'" [label= "expandBSR\'", color=2];
"expandBSR" [label= "expandBSR", color=2];
"decisionRoots" [label= "decisionRoots", color=2];
"classHierarchy" [label= "classHierarchy", color=2];
"classGraph" [label= "classGraph", color=2];
"bsr2bsmt" [label= "bsr2bsmt", color=2];
"bsmtOfClauses" [label= "bsmtOfClauses", color=2];
"biggestItem" [label= "biggestItem", color=2];
"attrType" [label= "attrType", color=2];
"allCTkeys" [label= "allCTkeys", color=2];
}

subgraph cluster_1 {
label = "src/LS/XPile/SVG.hs";
"asAAsvg" [label= "asAAsvg", color=1];
label = "src/LS/Interpreter.hs";
"unleaf" [label= "unleaf", color=1];
"topsortedClasses" [label= "topsortedClasses", color=1];
"symbolTable" [label= "symbolTable", color=1];
"ruleNameStr" [label= "ruleNameStr", color=1];
"ruleLocalsOut" [label= "ruleLocalsOut", color=1];
"ruleLocalsIn" [label= "ruleLocalsIn", color=1];
"ruleLocals" [label= "ruleLocals", color=1];
"ruleDecisionGraph" [label= "ruleDecisionGraph", color=1];
"relPredRefsAll" [label= "relPredRefsAll", color=1];
"relPredRefs" [label= "relPredRefs", color=1];
"qaHornsT" [label= "qaHornsT", color=1];
"qaHornsR" [label= "qaHornsR", color=1];
"onlyTheItems" [label= "onlyTheItems", color=1];
"onlyItemNamed" [label= "onlyItemNamed", color=1];
"l4interpret" [label= "l4interpret", color=1];
"itemsByRule" [label= "itemsByRule", color=1];
"isRuleAlias" [label= "isRuleAlias", color=1];
"groupedByAOTree" [label= "groupedByAOTree", color=1];
"globalFacts" [label= "globalFacts", color=1];
"getRuleByName" [label= "getRuleByName", color=1];
"getRuleByLabelName" [label= "getRuleByLabelName", color=1];
"getRuleByLabel" [label= "getRuleByLabel", color=1];
"getMarkings" [label= "getMarkings", color=1];
"getInheritances" [label= "getInheritances", color=1];
"getCTkeys" [label= "getCTkeys", color=1];
"getAttrTypesIn" [label= "getAttrTypesIn", color=1];
"getAndOrTree" [label= "getAndOrTree", color=1];
"extractRPMT2Text" [label= "extractRPMT2Text", color=1];
"extractEnums" [label= "extractEnums", color=1];
"exposedRoots" [label= "exposedRoots", color=1];
"expandTraceDebugging" [label= "expandTraceDebugging", color=1];
"expandTrace" [label= "expandTrace", color=1];
"expandRulesByLabel" [label= "expandRulesByLabel", color=1];
"expandRule" [label= "expandRule", color=1];
"expandRP" [label= "expandRP", color=1];
"expandMT" [label= "expandMT", color=1];
"expandClauses\'" [label= "expandClauses\'", color=1];
"expandClauses" [label= "expandClauses", color=1];
"expandClause" [label= "expandClause", color=1];
"expandBody" [label= "expandBody", color=1];
"expandBSR\'" [label= "expandBSR\'", color=1];
"expandBSRM" [label= "expandBSRM", color=1];
"expandBSR" [label= "expandBSR", color=1];
"entryPoints" [label= "entryPoints", color=1];
"defaultToSuperType" [label= "defaultToSuperType", color=1];
"defaultToSuperClass" [label= "defaultToSuperClass", color=1];
"decisionRoots" [label= "decisionRoots", color=1];
"classHierarchy" [label= "classHierarchy", color=1];
"classGraph" [label= "classGraph", color=1];
"bsr2bsmt" [label= "bsr2bsmt", color=1];
"bsmtOfClauses" [label= "bsmtOfClauses", color=1];
"attrsAsMethods" [label= "attrsAsMethods", color=1];
"attrType" [label= "attrType", color=1];
"allCTkeys" [label= "allCTkeys", color=1];
}

"allCTkeys" -> "allCTkeys";
"allCTkeys" -> "getCTkeys";
"asAAsvg" -> "expandBSR";
"asAAsvg" -> "exposedRoots";
"asAAsvg" -> "groupedByAOTree";
"asAAsvg" -> "isRuleAlias";
"biggestItem" -> "itemsByRule";
"bsmtOfClauses" -> "bsr2bsmt";
"bsmtOfClauses" -> "expandClauses";
"bsmtOfClauses" -> "expandTrace";
"bsr2bsmt" -> "bsr2bsmt";
"classGraph" -> "classGraph";
"classHierarchy" -> "classHierarchy";
"classHierarchy" -> "defaultToSuperType";
"defaultToSuperType" -> "defaultToSuperClass";
"expandBSR" -> "expandBSR\'";
"expandBSR" -> "expandTrace";
"expandBSRM" -> "expandBSR";
"expandBSR\'" -> "expandBSR\'";
"expandBSR\'" -> "expandRP";
"expandBSR\'" -> "expandTrace";
"expandClause" -> "expandBSR\'";
"expandClause" -> "expandTrace";
"expandClauses" -> "expandClauses\'";
"expandClauses" -> "expandTrace";
"expandClauses\'" -> "expandRP";
"expandClauses\'" -> "expandTrace";
"expandClauses\'" -> "unleaf";
"expandMT" -> "expandClause";
"expandMT" -> "expandTrace";
"expandRP" -> "expandBSR\'";
"expandRP" -> "expandMT";
"expandRP" -> "expandTrace";
"expandRule" -> "expandRulesByLabel";
"expandRulesByLabel" -> "expandRule";
"expandTrace" -> "expandTraceDebugging";
Expand All @@ -98,25 +96,23 @@ strict digraph deps {
"getAndOrTree" -> "getRuleByName";
"getAttrTypesIn" -> "getAttrTypesIn";
"getAttrTypesIn" -> "getCTkeys";
"getInheritances" -> "defaultToSuperClass";
"getInheritances" -> "getCTkeys";
"groupedByAOTree" -> "decisionRoots";
"groupedByAOTree" -> "getAndOrTree";
"groupedByAOTree" -> "ruleDecisionGraph";
"itemsByRule" -> "getAndOrTree";
"l4interpret" -> "attrsAsMethods";
"l4interpret" -> "classHierarchy";
"l4interpret" -> "symbolTable";
"musings" -> "classGraph";
"musings" -> "expandBSR";
"musings" -> "expandRule";
"musings" -> "exposedRoots";
"musings" -> "getAndOrTree";
"musings" -> "groupedByAOTree";
"musings" -> "isRuleAlias";
"musings" -> "ruleDecisionGraph";
"onlyItemNamed" -> "itemsByRule";
"onlyTheItems" -> "getAndOrTree";
"qaHornsR" -> "expandBSR";
"qaHornsR" -> "exposedRoots";
"qaHornsR" -> "groupedByAOTree";
"qaHornsT" -> "qaHornsR";
"relPredRefsAll" -> "relPredRefs";
"ruleDecisionGraph" -> "relPredRefsAll";
"ruleLocals" -> "ruleLocalsIn";
"ruleLocals" -> "ruleLocalsOut";
"topsortedClasses" -> "getAttrTypesIn";
"topsortedClasses" -> "getCTkeys";
"topsortedClasses" -> "getInheritances";
Expand Down
Loading
Loading