svf-tools 1.0.442 → 1.0.445
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-doxygen/html/html/AbstractPointsToDS_8h_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenHCD_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenHLCD_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenLCD_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenSCD_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenSFR_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenSFR_8h_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenStat_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenWaveDiff_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Andersen_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Andersen_8h_source.html +1 -1
- package/SVF-doxygen/html/html/Annotator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/BDDExpr_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/BDDExpr_8h_source.html +1 -1
- package/SVF-doxygen/html/html/BitVector_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/BitVector_8h_source.html +1 -1
- package/SVF-doxygen/html/html/BreakConstantExpr_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/BreakConstantExpr_8h_source.html +1 -1
- package/SVF-doxygen/html/html/CFGNormalizer_8cpp.html +86 -0
- package/SVF-doxygen/html/html/CFGNormalizer_8cpp_source.html +104 -0
- package/SVF-doxygen/html/html/CFGNormalizer_8h.html +95 -0
- package/SVF-doxygen/html/html/CFGNormalizer_8h_source.html +95 -0
- package/SVF-doxygen/html/html/CFLAlias_8h.html +100 -0
- package/SVF-doxygen/html/html/CFLAlias_8h_source.html +136 -0
- package/SVF-doxygen/html/html/CFLGrammar_8cpp.html +81 -0
- package/SVF-doxygen/html/html/CFLGrammar_8cpp_source.html +90 -0
- package/SVF-doxygen/html/html/CFLGrammar_8h.html +97 -0
- package/SVF-doxygen/html/html/CFLGrammar_8h_source.html +114 -0
- package/SVF-doxygen/html/html/CFLGraph_8cpp.html +96 -0
- package/SVF-doxygen/html/html/CFLGraph_8cpp_source.html +123 -0
- package/SVF-doxygen/html/html/CFLGraph_8h.html +124 -0
- package/SVF-doxygen/html/html/CFLGraph_8h_source.html +114 -0
- package/SVF-doxygen/html/html/CFLSolver_8cpp.html +80 -0
- package/SVF-doxygen/html/html/CFLSolver_8cpp_source.html +107 -0
- package/SVF-doxygen/html/html/CFLSolver_8h.html +6 -5
- package/SVF-doxygen/html/html/CFLSolver_8h_source.html +27 -33
- package/SVF-doxygen/html/html/CHGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/CHGBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/CHG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/CHG_8h_source.html +3 -3
- package/SVF-doxygen/html/html/CPPUtil_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/CPPUtil_8h_source.html +1 -1
- package/SVF-doxygen/html/html/CSC_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/CSC_8h_source.html +1 -1
- package/SVF-doxygen/html/html/CallGraphBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/CallGraphBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/Casting_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ConditionalPT_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ConsGEdge_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ConsGNode_8h_source.html +6 -6
- package/SVF-doxygen/html/html/ConsG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/ConsG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ContextDDA_8h_source.html +2 -2
- package/SVF-doxygen/html/html/CoreBitVector_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/CoreBitVector_8h_source.html +1 -1
- package/SVF-doxygen/html/html/CxtStmt_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DCHG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DCHG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/DDAClient_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DDAClient_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DDAPass_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DDAPass_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DDAStat_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DDAStat_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DDAVFSolver_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DPItem_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DataFlowUtil_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/DataFlowUtil_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DoubleFreeChecker_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DoubleFreeChecker_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ExeState_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ExeState_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ExtAPI_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ExtAPI_8h_source.html +1 -1
- package/SVF-doxygen/html/html/FSMPTA_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/FSMPTA_8h_source.html +1 -1
- package/SVF-doxygen/html/html/FileChecker_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/FileChecker_8h_source.html +1 -1
- package/SVF-doxygen/html/html/FlowDDA_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/FlowDDA_8h_source.html +1 -1
- package/SVF-doxygen/html/html/FlowSensitiveStat_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/FlowSensitiveTBHC_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/FlowSensitiveTBHC_8h_source.html +1 -1
- package/SVF-doxygen/html/html/FlowSensitive_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/FlowSensitive_8h_source.html +1 -1
- package/SVF-doxygen/html/html/GEPTypeBridgeIterator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/GenericGraph_8h_source.html +2 -2
- package/SVF-doxygen/html/html/GrammarBuilder_8cpp.html +94 -0
- package/SVF-doxygen/html/html/GrammarBuilder_8cpp_source.html +92 -0
- package/SVF-doxygen/html/html/GrammarBuilder_8h.html +96 -0
- package/SVF-doxygen/html/html/GrammarBuilder_8h_source.html +87 -0
- package/SVF-doxygen/html/html/Graph2Json_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Graph2Json_8h_source.html +1 -1
- package/SVF-doxygen/html/html/GraphPrinter_8h_source.html +1 -1
- package/SVF-doxygen/html/html/GraphReachSolver_8h.html +96 -0
- package/SVF-doxygen/html/html/GraphReachSolver_8h_source.html +113 -0
- package/SVF-doxygen/html/html/ICFGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ICFGBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ICFGEdge_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ICFGNode_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ICFGStat_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ICFG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/ICFG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/IRAnnotator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/IRGraph_8h_source.html +3 -3
- package/SVF-doxygen/html/html/LLVMModule_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LLVMModule_8h_source.html +1 -1
- package/SVF-doxygen/html/html/LLVMUtil_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LLVMUtil_8h_source.html +1 -1
- package/SVF-doxygen/html/html/LeakChecker_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/LeakChecker_8h_source.html +2 -2
- package/SVF-doxygen/html/html/LocationSet_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LocationSet_8h_source.html +1 -1
- package/SVF-doxygen/html/html/LockAnalysis_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LockAnalysis_8h_source.html +1 -1
- package/SVF-doxygen/html/html/LockResultValidator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LockResultValidator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MHP_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MHP_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MSSAMuChi_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MTAAnnotator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MTAAnnotator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MTAResultValidator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MTAResultValidator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MTAStat_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MTAStat_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MTA_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MTA_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MemPartition_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MemPartition_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MemRegion_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MemSSA_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MemSSA_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MutablePointsToDS_8h_source.html +1 -1
- package/SVF-doxygen/html/html/NodeIDAllocator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/NodeIDAllocator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/OfflineConsG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/OfflineConsG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/Options_8cpp_source.html +7 -2
- package/SVF-doxygen/html/html/Options_8h_source.html +7 -2
- package/SVF-doxygen/html/html/PAGBuilderFromFile_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PAGBuilderFromFile_8h_source.html +1 -1
- package/SVF-doxygen/html/html/PCG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PCG_8h_source.html +1 -1
- package/SVF-doxygen/html/html/PTACallGraph_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/PTACallGraph_8h_source.html +2 -2
- package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PTAStat_8h_source.html +1 -1
- package/SVF-doxygen/html/html/PathCondAllocator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PathCondAllocator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/PersistentPointsToCache_8h_source.html +1 -1
- package/SVF-doxygen/html/html/PersistentPointsToDS_8h_source.html +1 -1
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8h_source.html +1 -1
- package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +5 -5
- package/SVF-doxygen/html/html/PointsTo_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PointsTo_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ProgSlice_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ProgSlice_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SCC_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFBasicTypes_8h_source.html +2 -2
- package/SVF-doxygen/html/html/SVFGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFGBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFGEdge_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFGNode_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFGOPT_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFGOPT_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFGStat_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFGStat_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/SVFG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFIR_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFModule_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFModule_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFStatements_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFStatements_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFUtil_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFUtil_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFVariables_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFVariables_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SaberAnnotator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SaberAnnotator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SaberCheckerAPI_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SaberCheckerAPI_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SrcSnkDDA_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/SrcSnkDDA_8h.html +3 -3
- package/SVF-doxygen/html/html/SrcSnkDDA_8h_source.html +61 -61
- package/SVF-doxygen/html/html/SrcSnkSolver_8h_source.html +1 -1
- package/SVF-doxygen/html/html/Steensgaard_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Steensgaard_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableInfo_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableInfo_8h_source.html +1 -1
- package/SVF-doxygen/html/html/TCT_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/TCT_8h_source.html +2 -2
- package/SVF-doxygen/html/html/ThreadAPI_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ThreadAPI_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ThreadCallGraph_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ThreadCallGraph_8h_source.html +1 -1
- package/SVF-doxygen/html/html/TypeAnalysis_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/TypeAnalysis_8h_source.html +1 -1
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8h_source.html +1 -1
- package/SVF-doxygen/html/html/Util_2BasicTypes_8h_source.html +1 -1
- package/SVF-doxygen/html/html/VFGEdge_8h_source.html +1 -1
- package/SVF-doxygen/html/html/VFGNode_8h_source.html +1 -1
- package/SVF-doxygen/html/html/VFG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/VFG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/VersionedFlowSensitive_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/VersionedFlowSensitive_8h_source.html +1 -1
- package/SVF-doxygen/html/html/WPAFSSolver_8h_source.html +1 -1
- package/SVF-doxygen/html/html/WPAPass_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/WPAPass_8h_source.html +1 -1
- package/SVF-doxygen/html/html/WPASolver_8h_source.html +1 -1
- package/SVF-doxygen/html/html/WPAStat_8h_source.html +1 -1
- package/SVF-doxygen/html/html/WorkList_8h_source.html +1 -1
- package/SVF-doxygen/html/html/Z3Expr_8h_source.html +1 -1
- package/SVF-doxygen/html/html/annotated.html +302 -288
- package/SVF-doxygen/html/html/cfl_8cpp.html +171 -0
- package/SVF-doxygen/html/html/cfl_8cpp_source.html +95 -0
- package/SVF-doxygen/html/html/classSVF_1_1Andersen-members.html +51 -51
- package/SVF-doxygen/html/html/classSVF_1_1Andersen.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase-members.html +39 -39
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenHCD-members.html +56 -56
- package/SVF-doxygen/html/html/classSVF_1_1AndersenHCD.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenHLCD-members.html +55 -55
- package/SVF-doxygen/html/html/classSVF_1_1AndersenHLCD.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenLCD-members.html +51 -51
- package/SVF-doxygen/html/html/classSVF_1_1AndersenLCD.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSCD-members.html +52 -52
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSCD.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR-members.html +59 -59
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenWaveDiff-members.html +53 -53
- package/SVF-doxygen/html/html/classSVF_1_1AndersenWaveDiff.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl-members.html +33 -33
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1CFGNormalizer-members.html +90 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFGNormalizer.html +458 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLAlias-members.html +216 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.html +801 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLEdge-members.html +96 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLEdge.html +216 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLEdge.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLGrammar-members.html +110 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLGrammar.html +591 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLGrammar.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLGraph-members.html +122 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLGraph.html +756 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLGraph.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLNode-members.html +118 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLNode.html +257 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLNode.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLSolver-members.html +17 -28
- package/SVF-doxygen/html/html/classSVF_1_1CFLSolver.html +181 -548
- package/SVF-doxygen/html/html/classSVF_1_1CondPTAImpl-members.html +36 -36
- package/SVF-doxygen/html/html/classSVF_1_1CondPTAImpl.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode-members.html +26 -26
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode.html +43 -43
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA-members.html +57 -57
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1DoubleFreeChecker-members.html +55 -55
- package/SVF-doxygen/html/html/classSVF_1_1DoubleFreeChecker.html +64 -64
- package/SVF-doxygen/html/html/classSVF_1_1DoubleFreeChecker.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1FSMPTA-members.html +55 -55
- package/SVF-doxygen/html/html/classSVF_1_1FSMPTA.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1FileChecker-members.html +57 -57
- package/SVF-doxygen/html/html/classSVF_1_1FileChecker.html +66 -66
- package/SVF-doxygen/html/html/classSVF_1_1FileChecker.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA-members.html +48 -48
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive-members.html +47 -47
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC-members.html +59 -59
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1GenericEdge.html +8 -24
- package/SVF-doxygen/html/html/classSVF_1_1GenericEdge.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1GenericGraph.html +10 -9
- package/SVF-doxygen/html/html/classSVF_1_1GenericGraph.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1GenericNode.html +21 -20
- package/SVF-doxygen/html/html/classSVF_1_1GenericNode.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1GrammarBase-members.html +93 -0
- package/SVF-doxygen/html/html/classSVF_1_1GrammarBase.html +399 -0
- package/SVF-doxygen/html/html/classSVF_1_1GrammarBase.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1GrammarBuilder-members.html +85 -0
- package/SVF-doxygen/html/html/classSVF_1_1GrammarBuilder.html +226 -0
- package/SVF-doxygen/html/html/classSVF_1_1GraphReachSolver-members.html +106 -0
- package/SVF-doxygen/html/html/classSVF_1_1GraphReachSolver.html +937 -0
- package/SVF-doxygen/html/html/classSVF_1_1GraphReachSolver.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1LeakChecker-members.html +55 -55
- package/SVF-doxygen/html/html/classSVF_1_1LeakChecker.html +81 -81
- package/SVF-doxygen/html/html/classSVF_1_1LeakChecker.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1Options-members.html +80 -75
- package/SVF-doxygen/html/html/classSVF_1_1Options.html +130 -0
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis-members.html +25 -25
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +17 -16
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1SrcSnkDDA-members.html +51 -51
- package/SVF-doxygen/html/html/classSVF_1_1SrcSnkDDA.html +207 -207
- package/SVF-doxygen/html/html/classSVF_1_1SrcSnkDDA.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1SrcSnkSolver.html +0 -12
- package/SVF-doxygen/html/html/classSVF_1_1Steensgaard-members.html +42 -42
- package/SVF-doxygen/html/html/classSVF_1_1Steensgaard.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis-members.html +45 -45
- package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive-members.html +61 -61
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive.html +5 -5
- package/SVF-doxygen/html/html/classes.html +103 -101
- package/SVF-doxygen/html/html/cuddInt_8c.html +6 -6
- package/SVF-doxygen/html/html/cuddInt_8c_source.html +2 -2
- package/SVF-doxygen/html/html/cudd_8h.html +4 -4
- package/SVF-doxygen/html/html/dda_8cpp.html +2 -46
- package/SVF-doxygen/html/html/dda_8cpp_source.html +4 -5
- package/SVF-doxygen/html/html/dir_1870ebf480d659cc38d2dd7ac3aa8993.html +2 -0
- package/SVF-doxygen/html/html/dir_4eeb864c4eec08c7d6b9d3b0352cfdde.html +2 -0
- package/SVF-doxygen/html/html/dir_95e22971b5dbae2382075a3453e365b4.html +2 -0
- package/SVF-doxygen/html/html/dir_97aefd0d527b934f1d99a682da8fe6a9.html +2 -0
- package/SVF-doxygen/html/html/dir_98f9a352f241e0e917d4efaa4086f6e8.html +89 -0
- package/SVF-doxygen/html/html/dir_ae8aa099e368efaa962140c6624142bc.html +91 -0
- package/SVF-doxygen/html/html/dir_d44c64559bbebec7f509842c48db8b23.html +2 -0
- package/SVF-doxygen/html/html/dir_e6cca4e14eddbb730e0cbe3cab632ce5.html +83 -0
- package/SVF-doxygen/html/html/dir_fa02919a30fec2d2c2d591b4d920d648.html +2 -0
- package/SVF-doxygen/html/html/files.html +268 -252
- package/SVF-doxygen/html/html/functions.html +2 -1
- package/SVF-doxygen/html/html/functions_0x7e.html +18 -0
- package/SVF-doxygen/html/html/functions_a.html +16 -14
- package/SVF-doxygen/html/html/functions_b.html +16 -5
- package/SVF-doxygen/html/html/functions_c.html +69 -26
- package/SVF-doxygen/html/html/functions_d.html +3 -1
- package/SVF-doxygen/html/html/functions_e.html +19 -4
- package/SVF-doxygen/html/html/functions_eval.html +0 -6
- package/SVF-doxygen/html/html/functions_eval_c.html +9 -0
- package/SVF-doxygen/html/html/functions_eval_f.html +0 -3
- package/SVF-doxygen/html/html/functions_f.html +28 -21
- package/SVF-doxygen/html/html/functions_func.html +18 -10
- package/SVF-doxygen/html/html/functions_func_0x7e.html +18 -0
- package/SVF-doxygen/html/html/functions_func_b.html +19 -8
- package/SVF-doxygen/html/html/functions_func_c.html +42 -18
- package/SVF-doxygen/html/html/functions_func_d.html +4 -2
- package/SVF-doxygen/html/html/functions_func_e.html +10 -1
- package/SVF-doxygen/html/html/functions_func_f.html +6 -3
- package/SVF-doxygen/html/html/functions_func_g.html +56 -10
- package/SVF-doxygen/html/html/functions_func_h.html +12 -2
- package/SVF-doxygen/html/html/functions_func_i.html +19 -9
- package/SVF-doxygen/html/html/functions_func_n.html +7 -1
- package/SVF-doxygen/html/html/functions_func_p.html +8 -4
- package/SVF-doxygen/html/html/functions_func_s.html +20 -6
- package/SVF-doxygen/html/html/functions_func_v.html +3 -2
- package/SVF-doxygen/html/html/functions_g.html +86 -21
- package/SVF-doxygen/html/html/functions_h.html +15 -5
- package/SVF-doxygen/html/html/functions_i.html +27 -12
- package/SVF-doxygen/html/html/functions_l.html +5 -2
- package/SVF-doxygen/html/html/functions_n.html +22 -7
- package/SVF-doxygen/html/html/functions_o.html +6 -6
- package/SVF-doxygen/html/html/functions_p.html +23 -16
- package/SVF-doxygen/html/html/functions_r.html +11 -6
- package/SVF-doxygen/html/html/functions_s.html +53 -17
- package/SVF-doxygen/html/html/functions_t.html +11 -7
- package/SVF-doxygen/html/html/functions_type_c.html +5 -1
- package/SVF-doxygen/html/html/functions_type_g.html +6 -3
- package/SVF-doxygen/html/html/functions_type_i.html +4 -2
- package/SVF-doxygen/html/html/functions_type_n.html +6 -3
- package/SVF-doxygen/html/html/functions_type_p.html +9 -0
- package/SVF-doxygen/html/html/functions_type_s.html +6 -0
- package/SVF-doxygen/html/html/functions_type_w.html +3 -1
- package/SVF-doxygen/html/html/functions_v.html +2 -1
- package/SVF-doxygen/html/html/functions_vars.html +2 -1
- package/SVF-doxygen/html/html/functions_vars_c.html +6 -0
- package/SVF-doxygen/html/html/functions_vars_e.html +6 -0
- package/SVF-doxygen/html/html/functions_vars_f.html +9 -0
- package/SVF-doxygen/html/html/functions_vars_g.html +17 -1
- package/SVF-doxygen/html/html/functions_vars_i.html +3 -0
- package/SVF-doxygen/html/html/functions_vars_l.html +3 -0
- package/SVF-doxygen/html/html/functions_vars_n.html +6 -0
- package/SVF-doxygen/html/html/functions_vars_r.html +3 -0
- package/SVF-doxygen/html/html/functions_vars_s.html +16 -0
- package/SVF-doxygen/html/html/functions_vars_t.html +6 -0
- package/SVF-doxygen/html/html/functions_vars_w.html +3 -1
- package/SVF-doxygen/html/html/functions_w.html +15 -1
- package/SVF-doxygen/html/html/globals_func_i.html +3 -10
- package/SVF-doxygen/html/html/globals_func_m.html +12 -11
- package/SVF-doxygen/html/html/globals_func_s.html +1 -0
- package/SVF-doxygen/html/html/globals_i.html +3 -10
- package/SVF-doxygen/html/html/globals_m.html +14 -13
- package/SVF-doxygen/html/html/globals_s.html +8 -7
- package/SVF-doxygen/html/html/hierarchy.html +433 -417
- package/SVF-doxygen/html/html/mta_8cpp.html +2 -46
- package/SVF-doxygen/html/html/mta_8cpp_source.html +3 -4
- package/SVF-doxygen/html/html/namespaceSVF.html +83 -6
- package/SVF-doxygen/html/html/namespacellvm.html +9 -0
- package/SVF-doxygen/html/html/namespacemembers_c.html +1 -1
- package/SVF-doxygen/html/html/namespacemembers_g.html +11 -2
- package/SVF-doxygen/html/html/namespacemembers_type.html +10 -1
- package/SVF-doxygen/html/html/saber_8cpp.html +2 -46
- package/SVF-doxygen/html/html/saber_8cpp_source.html +4 -5
- package/SVF-doxygen/html/html/search/all_0.js +1 -1
- package/SVF-doxygen/html/html/search/all_1.js +4 -4
- package/SVF-doxygen/html/html/search/all_10.js +8 -6
- package/SVF-doxygen/html/html/search/all_12.js +2 -1
- package/SVF-doxygen/html/html/search/all_13.js +20 -11
- package/SVF-doxygen/html/html/search/all_14.js +5 -3
- package/SVF-doxygen/html/html/search/all_16.js +2 -2
- package/SVF-doxygen/html/html/search/all_17.js +1 -1
- package/SVF-doxygen/html/html/search/all_1b.js +6 -0
- package/SVF-doxygen/html/html/search/all_2.js +6 -4
- package/SVF-doxygen/html/html/search/all_3.js +27 -4
- package/SVF-doxygen/html/html/search/all_4.js +3 -2
- package/SVF-doxygen/html/html/search/all_5.js +5 -0
- package/SVF-doxygen/html/html/search/all_6.js +8 -5
- package/SVF-doxygen/html/html/search/all_7.js +40 -13
- package/SVF-doxygen/html/html/search/all_8.js +4 -1
- package/SVF-doxygen/html/html/search/all_9.js +9 -7
- package/SVF-doxygen/html/html/search/all_c.js +2 -1
- package/SVF-doxygen/html/html/search/all_d.js +2 -2
- package/SVF-doxygen/html/html/search/all_e.js +9 -5
- package/SVF-doxygen/html/html/search/all_f.js +4 -4
- package/SVF-doxygen/html/html/search/classes_2.js +7 -0
- package/SVF-doxygen/html/html/search/classes_3.js +1 -0
- package/SVF-doxygen/html/html/search/classes_5.js +1 -0
- package/SVF-doxygen/html/html/search/classes_6.js +7 -0
- package/SVF-doxygen/html/html/search/enumvalues_0.js +0 -2
- package/SVF-doxygen/html/html/search/enumvalues_2.js +3 -0
- package/SVF-doxygen/html/html/search/enumvalues_5.js +0 -1
- package/SVF-doxygen/html/html/search/files_2.js +11 -1
- package/SVF-doxygen/html/html/search/files_6.js +4 -1
- package/SVF-doxygen/html/html/search/functions_0.js +4 -2
- package/SVF-doxygen/html/html/search/functions_1.js +6 -4
- package/SVF-doxygen/html/html/search/functions_10.js +7 -3
- package/SVF-doxygen/html/html/search/functions_13.js +1 -1
- package/SVF-doxygen/html/html/search/functions_16.js +6 -0
- package/SVF-doxygen/html/html/search/functions_2.js +8 -0
- package/SVF-doxygen/html/html/search/functions_3.js +2 -2
- package/SVF-doxygen/html/html/search/functions_4.js +3 -0
- package/SVF-doxygen/html/html/search/functions_5.js +3 -3
- package/SVF-doxygen/html/html/search/functions_6.js +22 -10
- package/SVF-doxygen/html/html/search/functions_7.js +4 -1
- package/SVF-doxygen/html/html/search/functions_8.js +5 -4
- package/SVF-doxygen/html/html/search/functions_b.js +1 -1
- package/SVF-doxygen/html/html/search/functions_c.js +2 -0
- package/SVF-doxygen/html/html/search/functions_e.js +2 -2
- package/SVF-doxygen/html/html/search/typedefs_11.js +1 -0
- package/SVF-doxygen/html/html/search/typedefs_15.js +1 -1
- package/SVF-doxygen/html/html/search/typedefs_2.js +3 -2
- package/SVF-doxygen/html/html/search/typedefs_6.js +6 -3
- package/SVF-doxygen/html/html/search/typedefs_8.js +2 -2
- package/SVF-doxygen/html/html/search/typedefs_d.js +3 -3
- package/SVF-doxygen/html/html/search/typedefs_f.js +2 -0
- package/SVF-doxygen/html/html/search/variables_0.js +1 -1
- package/SVF-doxygen/html/html/search/variables_12.js +1 -0
- package/SVF-doxygen/html/html/search/variables_13.js +5 -0
- package/SVF-doxygen/html/html/search/variables_14.js +3 -1
- package/SVF-doxygen/html/html/search/variables_17.js +1 -1
- package/SVF-doxygen/html/html/search/variables_3.js +2 -0
- package/SVF-doxygen/html/html/search/variables_5.js +3 -1
- package/SVF-doxygen/html/html/search/variables_6.js +3 -0
- package/SVF-doxygen/html/html/search/variables_7.js +5 -1
- package/SVF-doxygen/html/html/search/variables_9.js +1 -0
- package/SVF-doxygen/html/html/search/variables_c.js +1 -0
- package/SVF-doxygen/html/html/search/variables_d.js +1 -1
- package/SVF-doxygen/html/html/search/variables_e.js +2 -0
- package/SVF-doxygen/html/html/st_8c.html +4 -4
- package/SVF-doxygen/html/html/st_8c_source.html +2 -2
- package/SVF-doxygen/html/html/st_8h.html +4 -4
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01CFLGraph_01_5_01_4-members.html +87 -0
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01CFLGraph_01_5_01_4.html +381 -0
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01CFLGraph_01_5_01_4.png +0 -0
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01Inverse_3_01SVF_1_1CFLNode_01_5_01_4_01_4.html +100 -0
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01Inverse_3_01SVF_1_1CFLNode_01_5_01_4_01_4.png +0 -0
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01SVF_1_1CFLGraph_01_5_01_4-members.html +81 -0
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01SVF_1_1CFLGraph_01_5_01_4.html +122 -0
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01SVF_1_1CFLGraph_01_5_01_4.png +0 -0
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01SVF_1_1CFLNode_01_5_01_4.html +96 -0
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01SVF_1_1CFLNode_01_5_01_4.png +0 -0
- package/SVF-doxygen/html/html/svf-ex_8cpp.html +10 -54
- package/SVF-doxygen/html/html/svf-ex_8cpp_source.html +8 -9
- package/SVF-doxygen/html/html/tools_2CFL_2CMakeLists_8txt.html +102 -0
- package/SVF-doxygen/html/html/wpa_8cpp.html +2 -46
- package/SVF-doxygen/html/html/wpa_8cpp_source.html +3 -4
- package/include/CFL/CFGNormalizer.h +70 -0
- package/include/CFL/CFLAlias.h +124 -0
- package/include/CFL/CFLGrammar.h +127 -0
- package/include/CFL/CFLSolver.h +94 -0
- package/include/CFL/GrammarBuilder.h +65 -0
- package/include/Graphs/CFLGraph.h +175 -0
- package/include/Graphs/IRGraph.h +1 -1
- package/include/MemoryModel/PointerAnalysis.h +3 -3
- package/include/SABER/SrcSnkDDA.h +3 -2
- package/include/Util/GraphReachSolver.h +186 -0
- package/include/Util/Options.h +6 -0
- package/lib/CFL/CFGNormalizer.cpp +329 -0
- package/lib/CFL/CFLGrammar.cpp +101 -0
- package/lib/CFL/CFLSolver.cpp +106 -0
- package/lib/CFL/GrammarBuilder.cpp +155 -0
- package/lib/CMakeLists.txt +1 -0
- package/lib/Graphs/CFLGraph.cpp +225 -0
- package/lib/Util/Options.cpp +31 -0
- package/package.json +1 -1
- package/tools/CFL/CMakeLists.txt +12 -0
- package/tools/CFL/cfl.cpp +80 -0
- package/tools/CMakeLists.txt +1 -0
- package/tools/DDA/dda.cpp +0 -3
- package/tools/Example/svf-ex.cpp +0 -3
- package/tools/MTA/mta.cpp +0 -4
- package/tools/SABER/saber.cpp +0 -3
- package/tools/WPA/wpa.cpp +0 -4
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
//===----- CFGNormalizer.cpp -- CFL Alias Analysis Client--------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* CFGNormalizer.cpp
|
|
25
|
+
*
|
|
26
|
+
* Created on: April 19 , 2022
|
|
27
|
+
* Author: Pei Xu
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#include <string>
|
|
31
|
+
#include <regex>
|
|
32
|
+
#include <fstream>
|
|
33
|
+
#include <sstream>
|
|
34
|
+
#include <iostream>
|
|
35
|
+
#include "Util/BasicTypes.h"
|
|
36
|
+
#include "CFL/CFGNormalizer.h"
|
|
37
|
+
|
|
38
|
+
using namespace SVF;
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
Input: extended Backus–Naur form (EBNF)
|
|
42
|
+
|
|
43
|
+
Usage Notation
|
|
44
|
+
definition =
|
|
45
|
+
concatenation ,
|
|
46
|
+
termination ;
|
|
47
|
+
alternation |
|
|
48
|
+
optional [ ... ]
|
|
49
|
+
repetition { ... }
|
|
50
|
+
grouping ( ... )
|
|
51
|
+
terminal string " ... "
|
|
52
|
+
terminal string ' ... '
|
|
53
|
+
comment (* ... *)
|
|
54
|
+
special sequence ? ... ?
|
|
55
|
+
exception -
|
|
56
|
+
|
|
57
|
+
Output: Backus-Naur form(BNF)
|
|
58
|
+
|
|
59
|
+
<symbol> ::= __expression__
|
|
60
|
+
|
|
61
|
+
Possible Step:
|
|
62
|
+
|
|
63
|
+
Convert every repetition { E } to a fresh non-terminal X and add
|
|
64
|
+
X = $\epsilon$ | X E.
|
|
65
|
+
Convert every option [ E ] to a fresh non-terminal X and add
|
|
66
|
+
X = $\epsilon$ | E.
|
|
67
|
+
(We can convert X = A [ E ] B. to X = A E B | A B.)
|
|
68
|
+
Convert every group ( E ) to a fresh non-terminal X and add
|
|
69
|
+
X = E.
|
|
70
|
+
We can even do away with alternatives by having several productions with the same non-terminal.
|
|
71
|
+
X = E | E'. becomes X = E. X = E'.
|
|
72
|
+
|
|
73
|
+
Only Consider BIN Transformation for BNF form
|
|
74
|
+
|
|
75
|
+
And no differentiation between terminal and non-terminal
|
|
76
|
+
1. Handwriting Testing for BIN Transformation Correctness
|
|
77
|
+
|
|
78
|
+
*/
|
|
79
|
+
// BNF
|
|
80
|
+
// BIN Transforom
|
|
81
|
+
|
|
82
|
+
CFLGrammar* CFGNormalizer::normalize(GrammarBase *generalGrammar){
|
|
83
|
+
/*
|
|
84
|
+
ebnf_sign_replace('*');
|
|
85
|
+
ebnf_sign_replace('?');
|
|
86
|
+
*/
|
|
87
|
+
CFLGrammar *grammar = new CFLGrammar();
|
|
88
|
+
grammar->startSymbol = generalGrammar->startSymbol;
|
|
89
|
+
grammar->terminals = generalGrammar->terminals;
|
|
90
|
+
grammar->nonterminals = generalGrammar->nonterminals;
|
|
91
|
+
grammar->totalSymbol = generalGrammar->totalSymbol;
|
|
92
|
+
ebnf_bin(generalGrammar, grammar);
|
|
93
|
+
|
|
94
|
+
for(auto symProdsPair: generalGrammar->rawProductions){
|
|
95
|
+
for(auto prod: symProdsPair.second){
|
|
96
|
+
Production tempP = prod;
|
|
97
|
+
tempP.insert(tempP.begin(), symProdsPair.first);
|
|
98
|
+
if (prod.size() == 1){
|
|
99
|
+
if ((std::find(tempP.begin(), tempP.end(), grammar->str2Sym("epsilon")) != tempP.end()))
|
|
100
|
+
{
|
|
101
|
+
if (std::find(grammar->epsilonProds.begin(), grammar->epsilonProds.end(), tempP) == grammar->epsilonProds.end())
|
|
102
|
+
grammar->epsilonProds.insert(tempP);
|
|
103
|
+
}
|
|
104
|
+
grammar->singleRHS2Prods[tempP[1]].insert(tempP);
|
|
105
|
+
}
|
|
106
|
+
if (prod.size() == 2){
|
|
107
|
+
grammar->firstRHS2Prods[tempP[1]].insert(tempP);
|
|
108
|
+
grammar->secondRHS2Prods[tempP[2]].insert(tempP);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return grammar;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
void CFGNormalizer::ebnf_bin(GrammarBase* generalGrammar, CFLGrammar *grammar){
|
|
117
|
+
Map<Symbol, Productions> new_grammar = {};
|
|
118
|
+
std::string tempStr = "";
|
|
119
|
+
|
|
120
|
+
for(auto head : generalGrammar->rawProductions){
|
|
121
|
+
for(auto rule: head.second){
|
|
122
|
+
|
|
123
|
+
Production long_run = rule;
|
|
124
|
+
long_run.erase(long_run.begin());
|
|
125
|
+
auto it = generalGrammar->rawProductions[head.first].find(rule);
|
|
126
|
+
generalGrammar->rawProductions[head.first].erase(it);
|
|
127
|
+
generalGrammar->rawProductions[head.first].insert(long_run);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
for(auto head : generalGrammar->rawProductions){
|
|
132
|
+
for(auto rule: head.second){
|
|
133
|
+
if (rule.size() < 3) continue;
|
|
134
|
+
|
|
135
|
+
Production long_run = rule;
|
|
136
|
+
Symbol first = long_run[0];
|
|
137
|
+
long_run.erase(long_run.begin());
|
|
138
|
+
auto it = generalGrammar->rawProductions[head.first].find(rule);
|
|
139
|
+
generalGrammar->rawProductions[head.first].erase(it);
|
|
140
|
+
rule = {first};
|
|
141
|
+
generalGrammar->rawProductions[head.first].insert(rule);
|
|
142
|
+
|
|
143
|
+
Symbol X = check_head(new_grammar, long_run);
|
|
144
|
+
if (int(X) == -1){
|
|
145
|
+
X = check_head(generalGrammar->rawProductions, long_run);
|
|
146
|
+
}
|
|
147
|
+
if (int(X) != -1){
|
|
148
|
+
it = generalGrammar->rawProductions[head.first].find(rule);
|
|
149
|
+
generalGrammar->rawProductions[head.first].erase(it);
|
|
150
|
+
rule.push_back(X);
|
|
151
|
+
generalGrammar->rawProductions[head.first].insert(rule);
|
|
152
|
+
} else{
|
|
153
|
+
tempStr = "X";
|
|
154
|
+
std::ostringstream ss;
|
|
155
|
+
ss << grammar->num_generator();
|
|
156
|
+
tempStr.append(ss.str());
|
|
157
|
+
Symbol tempSym = grammar->insertNonTerminalSymbol(tempStr);
|
|
158
|
+
it = generalGrammar->rawProductions[head.first].find(rule);
|
|
159
|
+
generalGrammar->rawProductions[head.first].erase(it);
|
|
160
|
+
rule.push_back(tempSym);
|
|
161
|
+
generalGrammar->rawProductions[head.first].insert(rule);
|
|
162
|
+
X = tempSym;
|
|
163
|
+
}
|
|
164
|
+
new_grammar[X] = {};
|
|
165
|
+
Production temp_p = long_run;
|
|
166
|
+
Symbol RHX;
|
|
167
|
+
if (long_run.size() ==2){
|
|
168
|
+
new_grammar[X].insert(temp_p);
|
|
169
|
+
long_run.clear();
|
|
170
|
+
}
|
|
171
|
+
else{
|
|
172
|
+
new_grammar[X].insert(long_run);
|
|
173
|
+
RHX = X;
|
|
174
|
+
}
|
|
175
|
+
while (long_run.size() > 2)
|
|
176
|
+
{
|
|
177
|
+
first = long_run[0];
|
|
178
|
+
Production prev_rule = long_run;
|
|
179
|
+
long_run.erase(long_run.begin());
|
|
180
|
+
|
|
181
|
+
X = RHX;
|
|
182
|
+
temp_p = long_run;
|
|
183
|
+
|
|
184
|
+
RHX = check_head(new_grammar, long_run);
|
|
185
|
+
if (int(RHX) == -1){
|
|
186
|
+
RHX = check_head(generalGrammar->rawProductions, long_run);
|
|
187
|
+
}
|
|
188
|
+
if(int(RHX) == -1){
|
|
189
|
+
tempStr = "X";
|
|
190
|
+
std::ostringstream ss;
|
|
191
|
+
ss << grammar->num_generator();
|
|
192
|
+
tempStr.append(ss.str());
|
|
193
|
+
Symbol tempSym = grammar->insertNonTerminalSymbol(tempStr);
|
|
194
|
+
auto it = new_grammar[X].find(prev_rule);
|
|
195
|
+
new_grammar[X].erase(it);
|
|
196
|
+
new_grammar[X].insert({first, tempSym});
|
|
197
|
+
new_grammar[tempSym].insert(long_run);
|
|
198
|
+
RHX = tempSym;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
for (auto new_head : new_grammar){
|
|
204
|
+
for (auto prod : new_head.second){
|
|
205
|
+
auto it = generalGrammar->rawProductions[new_head.first].find(prod);
|
|
206
|
+
if (it == generalGrammar->rawProductions[new_head.first].end()) {
|
|
207
|
+
generalGrammar->rawProductions[new_head.first].insert(prod);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
int CFGNormalizer::ebnf_bracket_match(Production &prod, int i, CFLGrammar *grammar)
|
|
217
|
+
{
|
|
218
|
+
int index = i;
|
|
219
|
+
while (index >= 0)
|
|
220
|
+
{
|
|
221
|
+
if (grammar->sym2Str(prod[index]) == "(")
|
|
222
|
+
{
|
|
223
|
+
return index;
|
|
224
|
+
}
|
|
225
|
+
index--;
|
|
226
|
+
}
|
|
227
|
+
return 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
void CFGNormalizer::ebnf_sign_replace(char sign, GrammarBase* generalGrammar, CFLGrammar *grammar){
|
|
231
|
+
SVF::Map<std::string, std::string> new_rule_checker;
|
|
232
|
+
std::string X = "X";
|
|
233
|
+
for (auto ebnfHead : generalGrammar->rawProductions)
|
|
234
|
+
{
|
|
235
|
+
for (auto ebnfProd : ebnfHead.second)
|
|
236
|
+
{
|
|
237
|
+
size_t i = 1;
|
|
238
|
+
while (i < ebnfProd.size())
|
|
239
|
+
{
|
|
240
|
+
int repetition_start = -1;
|
|
241
|
+
if (grammar->sym2Str(ebnfProd[i]) == std::string(1, sign))
|
|
242
|
+
{
|
|
243
|
+
if (i == 1)
|
|
244
|
+
{
|
|
245
|
+
// abort("EBNF Form is not correct");
|
|
246
|
+
std::cout << "wr";
|
|
247
|
+
}
|
|
248
|
+
else if (grammar->sym2Str(ebnfProd[i - 1]) != std::string(1, ')'))
|
|
249
|
+
{
|
|
250
|
+
repetition_start = i - 1;
|
|
251
|
+
}
|
|
252
|
+
else
|
|
253
|
+
{
|
|
254
|
+
repetition_start = ebnf_bracket_match(ebnfProd, i, grammar);
|
|
255
|
+
}
|
|
256
|
+
std::string repetition = "";
|
|
257
|
+
for (size_t j = repetition_start; j < i; j++)
|
|
258
|
+
{
|
|
259
|
+
repetition.append(grammar->sym2Str(ebnfProd[j]));
|
|
260
|
+
repetition.append(" ");
|
|
261
|
+
}
|
|
262
|
+
repetition.append(grammar->sym2Str(ebnfProd[i]));
|
|
263
|
+
if (new_rule_checker.find(repetition) != new_rule_checker.end())
|
|
264
|
+
{
|
|
265
|
+
|
|
266
|
+
ebnfProd.erase(ebnfProd.begin() + repetition_start, ebnfProd.begin() + i + 1);
|
|
267
|
+
ebnfProd.insert(ebnfProd.begin() + repetition_start, grammar->str2Sym(new_rule_checker[repetition]));
|
|
268
|
+
}
|
|
269
|
+
else
|
|
270
|
+
{
|
|
271
|
+
X = "X";
|
|
272
|
+
std::ostringstream ss;
|
|
273
|
+
ss << grammar->num_generator();
|
|
274
|
+
X.append(ss.str());
|
|
275
|
+
Symbol tempSym = grammar->insertNonTerminalSymbol(X);
|
|
276
|
+
ebnfProd.erase(ebnfProd.begin() + repetition_start, ebnfProd.begin() + i + 1);
|
|
277
|
+
ebnfProd.insert(ebnfProd.begin() + repetition_start, tempSym);
|
|
278
|
+
new_rule_checker[repetition] = X;
|
|
279
|
+
}
|
|
280
|
+
i = repetition_start;
|
|
281
|
+
}
|
|
282
|
+
i++;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
for(auto rep: new_rule_checker){
|
|
287
|
+
Production temp_list = {};
|
|
288
|
+
std::string new_nonterminal = rep.second;
|
|
289
|
+
if (sign == '*'){
|
|
290
|
+
temp_list.push_back(grammar->str2Sym(new_nonterminal));
|
|
291
|
+
}
|
|
292
|
+
Production temp_p = strTrans(rep.second, grammar);
|
|
293
|
+
temp_list.insert(temp_list.end(), temp_p.begin(),temp_p.end());
|
|
294
|
+
temp_list.insert(temp_list.begin(), grammar->str2Sym("epsilon"));
|
|
295
|
+
generalGrammar->rawProductions[grammar->str2Sym(new_nonterminal)].insert(temp_list);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
CFGNormalizer::Production CFGNormalizer::strTrans(std::string LHS, CFLGrammar *grammar){
|
|
301
|
+
Production prod = {};
|
|
302
|
+
std::smatch matches;
|
|
303
|
+
std::regex LHSReg("\\s*(.*)");
|
|
304
|
+
std::string delimiter;
|
|
305
|
+
size_t pos;
|
|
306
|
+
std::string word;
|
|
307
|
+
std::regex_search(LHS, matches, LHSReg);
|
|
308
|
+
LHS = matches.str(1);
|
|
309
|
+
delimiter = " ";
|
|
310
|
+
while ((pos = LHS.find(delimiter)) != std::string::npos)
|
|
311
|
+
{
|
|
312
|
+
word = LHS.substr(0, pos);
|
|
313
|
+
LHS.erase(0, pos + delimiter.length());
|
|
314
|
+
prod.push_back(grammar->str2Sym(word));
|
|
315
|
+
}
|
|
316
|
+
prod.push_back(grammar->str2Sym(LHS));
|
|
317
|
+
return prod;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
int CFGNormalizer::check_head(Map<Symbol, Productions> &grammar, Production &rule){
|
|
321
|
+
for(auto symProdPair: grammar){
|
|
322
|
+
for(auto prod: symProdPair.second){
|
|
323
|
+
if (rule == prod){
|
|
324
|
+
return symProdPair.first;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return -1;
|
|
329
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//===----- CFLGrammar.cpp -- Context-free grammar --------------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* CFLGrammar.cpp
|
|
25
|
+
*
|
|
26
|
+
* Created on: March 5, 2022
|
|
27
|
+
* Author: Yulei Sui
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#include "CFL/CFLGrammar.h"
|
|
31
|
+
#include <string>
|
|
32
|
+
|
|
33
|
+
using namespace SVF;
|
|
34
|
+
|
|
35
|
+
GrammarBase::Symbol GrammarBase::str2Sym(std::string str) const{
|
|
36
|
+
|
|
37
|
+
auto tit = terminals.find(str);
|
|
38
|
+
if(tit!=terminals.end())
|
|
39
|
+
return tit->second;
|
|
40
|
+
|
|
41
|
+
auto nit = nonterminals.find(str);
|
|
42
|
+
if(nit!=nonterminals.end())
|
|
43
|
+
return nit->second;
|
|
44
|
+
|
|
45
|
+
assert(false && "symbol not found!");
|
|
46
|
+
abort();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
std::string GrammarBase::sym2Str(Symbol sym) const
|
|
50
|
+
{
|
|
51
|
+
|
|
52
|
+
std::string key = "";
|
|
53
|
+
for (auto &i : terminals)
|
|
54
|
+
{
|
|
55
|
+
if (i.second == sym)
|
|
56
|
+
{
|
|
57
|
+
key = i.first;
|
|
58
|
+
return key;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
std::string nkey = "";
|
|
63
|
+
for (auto &ni : nonterminals)
|
|
64
|
+
{
|
|
65
|
+
if (ni.second == sym)
|
|
66
|
+
{
|
|
67
|
+
nkey = ni.first;
|
|
68
|
+
return nkey;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
GrammarBase::Symbol GrammarBase::insertTerminalSymbol(std::string strLit){
|
|
76
|
+
Symbol sym;
|
|
77
|
+
if (terminals.find(strLit) == terminals.end()) {
|
|
78
|
+
sym = totalSymbol++;
|
|
79
|
+
terminals.insert({strLit, sym});
|
|
80
|
+
}
|
|
81
|
+
else{
|
|
82
|
+
sym = str2Sym(strLit);
|
|
83
|
+
}
|
|
84
|
+
return sym;
|
|
85
|
+
}
|
|
86
|
+
GrammarBase::Symbol GrammarBase::insertNonTerminalSymbol(std::string strLit){
|
|
87
|
+
Symbol sym;
|
|
88
|
+
if (nonterminals.find(strLit) == nonterminals.end()) {
|
|
89
|
+
sym = totalSymbol++;
|
|
90
|
+
nonterminals.insert({strLit, sym});
|
|
91
|
+
}
|
|
92
|
+
else{
|
|
93
|
+
sym = str2Sym(strLit);
|
|
94
|
+
}
|
|
95
|
+
return sym;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
CFLGrammar::CFLGrammar(){
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
//===----- CFLSolver.cpp -- Context-free language reachability solver--------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* CFLSolver.cpp
|
|
25
|
+
*
|
|
26
|
+
* Created on: March 5, 2022
|
|
27
|
+
* Author: Yulei Sui
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#include "CFL/CFLSolver.h"
|
|
31
|
+
|
|
32
|
+
using namespace SVF;
|
|
33
|
+
|
|
34
|
+
void CFLSolver::solve(){
|
|
35
|
+
/// initial worklist
|
|
36
|
+
for(auto it = graph->begin(); it!= graph->end(); it++){
|
|
37
|
+
for(const CFLEdge* edge : (*it).second->getOutEdges()){
|
|
38
|
+
pushIntoWorklist(edge);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/// Foreach production X -> epsilon
|
|
42
|
+
/// add X(i,i) if not exist to E and to worklist
|
|
43
|
+
for(const Production& prod : grammar->getEpsilonProds()){
|
|
44
|
+
for(auto it = graph->begin(); it!= graph->end(); it++){
|
|
45
|
+
Symbol X = grammar->getLHSSymbol(prod);
|
|
46
|
+
CFLNode* i = (*it).second;
|
|
47
|
+
if(const CFLEdge* edge = graph->addCFLEdge(i, i, X))
|
|
48
|
+
pushIntoWorklist(edge);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
while(!isWorklistEmpty()){
|
|
53
|
+
/// Select and remove an edge Y(i,j) from worklist
|
|
54
|
+
const CFLEdge* Y_edge = popFromWorklist();
|
|
55
|
+
CFLNode* i = Y_edge->getSrcNode();
|
|
56
|
+
CFLNode* j = Y_edge->getDstNode();
|
|
57
|
+
|
|
58
|
+
/// For each production X -> Y
|
|
59
|
+
/// add X(i,j) if not exist to E and to worklist
|
|
60
|
+
Symbol Y = Y_edge->getEdgeKind();
|
|
61
|
+
if (grammar->hasProdsFromSingleRHS(Y))
|
|
62
|
+
for(const Production& prod : grammar->getProdsFromSingleRHS(Y)){
|
|
63
|
+
Symbol X = grammar->getLHSSymbol(prod);
|
|
64
|
+
if(const CFLEdge* newEdge = graph->addCFLEdge(i, j, X))
|
|
65
|
+
{
|
|
66
|
+
pushIntoWorklist(newEdge);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/// For each production X -> Y Z
|
|
71
|
+
/// Foreach outgoing edge Z(j,k) from node j do
|
|
72
|
+
/// add X(i,k) if not exist to E and to worklist
|
|
73
|
+
if (grammar->hasProdsFromFirstRHS(Y))
|
|
74
|
+
for(const Production& prod : grammar->getProdsFromFirstRHS(Y)){
|
|
75
|
+
Symbol X = grammar->getLHSSymbol(prod);
|
|
76
|
+
for(const CFLEdge* Z_edge : j->getOutEdges()){
|
|
77
|
+
if (Z_edge->getEdgeKind() == grammar->getSecondRHSSymbol(prod))
|
|
78
|
+
{
|
|
79
|
+
CFLNode* k = Z_edge->getDstNode();
|
|
80
|
+
if(const CFLEdge* newEdge = graph->addCFLEdge(i, k, X))
|
|
81
|
+
{
|
|
82
|
+
pushIntoWorklist(newEdge);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/// For each production X -> Z Y
|
|
89
|
+
/// Foreach incoming edge Z(k,i) to node i do
|
|
90
|
+
/// add X(k,j) if not exist to E and to worklist
|
|
91
|
+
if(grammar->hasProdsFromSecondRHS(Y))
|
|
92
|
+
for(const Production& prod : grammar->getProdsFromSecondRHS(Y)){
|
|
93
|
+
Symbol X = grammar->getLHSSymbol(prod);
|
|
94
|
+
for(const CFLEdge* Z_edge : i->getInEdges()){
|
|
95
|
+
if(Z_edge->getEdgeKind() == grammar->getFirstRHSSymbol(prod))
|
|
96
|
+
{
|
|
97
|
+
CFLNode* k = Z_edge->getSrcNode();
|
|
98
|
+
if(const CFLEdge* newEdge = graph->addCFLEdge(k, j, X))
|
|
99
|
+
{
|
|
100
|
+
pushIntoWorklist(newEdge);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
//===----- CFGNormalizer.h -- CFL Alias Analysis Client--------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* GrammarBuilder.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: April 27, 2022
|
|
27
|
+
* Author: Pei Xu
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#include <string>
|
|
31
|
+
#include <fstream>
|
|
32
|
+
#include <regex>
|
|
33
|
+
#include <sstream>
|
|
34
|
+
#include <iostream>
|
|
35
|
+
#include "CFL/GrammarBuilder.h"
|
|
36
|
+
|
|
37
|
+
namespace SVF{
|
|
38
|
+
GrammarBase* GrammarBuilder::build(){
|
|
39
|
+
grammar->insertTerminalSymbol("epsilon");
|
|
40
|
+
|
|
41
|
+
std::ifstream textFile(fileName);
|
|
42
|
+
std::string lineString;
|
|
43
|
+
std::string lines = "";
|
|
44
|
+
std::regex reg("Start:([\\s\\S]*)Productions:([\\s\\S]*)");
|
|
45
|
+
std::string startS = "";
|
|
46
|
+
std::regex stripReg("\\s*(\\S*)\\s*");
|
|
47
|
+
std::vector<std::string> wordProd;
|
|
48
|
+
|
|
49
|
+
while (getline(textFile, lineString))
|
|
50
|
+
{
|
|
51
|
+
lines.append(lineString);
|
|
52
|
+
}
|
|
53
|
+
textFile.close();
|
|
54
|
+
std::smatch matches;
|
|
55
|
+
GrammarBase::Production prod;
|
|
56
|
+
if (std::regex_search(lines, matches, reg))
|
|
57
|
+
{
|
|
58
|
+
lines = matches.str(2);
|
|
59
|
+
startS = matches.str(1);
|
|
60
|
+
std::regex_search(startS, matches, stripReg);
|
|
61
|
+
startS = matches.str(1);
|
|
62
|
+
}
|
|
63
|
+
size_t pos = 0;
|
|
64
|
+
|
|
65
|
+
std::string delimiter = ";";
|
|
66
|
+
std::string word = "";
|
|
67
|
+
while ((pos = lines.find(";")) != std::string::npos)
|
|
68
|
+
{
|
|
69
|
+
word = lines.substr(0, pos);
|
|
70
|
+
wordProd.push_back(word);
|
|
71
|
+
lines.erase(0, pos + delimiter.length());
|
|
72
|
+
}
|
|
73
|
+
std::string delimiter1 = "->";
|
|
74
|
+
|
|
75
|
+
for (auto it : wordProd)
|
|
76
|
+
{
|
|
77
|
+
if ((pos = it.find(delimiter1)) != std::string::npos)
|
|
78
|
+
{
|
|
79
|
+
std::string head = it.substr(0, pos);
|
|
80
|
+
std::string LHS = it.substr(pos + delimiter1.size(), it.size() - 1);
|
|
81
|
+
std::regex_search(head, matches, stripReg);
|
|
82
|
+
head = matches.str(1);// Capital is Non-terminal
|
|
83
|
+
if (grammar->nonterminals.find(head) == grammar->nonterminals.end())
|
|
84
|
+
{
|
|
85
|
+
grammar->nonterminals.insert({head, grammar->totalSymbol});
|
|
86
|
+
prod.push_back(grammar->totalSymbol++);
|
|
87
|
+
}
|
|
88
|
+
else
|
|
89
|
+
{
|
|
90
|
+
prod.push_back(grammar->str2Sym(head));
|
|
91
|
+
}
|
|
92
|
+
if (grammar->rawProductions.find(grammar->str2Sym(head)) == grammar->rawProductions.end())
|
|
93
|
+
{
|
|
94
|
+
grammar->rawProductions.insert({grammar->str2Sym(head), {}});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
std::regex LHSReg("\\s*(.*)");
|
|
98
|
+
std::regex_search(LHS, matches, LHSReg);
|
|
99
|
+
LHS = matches.str(1);
|
|
100
|
+
delimiter = " ";
|
|
101
|
+
while ((pos = LHS.find(delimiter)) != std::string::npos)
|
|
102
|
+
{
|
|
103
|
+
word = LHS.substr(0, pos);
|
|
104
|
+
LHS.erase(0, pos + delimiter.length());//Capital is Nonterminal, Otherwise is terminal
|
|
105
|
+
if (isupper(word[0])){
|
|
106
|
+
if (grammar->nonterminals.find(word) == grammar->nonterminals.end())
|
|
107
|
+
{
|
|
108
|
+
grammar->nonterminals.insert({word, grammar->totalSymbol});
|
|
109
|
+
prod.push_back(grammar->totalSymbol++);
|
|
110
|
+
}
|
|
111
|
+
else
|
|
112
|
+
prod.push_back(grammar->str2Sym(word));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
if (grammar->terminals.find(word) == grammar->terminals.end())
|
|
116
|
+
{
|
|
117
|
+
grammar->terminals.insert({word, grammar->totalSymbol});
|
|
118
|
+
prod.push_back(grammar->totalSymbol++);
|
|
119
|
+
}
|
|
120
|
+
else
|
|
121
|
+
prod.push_back(grammar->str2Sym(word));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (isupper(LHS[0])){
|
|
125
|
+
if (grammar->nonterminals.find(LHS) == grammar->nonterminals.end())
|
|
126
|
+
{
|
|
127
|
+
grammar->nonterminals.insert({LHS, grammar->totalSymbol});
|
|
128
|
+
prod.push_back(grammar->totalSymbol++);
|
|
129
|
+
}
|
|
130
|
+
else
|
|
131
|
+
prod.push_back(grammar->str2Sym(LHS));
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
if (grammar->terminals.find(LHS) == grammar->terminals.end())
|
|
135
|
+
{
|
|
136
|
+
grammar->terminals.insert({LHS, grammar->totalSymbol});
|
|
137
|
+
prod.push_back(grammar->totalSymbol++);
|
|
138
|
+
}
|
|
139
|
+
else
|
|
140
|
+
prod.push_back(grammar->str2Sym(LHS));
|
|
141
|
+
}
|
|
142
|
+
grammar->rawProductions[grammar->str2Sym(head)].insert(prod);
|
|
143
|
+
prod = {};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
grammar->startSymbol = grammar->str2Sym(startS);
|
|
147
|
+
return grammar;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
GrammarBase* GrammarBuilder::build(Map<std::string, SVF::CFLGraph::Symbol> *preMap){
|
|
151
|
+
grammar->nonterminals = *preMap;
|
|
152
|
+
grammar->totalSymbol = preMap->size();
|
|
153
|
+
return build();
|
|
154
|
+
};
|
|
155
|
+
}
|