├── .gitignore ├── .project ├── .properties ├── BaselineOfLeibniz ├── BaselineOfLeibniz.class.st └── package.st ├── BaselineOfLeibniz1ForGToolkit ├── BaselineOfLeibniz1ForGToolkit.class.st └── package.st ├── BaselineOfLeibnizForGToolkit ├── BaselineOfLeibnizForGToolkit.class.st └── package.st ├── LICENSE ├── Leibniz ├── Float.extension.st ├── Fraction.extension.st ├── GtHome.extension.st ├── GtPhlowColumnedListView.extension.st ├── GtPhlowColumnedTreeView.extension.st ├── GtPhlowListView.extension.st ├── GtPhlowProtoView.extension.st ├── GtPhlowTreeView.extension.st ├── Integer.extension.st ├── LbArity.class.st ├── LbAtomicTerm.class.st ├── LbAxiom.class.st ├── LbAxiomBuilder.class.st ├── LbAxiomExamples.class.st ├── LbAxiomParserExamples.class.st ├── LbAxioms.class.st ├── LbBooleanTerm.class.st ├── LbBracketOperatorName.class.st ├── LbBuiltinContexts.class.st ├── LbBuiltinDSignatures.class.st ├── LbBuiltinDSortGraphs.class.st ├── LbBuiltinRewriteSystems.class.st ├── LbBuiltinSignatures.class.st ├── LbBuiltinSortGraphs.class.st ├── LbCodeFont.class.st ├── LbContext.class.st ├── LbContextBuilder.class.st ├── LbContextExamples.class.st ├── LbContextTerm.class.st ├── LbDArity.class.st ├── LbDArityPair.class.st ├── LbDKind.class.st ├── LbDKindArity.class.st ├── LbDOperator.class.st ├── LbDSignature.class.st ├── LbDSignatureBuilder.class.st ├── LbDSignatureParser.class.st ├── LbDSort.class.st ├── LbDSortExamples.class.st ├── LbDSortFamily.class.st ├── LbDSortGraph.class.st ├── LbDSortGraphBuilder.class.st ├── LbDSortPair.class.st ├── LbDSortSpecificFamily.class.st ├── LbDSortUniversalFamily.class.st ├── LbEqualityAxiom.class.st ├── LbFPNumberTerm.class.st ├── LbFakeSignatureForSortParser.class.st ├── LbFunctionRule.class.st ├── LbGrammarIdentifiersAndLiterals.class.st ├── LbGrammarRulesAndAxioms.class.st ├── LbGrammarSignaturesAndTerms.class.st ├── LbGrammarTokens.class.st ├── LbGraphicsElements.class.st ├── LbInfixOperatorName.class.st ├── LbIntegerTerm.class.st ├── LbKind.class.st ├── LbMatchingRules.class.st ├── LbOpTerm.class.st ├── LbOperator.class.st ├── LbOperatorName.class.st ├── LbOrigins.class.st ├── LbParser.class.st ├── LbPhlowColumnedTreeView.class.st ├── LbPhlowTreeView.class.st ├── LbPrefixOperatorName.class.st ├── LbPseudoOperatorName.class.st ├── LbRationalNumberTerm.class.st ├── LbReductionStep.class.st ├── LbReductionSteps.class.st ├── LbRewriteFailure.class.st ├── LbRewriteRule.class.st ├── LbRewriteStep.class.st ├── LbRewriteSystem.class.st ├── LbRewriteSystemBuilder.class.st ├── LbRewriteSystemExamples.class.st ├── LbRule.class.st ├── LbRuleExamples.class.st ├── LbRuleParserExamples.class.st ├── LbSignature.class.st ├── LbSignatureBuilder.class.st ├── LbSignatureExamples.class.st ├── LbSort.class.st ├── LbSortClassifier.class.st ├── LbSortGraph.class.st ├── LbSortGraphBuilder.class.st ├── LbSortGraphExamples.class.st ├── LbStringTerm.class.st ├── LbSubscriptOperatorName.class.st ├── LbSubsortAxiom.class.st ├── LbSubsortRelation.class.st ├── LbSuperscriptOperatorName.class.st ├── LbTaggedVariableName.class.st ├── LbTerm.class.st ├── LbTermExamples.class.st ├── LbTermParserExamples.class.st ├── LbUniversalVarTerm.class.st ├── LbVarTerm.class.st ├── LbVariable.class.st ├── LbVariables.class.st ├── LeibnizBuiltins.class.st ├── LeibnizBuiltinsTest.class.st ├── LeibnizDocument.class.st ├── LeibnizDocumentTest.class.st ├── LeibnizLibrary.class.st ├── LeibnizParserTest.class.st ├── LeibnizRewriteSystemTest.class.st ├── ManifestLeibniz.class.st ├── Object.extension.st ├── SequenceableCollection.extension.st ├── String.extension.st ├── Symbol.extension.st └── package.st ├── Leibniz2 ├── Character.extension.st ├── Color.extension.st ├── GtHome.extension.st ├── GtPhlowColumnedListView.extension.st ├── GtPhlowColumnedTreeView.extension.st ├── GtPhlowListView.extension.st ├── GtPhlowProtoView.extension.st ├── GtPhlowTreeView.extension.st ├── LeContent.extension.st ├── LeDatabase.extension.st ├── LeExportVisitor.extension.st ├── LeHtmlTextSnippetAnnotationVisitor.extension.st ├── LePage.extension.st ├── LeSnippet.extension.st ├── LeTextSnippet.extension.st ├── LzAnnotationStyler.class.st ├── LzArgNameAnnotation.class.st ├── LzArgNameAttribute.class.st ├── LzArity.class.st ├── LzArrayENode.class.st ├── LzArrayElementsNode.class.st ├── LzArrayExamples.class.st ├── LzArrayTerm.class.st ├── LzArrayTermDeclaration.class.st ├── LzArrayTermNode.class.st ├── LzAssetDeclaration.class.st ├── LzAssetLabelAttribute.class.st ├── LzAssetPrefixNode.class.st ├── LzAtomicTerm.class.st ├── LzAutoUpdatingSyntaxLabel.class.st ├── LzAxiom.class.st ├── LzAxiomDeclaration.class.st ├── LzBaselineAttribute.class.st ├── LzBindings.class.st ├── LzBindingsObsolete.class.st ├── LzBindingsSortVarNode.class.st ├── LzBindingsVarNode.class.st ├── LzBlockLinksVisitor.class.st ├── LzBook.class.st ├── LzBooleanTerm.class.st ├── LzBracketOpName.class.st ├── LzBracketOpNode.class.st ├── LzBracketOpTermNode.class.st ├── LzBuiltinContexts.class.st ├── LzButtonLabelAptitude.class.st ├── LzCodeFont.class.st ├── LzColonAttribute.class.st ├── LzColors.class.st ├── LzCompoundStepTermNode.class.st ├── LzConditionAttribute.class.st ├── LzConstants.class.st ├── LzContext.class.st ├── LzContextBuilder.class.st ├── LzContextNameAttribute.class.st ├── LzDBCache.class.st ├── LzDBRegistry.class.st ├── LzDebuggingUtilities.class.st ├── LzDeclaration.class.st ├── LzDeclarationAnnotation.class.st ├── LzDeclarationBuilder.class.st ├── LzDeclarationWithVariables.class.st ├── LzDisjointIntegerSets.class.st ├── LzDoNotRenderAttribute.class.st ├── LzEClass.class.st ├── LzEGraph.class.st ├── LzEGraphExamples.class.st ├── LzEGraphMatch.class.st ├── LzEGraphMatchStreamContents.class.st ├── LzEGraphRewriteCycleError.class.st ├── LzENode.class.st ├── LzEqualSignAttribute.class.st ├── LzEqualityAxiom.class.st ├── LzEqualityAxiomDeclaration.class.st ├── LzExampleContexts.class.st ├── LzExamples.class.st ├── LzExecutionState.class.st ├── LzFPLiteralDeclaration.class.st ├── LzFloatingPointNumberTerm.class.st ├── LzFpNumberLiteralTermNode.class.st ├── LzFunctionRule.class.st ├── LzFunctionRuleDeclaration.class.st ├── LzGlobalCache.class.st ├── LzGrammarIdentifiersAndLiterals.class.st ├── LzGrammarRulesAndAxioms.class.st ├── LzGrammarSignaturesAndTerms.class.st ├── LzGrammarTokens.class.st ├── LzGraphicsElements.class.st ├── LzHomeSection.class.st ├── LzHtlmTextSnippetRuleWriter.class.st ├── LzHtlmTextSnippetSortWriter.class.st ├── LzHtmlExporter.class.st ├── LzHtmlPageExporter.class.st ├── LzHtmlSyntaxPiece.class.st ├── LzHtmlTextSnippetAnnotationWriter.class.st ├── LzHtmlTextSnippetAssetWriter.class.st ├── LzHtmlTextSnippetEqualityAxiomWriter.class.st ├── LzHtmlTextSnippetOpWriter.class.st ├── LzHtmlTextSnippetSpecialTermsWriter.class.st ├── LzHtmlTextSnippetSubsortWriter.class.st ├── LzHtmlTextSnippetTermWriter.class.st ├── LzHtmlTextSnippetUseContextWriter.class.st ├── LzIdentifierAttribute.class.st ├── LzInfixOpName.class.st ├── LzInfixOpNameAttribute.class.st ├── LzInfixOpNode.class.st ├── LzInfixOpTermNode.class.st ├── LzIntegerLiteralDeclaration.class.st ├── LzIntegerLiteralTermNode.class.st ├── LzIntegerTerm.class.st ├── LzKind.class.st ├── LzLanguageTagAttribute.class.st ├── LzLeafENode.class.st ├── LzLeafErrorAttribute.class.st ├── LzLepiterExamples.class.st ├── LzLinePlot.class.st ├── LzLiteralAttribute.class.st ├── LzLiteralDeclaration.class.st ├── LzLiteralTermNode.class.st ├── LzMatchingRules.class.st ├── LzNonLeafENode.class.st ├── LzOpArgNode.class.st ├── LzOpDeclaration.class.st ├── LzOpENode.class.st ├── LzOpName.class.st ├── LzOpNode.class.st ├── LzOpSortFamily.class.st ├── LzOpTerm.class.st ├── LzOpTermDeclaration.class.st ├── LzOperator.class.st ├── LzOperators.class.st ├── LzOptionNode.class.st ├── LzPageContextCache.class.st ├── LzPageContextChanged.class.st ├── LzPageDeclarationCache.class.st ├── LzPageDeclarationsChanged.class.st ├── LzPageReferenceNode.class.st ├── LzParenthesesAnnotation.class.st ├── LzParenthesisAttribute.class.st ├── LzParenthesizedTermNode.class.st ├── LzParseTreeNode.class.st ├── LzParseTreeNodeVisitor.class.st ├── LzParser.class.st ├── LzParser2.class.st ├── LzParserExamples.class.st ├── LzPatternDeclaration.class.st ├── LzPatternMatcher.class.st ├── LzPatternNode.class.st ├── LzPharoCodeAttribute.class.st ├── LzPhlowColumnedTreeView.class.st ├── LzPhlowTreeView.class.st ├── LzPlotTerm.class.st ├── LzPrefixOpName.class.st ├── LzPrefixOpNameAttribute.class.st ├── LzPrefixOpNode.class.st ├── LzPrefixOpTermNode.class.st ├── LzProgramTerm.class.st ├── LzProgramTermDeclaration.class.st ├── LzProgramTermNode.class.st ├── LzPythonCode.class.st ├── LzRandom.class.st ├── LzRandomExamples.class.st ├── LzRandomTerms.class.st ├── LzRationalLiteralDeclaration.class.st ├── LzRationalNumberLiteralTermNode.class.st ├── LzRationalNumberTerm.class.st ├── LzRewriteArrowAttribute.class.st ├── LzRewriteCache.class.st ├── LzRewriteFailure.class.st ├── LzRewriteRule.class.st ├── LzRewriteRuleDeclaration.class.st ├── LzRewriteSystem.class.st ├── LzRewriteSystemBuilder.class.st ├── LzRule.class.st ├── LzRuleDeclaration.class.st ├── LzRuleMatcher.class.st ├── LzRuleOrderAttribute.class.st ├── LzRulePrefixNode.class.st ├── LzScanner.class.st ├── LzScopedProgramTerm.class.st ├── LzScopedVarName.class.st ├── LzShadowedBindings.class.st ├── LzSignature.class.st ├── LzSignatureBuilder.class.st ├── LzSimpleOpArgNode.class.st ├── LzSnippetTerm.class.st ├── LzSort.class.st ├── LzSortAttribute.class.st ├── LzSortDeclaration.class.st ├── LzSortExamples.class.st ├── LzSortFamily.class.st ├── LzSortFlagNode.class.st ├── LzSortGraph.class.st ├── LzSortGraphBuilder.class.st ├── LzSortHierarchyRoot.class.st ├── LzSortHierarchyRootGraph.class.st ├── LzSortPair.class.st ├── LzSortPatternMatcher.class.st ├── LzSpecialTermAttribute.class.st ├── LzSpecialTermsDeclaration.class.st ├── LzStateDeclaration.class.st ├── LzStepNode.class.st ├── LzStepTermNode.class.st ├── LzStreamContents.class.st ├── LzStreamContentsMoreItemsEvent.class.st ├── LzStringLiteralDeclaration.class.st ├── LzStringLiteralTermNode.class.st ├── LzStringTerm.class.st ├── LzSubcontextNameAttribute.class.st ├── LzSubscriptAttribute.class.st ├── LzSubscriptOpName.class.st ├── LzSubscriptOpNode.class.st ├── LzSubscriptOpTermNode.class.st ├── LzSubsortAttribute.class.st ├── LzSubsortAxiom.class.st ├── LzSubsortAxiomDeclaration.class.st ├── LzSubsortRelation.class.st ├── LzSuperscriptAttribute.class.st ├── LzSuperscriptOpName.class.st ├── LzSuperscriptOpNode.class.st ├── LzSuperscriptOpTermNode.class.st ├── LzSyntaxAttribute.class.st ├── LzSyntaxLabel.class.st ├── LzSyntaxLabelSegment.class.st ├── LzTaggedVarName.class.st ├── LzTerm.class.st ├── LzTermDeclaration.class.st ├── LzTermInContext.class.st ├── LzTermInContextWithEGraph.class.st ├── LzTermNode.class.st ├── LzTermStreamContents.class.st ├── LzTermsWithSharedVars.class.st ├── LzTextRenderer.class.st ├── LzTopLevelAnnotation.class.st ├── LzTopLevelAssetNode.class.st ├── LzTopLevelEqualityAxiomNode.class.st ├── LzTopLevelFunctionRuleNode.class.st ├── LzTopLevelOpNode.class.st ├── LzTopLevelRewriteRuleNode.class.st ├── LzTopLevelRuleNode.class.st ├── LzTopLevelSortNode.class.st ├── LzTopLevelSpecialTermsNode.class.st ├── LzTopLevelStateNode.class.st ├── LzTopLevelSubsortNode.class.st ├── LzTopLevelTermNode.class.st ├── LzTopLevelUseContextNode.class.st ├── LzTupleOpName.class.st ├── LzTupleOpNode.class.st ├── LzTupleTermNode.class.st ├── LzUniversalSortFamily.class.st ├── LzUseContextDeclaration.class.st ├── LzUseContextLink.class.st ├── LzVarDeclaration.class.st ├── LzVarDeclarationAttribute.class.st ├── LzVarDeclarationBuilder.class.st ├── LzVarName.class.st ├── LzVarNameAttribute.class.st ├── LzVarNameScopeAttribute.class.st ├── LzVarNode.class.st ├── LzVarTerm.class.st ├── LzVarTermDeclaration.class.st ├── LzVarTermNode.class.st ├── LzVarTermWithSortNode.class.st ├── Number.extension.st ├── Object.extension.st ├── SequenceableCollection.extension.st ├── TLeAnnotationParseNodeVisitor.extension.st ├── TLzEquality.trait.st ├── TLzParseTreeNodeVisitor.trait.st ├── TLzPrintable.trait.st └── package.st ├── README.md ├── RecurrenceEquations ├── Array2D.extension.st ├── RESequence.class.st └── package.st ├── codemeta.json ├── documentation ├── 15an0sxslnisd3s7e7hg0mni2.lepiter ├── 1qb2k76mp1iuc1ipveqzwkpxb.lepiter ├── 1qe04zoah85cojlech7w4bs43.lepiter ├── 1qe04zpa015wigdwwv2a4sraq.lepiter ├── 1qe04zsshzg9n8c5jgg3blybe.lepiter ├── 21abculpoq2ulcr32c99tmrze.lepiter ├── 23r6v6rde97xi1rh09h7ktwjj.lepiter ├── 27k6m51c8gca1rcd0zhxrcbh3.lepiter ├── 2r7m9a4njxu21tjb61eu0uk14.lepiter ├── 3epnh4oic6yehumiqky7u8m3r.lepiter ├── 3l27xbfxzqpgw8jfoswnvtr5f.lepiter ├── 3wgydbg80dfwrn8ltp8tnzmwq.lepiter ├── 3z4n36983emhllnn3dizcvoxz.lepiter ├── 3z4n36cq3wxyff1qwz0gd4t97.lepiter ├── 45a53kdvxcznhytyuniwltciu.lepiter ├── 48ihsnndxciajfvsleumzirk.lepiter ├── 4blardv7a65en1up3auvdj7yq.lepiter ├── 4db7150gmkgw4t6xh6kzrkj8m.lepiter ├── 4db7152chk5vpizwrmxkpvsqh.lepiter ├── 4db71554d417bap7drx5inkjy.lepiter ├── 4q8viqkvamexvmtrp6sefita2.lepiter ├── 6h5h7fu4a4vix5gl5p57s0s16.lepiter ├── 6jeofw4wusaen3scns3ubesn0.lepiter ├── 6l9qky4e9akrlizxa7kx22up4.lepiter ├── 6nz1ale1cugh1ekzq3gph602f.lepiter ├── 748hz1dcrnn7zrb9ld8qymj97.lepiter ├── 7ju60g50ncgv3bduboznmga0t.lepiter ├── 7oieyq9lxucgltg56c8e2g21q.lepiter ├── 7oieyqdcc71i3x5yhecy8b13t.lepiter ├── 7yr8o6o4z70ejfv9eqs3s615e.lepiter ├── 8qetpkmaitk2mnkysyi8dl02f.lepiter ├── 97325lutjbpdbrrq1ge9iixut.lepiter ├── 97325lvfc5upb0cn6mtyug272.lepiter ├── 9m4wnbxyvmx81463ym19jbvr2.lepiter ├── 9m4wnc0ywzqz8alpx4h9f1omc.lepiter ├── 9s3ooust2uhfkrkm68oid11ii.lepiter ├── a76m7k7lvew1fnzvw78pqeaxz.lepiter ├── ambazq0tycucl8oymwtqvu9n2.lepiter ├── bemmw9pjpy566mvtehal7mj69.lepiter ├── bpwm845q7mafqno9r2h34n1ms.lepiter ├── crsva4vsu07o298777iz1ngm5.lepiter ├── d1rxbaos7e30x3kiauexipyv7.lepiter ├── d4vdbw331d1r1n5l0hjqxuz08.lepiter ├── d988tmksre7zbpnhkkbjq06iv.lepiter ├── dqrb64mlcyfa99z20147hccm0.lepiter ├── dsdijxuuq5ibgwdfzxayd47a9.lepiter ├── dtgkzzo47exs7djhvpv16xv66.lepiter ├── dtgkzzsgdamz46njti3u7r1no.lepiter ├── duo76pot31v3zx8ali30phabc.lepiter ├── dx4uzcfvx710f79ajkkgjq1dj.lepiter ├── e0icd9zipxftiqskyfinyvp7y.lepiter ├── e66wrick5ute5pt5whuznknj4.lepiter ├── e66wrid53zjw7555u8weezpmd.lepiter ├── e66wrid5v46ftyy9f1gvnq6c1.lepiter ├── edphzvdu0zufpwzxzzr0vwmlq.lepiter ├── edphzvfg80qxuspu2uzefzf0v.lepiter ├── ee61j9bq1t5zrsionvov8p4ah.lepiter ├── eeuhoubq1enqrc33ndtqotx3h.lepiter ├── eeuhouc9pkdw24apyl6iuotbl.lepiter ├── eeuhoudt2yfyq3sy70p5fo4xt.lepiter ├── eeuhouh5jexm20g0zr49d8otj.lepiter ├── ep7y4q7576rbwsef8se1qp89x.lepiter ├── ep7y4qa8ypkj7mgff0xntrxi4.lepiter ├── evq4rfzogttoyq7rk0lafa662.lepiter ├── lepiter.properties ├── lru75vl1pjomrldom3anobkn.lepiter ├── lru75zh6m921ytp6lrqfurd5.lepiter ├── mkxlhwmz21nz482hklx091hf.lepiter ├── msy4vumofomuwnp3uexdt634.lepiter ├── msy4vyizwljhe1awv1pqxz1a.lepiter ├── nbuihxv6ryjx7wb5kg9gavzl.lepiter ├── q2ov0b2xscjtwg4jf3mzgx1b.lepiter ├── wyqumk8osgn8uzsbbel04wvs.lepiter └── zexnrro622xyay877kcqdigu.lepiter ├── html ├── assets │ ├── css │ │ └── leibniz.css │ └── fonts │ │ ├── JuliaMono-Bold.woff2 │ │ ├── JuliaMono-BoldItalic.woff2 │ │ ├── JuliaMono-Regular.woff2 │ │ └── JuliaMono-RegularItalic.woff2 ├── page-template.html └── single-page-template.html ├── leibniz-installation-1.png ├── leibniz-installation-2.png ├── leibniz-installation-3.png ├── leibniz-installation-4.png └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | documentation/**.bak 2 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | { 2 | 'srcDirectory' : '' 3 | } -------------------------------------------------------------------------------- /.properties: -------------------------------------------------------------------------------- 1 | { 2 | #format : #tonel 3 | } -------------------------------------------------------------------------------- /BaselineOfLeibniz/BaselineOfLeibniz.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #BaselineOfLeibniz, 3 | #superclass : #BaselineOf, 4 | #category : #BaselineOfLeibniz 5 | } 6 | 7 | { #category : #baseline } 8 | BaselineOfLeibniz >> baseline: spec [ 9 | 10 | 11 | spec for: #common do: [ 12 | 13 | spec 14 | baseline: 'PetitParser2' 15 | with: [ spec repository: 'github://kursjan/petitparser2:master/src' ]. 16 | 17 | spec 18 | baseline: 'XMLParser' 19 | with: [ spec repository: 'github://pharo-contributions/XML-XMLParser/src' ]. 20 | 21 | spec 22 | baseline: 'RecursiveWriteBarrier' 23 | with: [ spec repository: 'github://khinsen/RecursiveWriteBarrier:master/src' ]. 24 | 25 | spec 26 | baseline: 'EqualityThroughVariablesTrait' 27 | with: [ spec repository: 'github://khinsen/EqualityThroughVariablesTrait:master/src' ]. 28 | 29 | spec 30 | package: 'Leibniz' 31 | with: [ spec requires: #( 32 | 'RecursiveWriteBarrier' 33 | 'EqualityThroughVariablesTrait')]; 34 | package: 'BaselineOfLeibniz'. 35 | 36 | ] 37 | ] 38 | -------------------------------------------------------------------------------- /BaselineOfLeibniz/package.st: -------------------------------------------------------------------------------- 1 | Package { #name : #BaselineOfLeibniz } 2 | -------------------------------------------------------------------------------- /BaselineOfLeibniz1ForGToolkit/BaselineOfLeibniz1ForGToolkit.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #BaselineOfLeibniz1ForGToolkit, 3 | #superclass : #BaselineOf, 4 | #category : #BaselineOfLeibniz1ForGToolkit 5 | } 6 | 7 | { #category : #baseline } 8 | BaselineOfLeibniz1ForGToolkit >> baseline: spec [ 9 | 10 | 11 | spec for: #common do: [ 12 | 13 | spec postLoadDoIt: #'postload:package:'. 14 | 15 | spec 16 | baseline: 'RecursiveWriteBarrier' 17 | with: [ spec repository: 'github://khinsen/RecursiveWriteBarrier:master/src' ]. 18 | 19 | spec 20 | baseline: 'EqualityThroughVariablesTrait' 21 | with: [ spec repository: 'github://khinsen/EqualityThroughVariablesTrait:master/src' ]. 22 | 23 | spec 24 | baseline: 'SingletonTrait' 25 | with: [ spec repository: 'github://khinsen/SingletonTrait:master' ]. 26 | 27 | spec 28 | package: 'Leibniz1' 29 | with: [ spec requires: 30 | #('RecursiveWriteBarrier' 31 | 'EqualityThroughVariablesTrait' 32 | 'SingletonTrait') ]. 33 | 34 | ] 35 | ] 36 | 37 | { #category : #baseline } 38 | BaselineOfLeibniz1ForGToolkit >> postload: loader package: packageSpec [ 39 | LbCodeFont chooseDefaultFamily 40 | ] 41 | -------------------------------------------------------------------------------- /BaselineOfLeibniz1ForGToolkit/package.st: -------------------------------------------------------------------------------- 1 | Package { #name : #BaselineOfLeibniz1ForGToolkit } 2 | -------------------------------------------------------------------------------- /BaselineOfLeibnizForGToolkit/package.st: -------------------------------------------------------------------------------- 1 | Package { #name : #BaselineOfLeibnizForGToolkit } 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Konrad Hinsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Leibniz/Float.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Float } 2 | 3 | { #category : #'*Leibniz' } 4 | Float >> lbAtomicTermClass [ 5 | ^ LbFPNumberTerm 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz/Fraction.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Fraction } 2 | 3 | { #category : #'*Leibniz' } 4 | Fraction >> lbAtomicTermClass [ 5 | ^ LbRationalNumberTerm 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz/GtHome.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtHome } 2 | 3 | { #category : #'*Leibniz' } 4 | GtHome >> leibnizSection [ 5 | 6 | ^ LzGtHomeSection new 7 | priority: 11 8 | ] 9 | -------------------------------------------------------------------------------- /Leibniz/GtPhlowColumnedListView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowColumnedListView } 2 | 3 | { #category : #'*Leibniz' } 4 | GtPhlowColumnedListView >> column: aTitleString lbCode: aBlock [ 5 | "A variant of column:text: that uses 6 | an appropriate Unicode font for Leibniz code" 7 | self column: aTitleString do: [ :aColumn | 8 | aColumn cellStencil: LbCodeFont brLabelCellStencil; 9 | dataBinder: [ :eachLabel :eachItem | 10 | eachLabel text: (aBlock value: eachItem) ] ] 11 | ] 12 | 13 | { #category : #'*Leibniz' } 14 | GtPhlowColumnedListView >> column: aTitleString lbCode: aBlock weight: aNumber [ 15 | "A variant of column:text: that uses 16 | an appropriate Unicode font for Leibniz code" 17 | self column: aTitleString do: [ :aColumn | 18 | aColumn cellStencil: LbCodeFont brLabelCellStencil; 19 | dataBinder: [ :eachLabel :eachItem | 20 | eachLabel text: (aBlock value: eachItem) ]; 21 | weight: aNumber ] 22 | ] 23 | -------------------------------------------------------------------------------- /Leibniz/GtPhlowColumnedTreeView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowColumnedTreeView } 2 | 3 | { #category : #'*Leibniz' } 4 | GtPhlowColumnedTreeView >> column: aTitleString lbCode: aBlock [ 5 | "A variant of column:text: that uses 6 | an appropriate Unicode font for Leibniz code" 7 | self column: aTitleString do: [ :aColumn | 8 | aColumn cellStencil: LbCodeFont brLabelCellStencil; 9 | dataBinder: [ :eachLabel :eachItem | 10 | eachLabel text: (aBlock value: eachItem) ] ] 11 | ] 12 | 13 | { #category : #'*Leibniz' } 14 | GtPhlowColumnedTreeView >> column: aTitleString lbCode: aBlock weight: aNumber [ 15 | "A variant of column:text: that uses 16 | an appropriate Unicode font for Leibniz code" 17 | self column: aTitleString do: [ :aColumn | 18 | aColumn cellStencil: LbCodeFont brLabelCellStencil; 19 | dataBinder: [ :eachLabel :eachItem | 20 | eachLabel text: (aBlock value: eachItem) ]; 21 | weight: aNumber ] 22 | ] 23 | -------------------------------------------------------------------------------- /Leibniz/GtPhlowListView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowListView } 2 | 3 | { #category : #'*Leibniz' } 4 | GtPhlowListView >> itemLbCode: aBlockOrSymbol [ 5 | "Variant of itemText: that uses an appropriate Unicode font for Leibniz code" 6 | self itemText: aBlockOrSymbol. 7 | self itemStencil: LbCodeFont brLabelCellStencil 8 | ] 9 | -------------------------------------------------------------------------------- /Leibniz/GtPhlowProtoView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowProtoView } 2 | 3 | { #category : #'*Leibniz' } 4 | GtPhlowProtoView >> lbColumnedTree [ 5 | ^ LbPhlowColumnedTreeView new 6 | originalView: self; 7 | definingMethod: (GtPhlowDefiningMethodsCollector new 8 | stack: thisContext stack; 9 | collect) 10 | ] 11 | 12 | { #category : #'*Leibniz' } 13 | GtPhlowProtoView >> lbTree [ 14 | ^ LbPhlowTreeView new 15 | originalView: self; 16 | definingMethod: (GtPhlowDefiningMethodsCollector new 17 | stack: thisContext stack; 18 | collect) 19 | ] 20 | -------------------------------------------------------------------------------- /Leibniz/GtPhlowTreeView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowTreeView } 2 | 3 | { #category : #'*Leibniz' } 4 | GtPhlowTreeView >> itemLbCode: aBlockOrSymbol [ 5 | "Variant of itemText: that uses an appropriate Unicode font for Leibniz code" 6 | self itemText: aBlockOrSymbol. 7 | self itemStencil: LbCodeFont brLabelCellStencil 8 | ] 9 | -------------------------------------------------------------------------------- /Leibniz/Integer.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Integer } 2 | 3 | { #category : #'*Leibniz' } 4 | Integer >> lbAtomicTermClass [ 5 | ^ LbIntegerTerm 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz/LbAxiom.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbAxiom, 3 | #superclass : #Object, 4 | #traits : 'EqualityThroughVariables', 5 | #classTraits : 'EqualityThroughVariables classTrait', 6 | #instVars : [ 7 | 'variables', 8 | 'signature' 9 | ], 10 | #category : 'Leibniz-5-Axioms' 11 | } 12 | 13 | { #category : #converting } 14 | LbAxiom >> asLeibnizSyntaxString [ 15 | ^ String streamContents: [ :s | self printAsLeibnizSyntaxOn: s ] 16 | ] 17 | 18 | { #category : #copying } 19 | LbAxiom >> copy [ 20 | ^ self 21 | ] 22 | 23 | { #category : #copying } 24 | LbAxiom >> deepCopy [ 25 | ^ self 26 | ] 27 | 28 | { #category : #printing } 29 | LbAxiom >> printAsLeibnizSyntaxOn: aStream [ 30 | self subclassResponsibility 31 | ] 32 | 33 | { #category : #accessing } 34 | LbAxiom >> printOn: aStream [ 35 | super printOn: aStream. 36 | aStream nextPut: $(. 37 | self printAsLeibnizSyntaxOn: aStream. 38 | aStream nextPut: $) 39 | ] 40 | 41 | { #category : #printing } 42 | LbAxiom >> printVariablesAsLeibnizSyntaxOn: aStream [ 43 | variables keysAndValuesDo: 44 | [ :var :sort | 45 | aStream nextPutAll: '∀ '. 46 | aStream nextPutAll: var asSymbol. 47 | aStream nextPut: $:. 48 | aStream nextPutAll: sort name. 49 | aStream nextPutAll: ' '] 50 | ] 51 | -------------------------------------------------------------------------------- /Leibniz/LbAxiomBuilder.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbAxiomBuilder, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'signature', 6 | 'axioms' 7 | ], 8 | #category : 'Leibniz-5-Axioms' 9 | } 10 | 11 | { #category : #'instance creation' } 12 | LbAxiomBuilder class >> signature: aSignature [ 13 | ^ self basicNew 14 | initializeWithSignature: aSignature; 15 | yourself 16 | ] 17 | 18 | { #category : #adding } 19 | LbAxiomBuilder >> add: anAxiom [ 20 | (axioms at: anAxiom class name) 21 | add: anAxiom 22 | ] 23 | 24 | { #category : #accessing } 25 | LbAxiomBuilder >> addAxioms: anLbAxioms origin: aContext [ 26 | anLbAxioms declarations do: [ :eachList | 27 | eachList do: [ :eachDecl | 28 | self parseAndAdd: eachDecl ] ] 29 | ] 30 | 31 | { #category : #accessing } 32 | LbAxiomBuilder >> axioms [ 33 | ^ LbAxioms 34 | signature: signature 35 | axioms: axioms deepCopy 36 | ] 37 | 38 | { #category : #initialization } 39 | LbAxiomBuilder >> initializeWithSignature: aSignature [ 40 | signature := aSignature. 41 | axioms := Dictionary new. 42 | LbAxiom subclasses do: [ :each | 43 | axioms at: each name put: Set new ] 44 | ] 45 | 46 | { #category : #adding } 47 | LbAxiomBuilder >> parseAndAdd: aString [ 48 | | parsedAxiom axiom | 49 | parsedAxiom := (LbParser newStartingAt: #axiom) 50 | parse: aString. 51 | parsedAxiom isPetit2Failure ifTrue: 52 | [ self error: parsedAxiom message, ' after "', 53 | (aString sliceFrom: 1 to: parsedAxiom position), '"' ]. 54 | axiom := parsedAxiom value: signature. 55 | self add: axiom. 56 | ] 57 | -------------------------------------------------------------------------------- /Leibniz/LbAxiomExamples.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbAxiomExamples, 3 | #superclass : #Object, 4 | #traits : 'TGtExampleAssertable', 5 | #classTraits : 'TGtExampleAssertable classTrait', 6 | #category : 'Leibniz-5-Axioms' 7 | } 8 | 9 | { #category : #example } 10 | LbAxiomExamples >> equalityAxioms [ 11 | 12 | ^ (LbAxiomBuilder signature: LbBuiltinSignatures integerSignature) 13 | parseAndAdd: '∀ X:zero abs(X) = 0'; 14 | parseAndAdd: '∀ X:ℤ abs(X) = 0 | X == 0'; 15 | parseAndAdd: '2 + 2 = 4'; 16 | parseAndAdd: '2 < 3 = true'; 17 | axioms 18 | ] 19 | 20 | { #category : #example } 21 | LbAxiomExamples >> mixedAxioms [ 22 | 23 | ^ (LbAxiomBuilder signature: self sortSignature) 24 | parseAndAdd: 'foo ⊆ bar'; 25 | parseAndAdd: '∀ S:sort foo(S) ⊆ bar(S)'; 26 | parseAndAdd: '∀ S:sort foo(S) = bar(S)'; 27 | parseAndAdd: 'foo = bar'; 28 | axioms 29 | ] 30 | 31 | { #category : #example } 32 | LbAxiomExamples >> sortSignature [ 33 | 34 | ^ (LbSignatureBuilder sortGraph: self sortSortGraph) 35 | parseAndAddOp: 'foo : sort'; 36 | parseAndAddOp: 'bar : sort'; 37 | parseAndAddOp: 'foo(sort) : sort'; 38 | parseAndAddOp: 'bar(sort) : sort'; 39 | parseAndAddOp: 'foo(sort, sort) : sort'; 40 | parseAndAddOp: 'bar(sort, sort) : sort'; 41 | signature 42 | ] 43 | 44 | { #category : #example } 45 | LbAxiomExamples >> sortSortGraph [ 46 | 47 | ^ LbSortGraphBuilder new 48 | parseAndAdd: 'sort'; 49 | sortGraph 50 | ] 51 | 52 | { #category : #example } 53 | LbAxiomExamples >> subsortAxioms [ 54 | 55 | | axioms | 56 | axioms := (LbAxiomBuilder signature: self sortSignature) 57 | parseAndAdd: 'foo ⊆ bar'; 58 | parseAndAdd: '∀ S:sort foo(S) ⊆ bar(S)'; 59 | parseAndAdd: '∀ S:sort foo(S, S) ⊆ bar(S, S)'; 60 | axioms. 61 | self 62 | assert: (axioms subsortAxioms select: #isTotal) size 63 | equals: 2. 64 | ^ axioms 65 | ] 66 | -------------------------------------------------------------------------------- /Leibniz/LbBooleanTerm.class.st: -------------------------------------------------------------------------------- 1 | " 2 | I am a convenience constructor for creating boolean terms from Pharo code 3 | " 4 | Class { 5 | #name : #LbBooleanTerm, 6 | #superclass : #LbOpTerm, 7 | #category : 'Leibniz-3-Terms' 8 | } 9 | 10 | { #category : #'instance creation' } 11 | LbBooleanTerm class >> value: aBoolean signature: aSignature [ 12 | ^ LbOpTerm 13 | name: (LbPrefixOperatorName for: 14 | (aBoolean ifTrue: [ #true ] ifFalse: [ #false ])) 15 | args: Array new 16 | sort: (aSignature sortNamed: #boolean) 17 | signature: aSignature 18 | ] 19 | -------------------------------------------------------------------------------- /Leibniz/LbBracketOperatorName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbBracketOperatorName, 3 | #superclass : #LbOperatorName, 4 | #category : 'Leibniz-2-Signatures' 5 | } 6 | 7 | { #category : #initializing } 8 | LbBracketOperatorName >> initialize [ 9 | internalSymbol := #'[]' 10 | ] 11 | 12 | { #category : #printing } 13 | LbBracketOperatorName >> printForArgs: aTermArray on: aStream [ 14 | self assert: aTermArray size > 1. 15 | aTermArray first 16 | printAsLeibnizSyntaxOn: aStream 17 | parenthesized: aTermArray first isInfix. 18 | aStream nextPutAll: '['. 19 | aTermArray allButFirst allButLast do: [ : each | 20 | each printAsLeibnizSyntaxOn: aStream. 21 | aStream nextPutAll: ', ' ]. 22 | aTermArray last printAsLeibnizSyntaxOn: aStream. 23 | aStream nextPutAll: ']' 24 | ] 25 | 26 | { #category : #printing } 27 | LbBracketOperatorName >> printForArity: anArity on: aStream [ 28 | self assert: anArity size > 1. 29 | anArity first printAsLeibnizSyntaxOn: aStream. 30 | aStream nextPutAll: '['. 31 | anArity allButFirst allButLast do: [ : each | 32 | each printAsLeibnizSyntaxOn: aStream. 33 | aStream nextPutAll: ', ' ]. 34 | anArity last printAsLeibnizSyntaxOn: aStream. 35 | aStream nextPutAll: ']' 36 | ] 37 | 38 | { #category : #printing } 39 | LbBracketOperatorName >> synopsis [ 40 | ^ '•[• ...]' 41 | ] 42 | -------------------------------------------------------------------------------- /Leibniz/LbBuiltinContexts.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbBuiltinContexts, 3 | #superclass : #Object, 4 | #category : 'Leibniz-6-Contexts' 5 | } 6 | 7 | { #category : #builtins } 8 | LbBuiltinContexts class >> fpNumberContext [ 9 | 10 | ^ LbContext 11 | name: 'IEEE-floating-point' 12 | signature: (LbBuiltinSignatures fpNumberSignature) 13 | rewriteSystem: (LbBuiltinRewriteSystems fpNumberRewriteSystem) 14 | ] 15 | 16 | { #category : #builtins } 17 | LbBuiltinContexts class >> integerContext [ 18 | 19 | ^ LbContext 20 | name: 'integers' 21 | signature: (LbBuiltinSignatures integerSignature) 22 | rewriteSystem: (LbBuiltinRewriteSystems integerRewriteSystem) 23 | ] 24 | 25 | { #category : #builtins } 26 | LbBuiltinContexts class >> rationalNumberContext [ 27 | 28 | ^ LbContext 29 | name: 'rational-numbers' 30 | signature: (LbBuiltinSignatures rationalNumberSignature) 31 | rewriteSystem: (LbBuiltinRewriteSystems rationalNumberRewriteSystem) 32 | ] 33 | 34 | { #category : #builtins } 35 | LbBuiltinContexts class >> realNumberContext [ 36 | 37 | ^ LbContext 38 | name: 'real-numbers' 39 | signature: (LbBuiltinSignatures realNumberSignature) 40 | rewriteSystem: (LbBuiltinRewriteSystems realNumberRewriteSystem) 41 | ] 42 | 43 | { #category : #builtins } 44 | LbBuiltinContexts class >> stringContext [ 45 | 46 | ^ (LbContextBuilder name: 'strings') 47 | parseAndAddSort: 'string'; 48 | addBuiltin: #strings; 49 | parseAndAddOp: 'string + string : string'; 50 | context 51 | ] 52 | 53 | { #category : #builtins } 54 | LbBuiltinContexts class >> truthContext [ 55 | 56 | ^ (LbContextBuilder name: 'truth') 57 | parseAndAddSort: 'boolean'; 58 | addBuiltin: #truth; 59 | parseAndAddOp: 'true : boolean'; 60 | parseAndAddOp: 'false : boolean'; 61 | context 62 | ] 63 | -------------------------------------------------------------------------------- /Leibniz/LbCodeFont.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbCodeFont, 3 | #superclass : #Object, 4 | #classVars : [ 5 | 'DefaultFamily' 6 | ], 7 | #category : 'Leibniz-0-Infrastructure' 8 | } 9 | 10 | { #category : #inspecting } 11 | LbCodeFont class >> brLabelCellStencil [ 12 | 13 | ^ [ 14 | BrLabel new 15 | aptitude: (BrGlamorousLabelLook new fontName: self defaultFamily); 16 | alignCenterLeft; 17 | hMatchParent; 18 | vFitContent ] 19 | ] 20 | 21 | { #category : #acccessing } 22 | LbCodeFont class >> brLabelFor: aString [ 23 | ^ LbCodeFont brLabelCellStencil value 24 | text: aString asRopedText; 25 | yourself 26 | ] 27 | 28 | { #category : #selecting } 29 | LbCodeFont class >> chooseDefaultFamily [ 30 | | availableFamilies | 31 | availableFamilies := SkiaFontManager default familyNames. 32 | #('JuliaMono' 'Arial Unicode MS') do: [ :family | 33 | (availableFamilies includes: family) 34 | ifTrue: [ DefaultFamily := family. ^ self] ]. 35 | self error: 'No suitable Unicode font for Leibniz code' 36 | ] 37 | 38 | { #category : #accessing } 39 | LbCodeFont class >> defaultFamily [ 40 | ^ DefaultFamily 41 | ] 42 | -------------------------------------------------------------------------------- /Leibniz/LbContextTerm.class.st: -------------------------------------------------------------------------------- 1 | " 2 | I represent a context term in context 'contexts' 3 | " 4 | Class { 5 | #name : #LbContextTerm, 6 | #superclass : #LbAtomicTerm, 7 | #category : 'Leibniz-3-Terms' 8 | } 9 | 10 | { #category : #private } 11 | LbContextTerm class >> requiredBuiltin [ 12 | ^ #contexts 13 | ] 14 | 15 | { #category : #accessing } 16 | LbContextTerm >> sortSymbol [ 17 | ^ #context 18 | ] 19 | -------------------------------------------------------------------------------- /Leibniz/LbDArityPair.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbDArityPair, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'sortGraph', 6 | 'arity1', 7 | 'arity2' 8 | ], 9 | #category : 'Leibniz-7-DependentSorts' 10 | } 11 | 12 | { #category : #'instance creation' } 13 | LbDArityPair class >> arity1: arity1 arity2: arity2 [ 14 | ^ self basicNew 15 | initializeWithArity1: arity1 arity2: arity2; 16 | yourself 17 | ] 18 | 19 | { #category : #initialization } 20 | LbDArityPair >> initializeWithArity1: anArity arity2: anotherArity [ 21 | sortGraph := anArity sortGraph. 22 | self assert: sortGraph equals: anotherArity sortGraph. 23 | arity1 := anArity. 24 | arity2 := anotherArity. 25 | ] 26 | -------------------------------------------------------------------------------- /Leibniz/LbDKindArity.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbDKindArity, 3 | #superclass : #Array, 4 | #type : #variable, 5 | #traits : 'EqualityThroughVariables', 6 | #classTraits : 'EqualityThroughVariables classTrait', 7 | #instVars : [ 8 | 'sortGraph' 9 | ], 10 | #category : 'Leibniz-7-DependentSorts' 11 | } 12 | 13 | { #category : #'instance creation' } 14 | LbDKindArity class >> sortGraph: aSortGraph kinds: anArray [ 15 | ^(self basicNew: anArray size) 16 | initializeWithSortGraph: aSortGraph kinds: anArray; 17 | yourself 18 | ] 19 | 20 | { #category : #initialization } 21 | LbDKindArity >> initializeWithSortGraph: aSortGraph kinds: anArray [ 22 | sortGraph := aSortGraph. 23 | anArray collect: [ :s | s ] into: self. 24 | self do: [ :each | self assert: each sortGraph = sortGraph ]. 25 | self beRecursivelyReadOnlyObject 26 | ] 27 | 28 | { #category : #printing } 29 | LbDKindArity >> printAsLeibnizSyntaxOn: aStream [ 30 | self 31 | do: [ :each | each printAsLeibnizSyntaxOn: aStream ] 32 | separatedBy: [ aStream nextPutAll: ', ' ] 33 | ] 34 | 35 | { #category : #enumerating } 36 | LbDKindArity >> withUniversalVariantsDo: aBlock [ 37 | | universal | 38 | self ifEmpty: [ aBlock value: self. ^ self ]. 39 | universal := (LbDSortFamily anySortInSortGraph: sortGraph) kind. 40 | #(false true) asDigitsToPower: self size do: [ :eachSelection | 41 | | argKinds | 42 | argKinds := Array new: self size. 43 | 1 to: self size do: [ :index | 44 | argKinds at: index put: 45 | ((eachSelection at: index) 46 | ifTrue: [ universal ] 47 | ifFalse: [ self at: index ]) ]. 48 | aBlock value: (self class sortGraph: sortGraph kinds: argKinds) ] 49 | ] 50 | -------------------------------------------------------------------------------- /Leibniz/LbDSortFamily.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbDSortFamily, 3 | #superclass : #Object, 4 | #traits : 'EqualityThroughVariables', 5 | #classTraits : 'EqualityThroughVariables classTrait', 6 | #instVars : [ 7 | 'opName', 8 | 'argSorts', 9 | 'sortGraph' 10 | ], 11 | #category : 'Leibniz-7-DependentSorts' 12 | } 13 | 14 | { #category : #'instance creation' } 15 | LbDSortFamily class >> anySortInSortGraph: aSortGraph [ 16 | ^ LbDSortUniversalFamily basicNew 17 | initializeWithSortGraph: aSortGraph; 18 | yourself 19 | ] 20 | 21 | { #category : #'instance creation' } 22 | LbDSortFamily class >> sortGraph: aSortGraph sortOp: anLbOperator [ 23 | ^ LbDSortSpecificFamily basicNew 24 | initializeWithSortGraph: aSortGraph sortOp: anLbOperator; 25 | yourself 26 | ] 27 | 28 | { #category : #converting } 29 | LbDSortFamily >> asLeibnizSyntaxString [ 30 | self subclassResponsibility 31 | ] 32 | 33 | { #category : #inspecting } 34 | LbDSortFamily >> gtGraphFor: aView [ 35 | 36 | | kind | 37 | kind := self kind. 38 | ^ sortGraph 39 | graphFor: aView 40 | restrictedTo: kind asSet 41 | highlight: [ :sort | sort = self ] 42 | ] 43 | 44 | { #category : #lookup } 45 | LbDSortFamily >> kind [ 46 | ^ sortGraph kindOf: self 47 | ] 48 | -------------------------------------------------------------------------------- /Leibniz/LbDSortSpecificFamily.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbDSortSpecificFamily, 3 | #superclass : #LbDSortFamily, 4 | #category : 'Leibniz-7-DependentSorts' 5 | } 6 | 7 | { #category : #converting } 8 | LbDSortSpecificFamily >> asLeibnizSyntaxString [ 9 | ^ String streamContents: [ :s | opName printForArity: argSorts on: s ] 10 | ] 11 | 12 | { #category : #initialization } 13 | LbDSortSpecificFamily >> initializeWithSortGraph: aSortGraph sortOp: anLbOperator [ 14 | self assert: anLbOperator size equals: 1. 15 | sortGraph := aSortGraph. 16 | opName := anLbOperator name. 17 | anLbOperator withRanksDo: [ :arity :sort | argSorts := arity ] 18 | ] 19 | 20 | { #category : #printing } 21 | LbDSortSpecificFamily >> printOn: aStream [ 22 | super printOn: aStream. 23 | aStream nextPut: $(. 24 | opName printForArity: argSorts on: aStream. 25 | aStream nextPut: $) 26 | ] 27 | -------------------------------------------------------------------------------- /Leibniz/LbDSortUniversalFamily.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbDSortUniversalFamily, 3 | #superclass : #LbDSortFamily, 4 | #category : 'Leibniz-7-DependentSorts' 5 | } 6 | 7 | { #category : #converting } 8 | LbDSortUniversalFamily >> asLeibnizSyntaxString [ 9 | ^ '*' 10 | ] 11 | 12 | { #category : #initialization } 13 | LbDSortUniversalFamily >> initializeWithSortGraph: aSortGraph [ 14 | sortGraph := aSortGraph 15 | ] 16 | 17 | { #category : #printing } 18 | LbDSortUniversalFamily >> printOn: aStream [ 19 | super printOn: aStream 20 | ] 21 | -------------------------------------------------------------------------------- /Leibniz/LbFPNumberTerm.class.st: -------------------------------------------------------------------------------- 1 | " 2 | I represent a double-precision float in context 'IEEE-floating-point'. 3 | " 4 | Class { 5 | #name : #LbFPNumberTerm, 6 | #superclass : #LbAtomicTerm, 7 | #category : 'Leibniz-3-Terms' 8 | } 9 | 10 | { #category : #private } 11 | LbFPNumberTerm class >> requiredBuiltin [ 12 | ^ #fpNumbers 13 | ] 14 | 15 | { #category : #accessing } 16 | LbFPNumberTerm >> sortSymbol [ 17 | value isNaN ifTrue: [ ^ #'FP64.NaN' ]. 18 | value isInfinite ifTrue: [ ^ #'FP64.inf' ]. 19 | ^ #'FP64.number' 20 | ] 21 | -------------------------------------------------------------------------------- /Leibniz/LbFakeSignatureForSortParser.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbFakeSignatureForSortParser, 3 | #superclass : #Object, 4 | #category : 'Leibniz-1-SortGraphs' 5 | } 6 | 7 | { #category : #accessing } 8 | LbFakeSignatureForSortParser >> zeroArgTermNamed: anOpName extraVariables: aDictionary [ 9 | self assert: aDictionary isEmpty. 10 | ^ anOpName asSymbol 11 | ] 12 | -------------------------------------------------------------------------------- /Leibniz/LbGrammarRulesAndAxioms.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbGrammarRulesAndAxioms, 3 | #superclass : #LbGrammarSignaturesAndTerms, 4 | #instVars : [ 5 | 'conditionClause', 6 | 'code', 7 | 'equalityAxiom', 8 | 'subsortAxiom', 9 | 'rewriteRule', 10 | 'fnRule' 11 | ], 12 | #category : 'Leibniz-0-Infrastructure' 13 | } 14 | 15 | { #category : #axioms } 16 | LbGrammarRulesAndAxioms >> axiom [ 17 | ^ (equalityAxiom / subsortAxiom) end 18 | ] 19 | 20 | { #category : #rules } 21 | LbGrammarRulesAndAxioms >> code [ 22 | ^ $' asPParser , $' asPParser negate star flatten, $' asPParser, $: asPParser, identifier 23 | ] 24 | 25 | { #category : #clauses } 26 | LbGrammarRulesAndAxioms >> conditionClause [ 27 | ^ conditionSymbol trim, term 28 | ] 29 | 30 | { #category : #axioms } 31 | LbGrammarRulesAndAxioms >> equalityAxiom [ 32 | ^ forAllClause star trim, term, equalSign trim, term, conditionClause optional 33 | ] 34 | 35 | { #category : #accessing } 36 | LbGrammarRulesAndAxioms >> fnRule [ 37 | ^ forAllClause star trim, term, fnArrow trim, code, conditionClause optional 38 | ] 39 | 40 | { #category : #rules } 41 | LbGrammarRulesAndAxioms >> rewriteRule [ 42 | ^ forAllClause star trim, term, rewriteArrow trim, term, conditionClause optional 43 | ] 44 | 45 | { #category : #rules } 46 | LbGrammarRulesAndAxioms >> rule [ 47 | ^ (rewriteRule / fnRule) end 48 | ] 49 | 50 | { #category : #axioms } 51 | LbGrammarRulesAndAxioms >> subsortAxiom [ 52 | ^ forAllClause star trim, term, subsortSymbol trim, term 53 | ] 54 | -------------------------------------------------------------------------------- /Leibniz/LbInfixOperatorName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbInfixOperatorName, 3 | #superclass : #LbOperatorName, 4 | #category : 'Leibniz-2-Signatures' 5 | } 6 | 7 | { #category : #'instance creation' } 8 | LbInfixOperatorName class >> for: aStringOrSymbol [ 9 | ^ self new internalSymbol: '_', aStringOrSymbol 10 | ] 11 | 12 | { #category : #testing } 13 | LbInfixOperatorName >> isEqualityOp [ 14 | ^ internalSymbol = #'_==' 15 | ] 16 | 17 | { #category : #accessing } 18 | LbInfixOperatorName >> isInfix [ 19 | ^ true 20 | ] 21 | 22 | { #category : #accessing } 23 | LbInfixOperatorName >> isInfixOpOtherThan: anOpName [ 24 | ^ anOpName ~= self 25 | ] 26 | 27 | { #category : #printing } 28 | LbInfixOperatorName >> printForArgs: aTermArray on: aStream [ 29 | self assert: aTermArray size equals: 2. 30 | aTermArray first printAsFirstArgOfInfixTermWithOpName: self on: aStream. 31 | aStream nextPutAll: ' '. 32 | aStream nextPutAll: internalSymbol allButFirst. 33 | aStream nextPutAll: ' '. 34 | aTermArray second 35 | printAsLeibnizSyntaxOn: aStream 36 | parenthesized: aTermArray second isInfix 37 | ] 38 | 39 | { #category : #printing } 40 | LbInfixOperatorName >> printForArity: anArity on: aStream [ 41 | self assert: anArity size equals: 2. 42 | anArity first printAsLeibnizSyntaxOn: aStream. 43 | aStream nextPutAll: ' '. 44 | aStream nextPutAll: internalSymbol allButFirst. 45 | aStream nextPutAll: ' '. 46 | anArity second printAsLeibnizSyntaxOn: aStream. 47 | ] 48 | 49 | { #category : #printing } 50 | LbInfixOperatorName >> synopsis [ 51 | ^ '• ', internalSymbol allButFirst, ' •' 52 | ] 53 | -------------------------------------------------------------------------------- /Leibniz/LbIntegerTerm.class.st: -------------------------------------------------------------------------------- 1 | " 2 | I represent an integer in context 'integers'. 3 | " 4 | Class { 5 | #name : #LbIntegerTerm, 6 | #superclass : #LbRationalNumberTerm, 7 | #category : 'Leibniz-3-Terms' 8 | } 9 | 10 | { #category : #private } 11 | LbIntegerTerm class >> requiredBuiltin [ 12 | ^ #integers 13 | ] 14 | 15 | { #category : #'instance creation' } 16 | LbIntegerTerm class >> value: aNumber signature: aSignature [ 17 | aSignature assertBuiltin: self requiredBuiltin. 18 | ^ self basicNew 19 | initializeWithValue: aNumber signature: aSignature; 20 | yourself 21 | ] 22 | 23 | { #category : #acccessing } 24 | LbIntegerTerm >> sortSymbol [ 25 | value = 0 26 | ifTrue: [ ^ #zero ]. 27 | value positive 28 | ifTrue: [ ^ #'ℕ.nz' ] 29 | ifFalse: [ ^ #'ℤ.nz' ] 30 | ] 31 | -------------------------------------------------------------------------------- /Leibniz/LbPhlowColumnedTreeView.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbPhlowColumnedTreeView, 3 | #superclass : #GtPhlowColumnedTreeView, 4 | #instVars : [ 5 | 'initiallyExpandedRootNodes' 6 | ], 7 | #category : 'Leibniz-0-Infrastructure' 8 | } 9 | 10 | { #category : #'api - scripting tree node expansion' } 11 | LbPhlowColumnedTreeView >> expandItems: anArray [ 12 | initiallyExpandedRootNodes := anArray 13 | ] 14 | 15 | { #category : #'private - actions' } 16 | LbPhlowColumnedTreeView >> expandTree: aBrColumnedTree [ 17 | aBrColumnedTree collapseAll. 18 | aBrColumnedTree viewModel root childrenNodes do: [ :each | 19 | (initiallyExpandedRootNodes includes: each value) 20 | ifTrue: [ each expand ] ] 21 | ] 22 | -------------------------------------------------------------------------------- /Leibniz/LbPhlowTreeView.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbPhlowTreeView, 3 | #superclass : #GtPhlowTreeView, 4 | #instVars : [ 5 | 'initiallyExpandedRootNodes' 6 | ], 7 | #category : 'Leibniz-0-Infrastructure' 8 | } 9 | 10 | { #category : #'api - scripting tree node expansion' } 11 | LbPhlowTreeView >> expandItems: anArray [ 12 | initiallyExpandedRootNodes := anArray 13 | ] 14 | 15 | { #category : #'private - building' } 16 | LbPhlowTreeView >> expandTree: aBrTree [ 17 | aBrTree collapseAll. 18 | aBrTree viewModel root childrenNodes do: [ :each | 19 | (initiallyExpandedRootNodes includes: each value first) 20 | ifTrue: [ each expand ] ] 21 | ] 22 | -------------------------------------------------------------------------------- /Leibniz/LbPrefixOperatorName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbPrefixOperatorName, 3 | #superclass : #LbOperatorName, 4 | #category : 'Leibniz-2-Signatures' 5 | } 6 | 7 | { #category : #'instance creation' } 8 | LbPrefixOperatorName class >> for: aStringOrSymbol [ 9 | ^ self new internalSymbol: aStringOrSymbol 10 | ] 11 | 12 | { #category : #modifying } 13 | LbPrefixOperatorName >> addPrefix: aSymbol [ 14 | ^ LbPrefixOperatorName for: aSymbol, internalSymbol 15 | ] 16 | 17 | { #category : #printing } 18 | LbPrefixOperatorName >> printForArity: anArity on: aStream [ 19 | aStream nextPutAll: internalSymbol. 20 | anArity ifNotEmpty: [ 21 | aStream nextPut: $(. 22 | anArity allButLastDo: [ :each | 23 | each printAsLeibnizSyntaxOn: aStream. 24 | aStream nextPutAll: ', ' ]. 25 | anArity last printAsLeibnizSyntaxOn: aStream. 26 | aStream nextPut: $) ] 27 | ] 28 | -------------------------------------------------------------------------------- /Leibniz/LbPseudoOperatorName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbPseudoOperatorName, 3 | #superclass : #LbOperatorName, 4 | #category : 'Leibniz-2-Signatures' 5 | } 6 | 7 | { #category : #accessing } 8 | LbPseudoOperatorName class >> for: aStringOrSymbol [ 9 | ^ self new internalSymbol: aStringOrSymbol asSymbol 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz/LbRationalNumberTerm.class.st: -------------------------------------------------------------------------------- 1 | " 2 | I represent a rational number in context 'rational-numbers'. 3 | " 4 | Class { 5 | #name : #LbRationalNumberTerm, 6 | #superclass : #LbAtomicTerm, 7 | #category : 'Leibniz-3-Terms' 8 | } 9 | 10 | { #category : #private } 11 | LbRationalNumberTerm class >> requiredBuiltin [ 12 | ^ #rationalNumbers 13 | ] 14 | 15 | { #category : #'instance creation' } 16 | LbRationalNumberTerm class >> value: aNumber signature: aSignature [ 17 | aNumber isInteger 18 | ifTrue: [ 19 | ^ LbIntegerTerm value: aNumber signature: aSignature ] 20 | ifFalse: [ 21 | aSignature assertBuiltin: self requiredBuiltin. 22 | ^ self basicNew 23 | initializeWithValue: aNumber signature: aSignature; 24 | yourself ] 25 | ] 26 | 27 | { #category : #printing } 28 | LbRationalNumberTerm >> printAsLeibnizSyntaxOn: aStream [ 29 | "Remove the parentheses that Pharo adds around fractions." 30 | value isInteger 31 | ifTrue: [ value printOn: aStream ] 32 | ifFalse: [ aStream nextPutAll: value asString allButFirst allButLast ] 33 | 34 | ] 35 | 36 | { #category : #accessing } 37 | LbRationalNumberTerm >> sortSymbol [ 38 | value = 0 ifTrue: [ ^ #zero ]. 39 | value isInteger 40 | ifTrue: [ value positive 41 | ifTrue: [ ^ #'ℕ.nz' ] 42 | ifFalse: [ ^ #'ℤ.nz' ] ]. 43 | value positive 44 | ifTrue: [ ^ #'ℚ.p' ] 45 | ifFalse: [ ^ #'ℚ.nz' ]. 46 | ] 47 | -------------------------------------------------------------------------------- /Leibniz/LbReductionStep.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbReductionStep, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'initialTerm', 6 | 'finalTerm', 7 | 'rewriteSystem', 8 | 'argReductionSteps', 9 | 'termWithReducedArgs', 10 | 'rewriteStep' 11 | ], 12 | #category : 'Leibniz-4-Rules' 13 | } 14 | 15 | { #category : #accessing } 16 | LbReductionStep >> finalTerm [ 17 | ^ finalTerm 18 | ] 19 | 20 | { #category : #inspecting } 21 | LbReductionStep >> gtStepsFor: aView [ 22 | 23 | ^ aView columnedTree 24 | title: 'Steps'; 25 | priority: 0; 26 | items: [ argReductionSteps asOrderedCollection 27 | addLast: rewriteStep; 28 | yourself ]; 29 | children: #steps; 30 | column: 'Initial' lbCode: [ :each | 31 | each initialTerm asLeibnizSyntaxString ]; 32 | column: 'Final' lbCode: [ :each | 33 | each finalTerm asLeibnizSyntaxString ]; 34 | yourself 35 | ] 36 | 37 | { #category : #accessing } 38 | LbReductionStep >> initialTerm [ 39 | ^ initialTerm 40 | ] 41 | 42 | { #category : #testing } 43 | LbReductionStep >> isFinal [ 44 | ^ initialTerm = finalTerm 45 | ] 46 | 47 | { #category : #accessing } 48 | LbReductionStep >> rewriteSystem: aRewriteSystem [ 49 | rewriteSystem := aRewriteSystem 50 | ] 51 | 52 | { #category : #inspecting } 53 | LbReductionStep >> steps [ 54 | ^ #() 55 | ] 56 | 57 | { #category : #rewriting } 58 | LbReductionStep >> term: aTerm [ 59 | initialTerm := aTerm. 60 | argReductionSteps := aTerm arguments collect: [ :each | 61 | LbReductionSteps new 62 | rewriteSystem: rewriteSystem; 63 | term: each ]. 64 | termWithReducedArgs := 65 | aTerm withTransformedArgs: 66 | (argReductionSteps collect: [ :each | each finalTerm ]). 67 | finalTerm := rewriteSystem 68 | rewriteHeadOnce: termWithReducedArgs. 69 | rewriteStep := LbRewriteStep new 70 | rewriteSystem: rewriteSystem; 71 | initialTerm: termWithReducedArgs; 72 | finalTerm: finalTerm 73 | ] 74 | -------------------------------------------------------------------------------- /Leibniz/LbReductionSteps.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbReductionSteps, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'rewriteSystem', 6 | 'steps' 7 | ], 8 | #category : 'Leibniz-4-Rules' 9 | } 10 | 11 | { #category : #accessing } 12 | LbReductionSteps >> finalTerm [ 13 | ^ steps last finalTerm 14 | ] 15 | 16 | { #category : #accessing } 17 | LbReductionSteps >> gtStepsFor: aView [ 18 | 19 | ^ aView columnedList 20 | title: 'Steps' translated; 21 | priority: 0; 22 | items: [ steps ]; 23 | column: 'Initial' lbCode: [ :each | 24 | each initialTerm asLeibnizSyntaxString ]; 25 | column: 'Final' lbCode: [ :each | 26 | each finalTerm asLeibnizSyntaxString ]; 27 | yourself 28 | ] 29 | 30 | { #category : #accessing } 31 | LbReductionSteps >> initialTerm [ 32 | ^ steps first initialTerm 33 | ] 34 | 35 | { #category : #accessing } 36 | LbReductionSteps >> rewriteSystem: aRewriteSystem [ 37 | rewriteSystem := aRewriteSystem 38 | ] 39 | 40 | { #category : #accessing } 41 | LbReductionSteps >> steps [ 42 | ^ steps 43 | ] 44 | 45 | { #category : #rewriting } 46 | LbReductionSteps >> term: aTerm [ 47 | | step currentTerm | 48 | step := LbReductionStep new 49 | rewriteSystem: rewriteSystem; 50 | term: aTerm. 51 | currentTerm := step finalTerm. 52 | steps := OrderedCollection with: step. 53 | [ step isFinal ] whileFalse: [ 54 | step := LbReductionStep new 55 | rewriteSystem: rewriteSystem; 56 | term: currentTerm. 57 | currentTerm := step finalTerm. 58 | steps add: step ] 59 | ] 60 | -------------------------------------------------------------------------------- /Leibniz/LbRewriteFailure.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbRewriteFailure, 3 | #superclass : #Exception, 4 | #category : 'Leibniz-4-Rules' 5 | } 6 | 7 | { #category : #accessing } 8 | LbRewriteFailure >> defaultAction [ 9 | "The default action taken if the exception is signaled." 10 | 11 | UnhandledError signalForException: self 12 | ] 13 | -------------------------------------------------------------------------------- /Leibniz/LbRewriteStep.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbRewriteStep, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'finalTerm', 6 | 'initialTerm', 7 | 'rewriteSystem' 8 | ], 9 | #category : 'Leibniz-4-Rules' 10 | } 11 | 12 | { #category : #accessing } 13 | LbRewriteStep >> finalTerm [ 14 | ^ finalTerm 15 | ] 16 | 17 | { #category : #accessing } 18 | LbRewriteStep >> finalTerm: aTerm [ 19 | finalTerm := aTerm 20 | ] 21 | 22 | { #category : #accessing } 23 | LbRewriteStep >> gtRulesFor: aView [ 24 | 25 | ^ aView forward 26 | title: 'Matching rules'; 27 | priority: 0; 28 | object: [ rewriteSystem rulesMatching: initialTerm ]; 29 | view: #gtMatchesFor:; 30 | yourself 31 | ] 32 | 33 | { #category : #accessing } 34 | LbRewriteStep >> initialTerm [ 35 | ^ initialTerm 36 | ] 37 | 38 | { #category : #accessing } 39 | LbRewriteStep >> initialTerm: aTerm [ 40 | initialTerm := aTerm 41 | ] 42 | 43 | { #category : #accessing } 44 | LbRewriteStep >> rewriteSystem: aRewriteSystem [ 45 | rewriteSystem := aRewriteSystem 46 | ] 47 | 48 | { #category : #inspecting } 49 | LbRewriteStep >> steps [ 50 | ^ #() 51 | ] 52 | -------------------------------------------------------------------------------- /Leibniz/LbRewriteSystemBuilder.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbRewriteSystemBuilder, 3 | #superclass : #Object, 4 | #traits : 'EqualityThroughVariables', 5 | #classTraits : 'EqualityThroughVariables classTrait', 6 | #instVars : [ 7 | 'signature', 8 | 'rules' 9 | ], 10 | #category : 'Leibniz-4-Rules' 11 | } 12 | 13 | { #category : #'instance creation' } 14 | LbRewriteSystemBuilder class >> signature: aSignature [ 15 | ^self basicNew 16 | initializeWithSignature: aSignature; 17 | yourself. 18 | 19 | 20 | ] 21 | 22 | { #category : #adding } 23 | LbRewriteSystemBuilder >> addRewriteSystem: aRewriteSystem [ 24 | self addRewriteSystem: aRewriteSystem origin: nil 25 | ] 26 | 27 | { #category : #adding } 28 | LbRewriteSystemBuilder >> addRewriteSystem: aRewriteSystem origin: aContext [ 29 | aRewriteSystem rules keysAndValuesDo: [ :eachHeadOpName :eachRuleList | 30 | eachRuleList do: [ :each | 31 | self addRule: (each convertToSignature: signature) ] ] 32 | ] 33 | 34 | { #category : #adding } 35 | LbRewriteSystemBuilder >> addRule: aRule [ 36 | self assert: aRule signature equals: signature. 37 | (rules includes: aRule) ifFalse: [ rules add: aRule ] 38 | ] 39 | 40 | { #category : #inspecting } 41 | LbRewriteSystemBuilder >> gtRulesFor: aView [ 42 | 43 | ^ aView forward 44 | title: 'Rules'; 45 | priority: 0; 46 | object: [ self rewriteSystem ]; 47 | view: #gtRulesFor: 48 | ] 49 | 50 | { #category : #initialization } 51 | LbRewriteSystemBuilder >> initializeWithSignature: aSignature [ 52 | signature := aSignature. 53 | rules := OrderedCollection new. 54 | ] 55 | 56 | { #category : #adding } 57 | LbRewriteSystemBuilder >> parseAndAddRule: aString [ 58 | rules add: (signature parseRule: aString) 59 | ] 60 | 61 | { #category : #accessing } 62 | LbRewriteSystemBuilder >> rewriteSystem [ 63 | ^ LbRewriteSystem signature: signature rules: rules deepCopy. 64 | ] 65 | -------------------------------------------------------------------------------- /Leibniz/LbStringTerm.class.st: -------------------------------------------------------------------------------- 1 | " 2 | I represent a string in context 'strings'. 3 | " 4 | Class { 5 | #name : #LbStringTerm, 6 | #superclass : #LbAtomicTerm, 7 | #category : 'Leibniz-3-Terms' 8 | } 9 | 10 | { #category : #private } 11 | LbStringTerm class >> requiredBuiltin [ 12 | ^ #strings 13 | ] 14 | 15 | { #category : #printing } 16 | LbStringTerm >> printAsLeibnizSyntaxOn: aStream [ 17 | aStream nextPut: $". 18 | aStream nextPutAll: value. 19 | aStream nextPut: $". 20 | 21 | ] 22 | 23 | { #category : #accessing } 24 | LbStringTerm >> sortSymbol [ 25 | ^ #string 26 | ] 27 | -------------------------------------------------------------------------------- /Leibniz/LbSubscriptOperatorName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbSubscriptOperatorName, 3 | #superclass : #LbOperatorName, 4 | #category : 'Leibniz-2-Signatures' 5 | } 6 | 7 | { #category : #initializing } 8 | LbSubscriptOperatorName >> initialize [ 9 | internalSymbol := #'_' 10 | ] 11 | 12 | { #category : #printing } 13 | LbSubscriptOperatorName >> printForArgs: aTermArray on: aStream [ 14 | self assert: aTermArray size > 1. 15 | aTermArray first 16 | printAsLeibnizSyntaxOn: aStream 17 | parenthesized: aTermArray first isInfix. 18 | aStream nextPutAll: '_{'. 19 | aTermArray allButFirst allButLast do: [ : each | 20 | each printAsLeibnizSyntaxOn: aStream. 21 | aStream nextPutAll: ', ' ]. 22 | aTermArray last printAsLeibnizSyntaxOn: aStream. 23 | aStream nextPutAll: '}' 24 | ] 25 | 26 | { #category : #printing } 27 | LbSubscriptOperatorName >> printForArity: anArity on: aStream [ 28 | self assert: anArity size > 1. 29 | anArity first printAsLeibnizSyntaxOn: aStream. 30 | aStream nextPutAll: '_{'. 31 | anArity allButFirst allButLast do: [ : each | 32 | each printAsLeibnizSyntaxOn: aStream. 33 | aStream nextPutAll: ', ' ]. 34 | anArity last printAsLeibnizSyntaxOn: aStream. 35 | aStream nextPutAll: '}' 36 | ] 37 | 38 | { #category : #printing } 39 | LbSubscriptOperatorName >> synopsis [ 40 | ^ '•_{•}' 41 | ] 42 | -------------------------------------------------------------------------------- /Leibniz/LbSubsortRelation.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbSubsortRelation, 3 | #superclass : #Object, 4 | #traits : 'EqualityThroughVariables', 5 | #classTraits : 'EqualityThroughVariables classTrait', 6 | #instVars : [ 7 | 'subsort', 8 | 'supersort', 9 | 'origins' 10 | ], 11 | #category : 'Leibniz-1-SortGraphs' 12 | } 13 | 14 | { #category : #inspecting } 15 | LbSubsortRelation >> gtDeclarationFor: aView [ 16 | 17 | ^ aView explicit 18 | title: 'Declaration' translated; 19 | priority: 0; 20 | stencil: [ 21 | LbCodeFont brLabelCellStencil value 22 | text: self printString; 23 | padding: (BlInsets all: 5) ] 24 | ] 25 | 26 | { #category : #inspecting } 27 | LbSubsortRelation >> gtOriginsFor: aView [ 28 | 29 | origins ifNil: [ ^ aView empty ]. 30 | ^ aView forward 31 | title: 'Origins'; 32 | priority: 2; 33 | object: [ origins ]; 34 | view: #gtItemsFor:; 35 | yourself 36 | ] 37 | 38 | { #category : #testing } 39 | LbSubsortRelation >> isFromInclude [ 40 | ^ origins containsIncludes 41 | ] 42 | 43 | { #category : #accessing } 44 | LbSubsortRelation >> origins [ 45 | ^ origins 46 | ] 47 | 48 | { #category : #accessing } 49 | LbSubsortRelation >> printOn: aStream [ 50 | aStream nextPutAll: subsort name asString. 51 | aStream nextPutAll: ' ⊆ '. 52 | aStream nextPutAll: supersort name asString 53 | ] 54 | 55 | { #category : #accessing } 56 | LbSubsortRelation >> subsort [ 57 | ^ subsort 58 | ] 59 | 60 | { #category : #initialization } 61 | LbSubsortRelation >> subsort: sort1 supersort: sort2 origins: anLbOrigins [ 62 | subsort := sort1. 63 | supersort := sort2. 64 | origins := anLbOrigins 65 | ] 66 | 67 | { #category : #accessing } 68 | LbSubsortRelation >> supersort [ 69 | ^ supersort 70 | ] 71 | -------------------------------------------------------------------------------- /Leibniz/LbSuperscriptOperatorName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbSuperscriptOperatorName, 3 | #superclass : #LbOperatorName, 4 | #category : 'Leibniz-2-Signatures' 5 | } 6 | 7 | { #category : #initializing } 8 | LbSuperscriptOperatorName >> initialize [ 9 | internalSymbol := #'^' 10 | ] 11 | 12 | { #category : #printing } 13 | LbSuperscriptOperatorName >> printForArgs: aTermArray on: aStream [ 14 | self assert: aTermArray size > 1. 15 | aTermArray first 16 | printAsLeibnizSyntaxOn: aStream 17 | parenthesized: aTermArray first isInfix. 18 | aStream nextPutAll: '^{'. 19 | aTermArray allButFirst allButLast do: [ : each | 20 | each printAsLeibnizSyntaxOn: aStream. 21 | aStream nextPutAll: ', ' ]. 22 | aTermArray last printAsLeibnizSyntaxOn: aStream. 23 | aStream nextPutAll: '}' 24 | ] 25 | 26 | { #category : #printing } 27 | LbSuperscriptOperatorName >> printForArity: anArity on: aStream [ 28 | self assert: anArity size > 1. 29 | anArity first printAsLeibnizSyntaxOn: aStream. 30 | aStream nextPutAll: '^{'. 31 | anArity allButFirst allButLast do: [ : each | 32 | each printAsLeibnizSyntaxOn: aStream. 33 | aStream nextPutAll: ', ' ]. 34 | anArity last printAsLeibnizSyntaxOn: aStream. 35 | aStream nextPutAll: '}' 36 | ] 37 | 38 | { #category : #printing } 39 | LbSuperscriptOperatorName >> synopsis [ 40 | ^ '•^{•}' 41 | ] 42 | -------------------------------------------------------------------------------- /Leibniz/LbTaggedVariableName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LbTaggedVariableName, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'tag', 6 | 'name' 7 | ], 8 | #category : 'Leibniz-3-Terms' 9 | } 10 | 11 | { #category : #'instance creation' } 12 | LbTaggedVariableName class >> tag: aSymbolOrNil name: anLbOperatorName [ 13 | ^ aSymbolOrNil 14 | ifNil: [ anLbOperatorName ] 15 | ifNotNil: [ self new 16 | tag: aSymbolOrNil; 17 | name: anLbOperatorName; 18 | yourself ] 19 | ] 20 | 21 | { #category : #comparing } 22 | LbTaggedVariableName >> <= other [ 23 | ^ self asString <= other asString 24 | ] 25 | 26 | { #category : #comparing } 27 | LbTaggedVariableName >> = other [ 28 | ^ (self class = other class) 29 | and: [ (self tag = other tag) 30 | and: self name = other name ] 31 | ] 32 | 33 | { #category : #converting } 34 | LbTaggedVariableName >> asString [ 35 | ^ tag asString, '.', name asString 36 | ] 37 | 38 | { #category : #converting } 39 | LbTaggedVariableName >> asSymbol [ 40 | ^ self asString asSymbol 41 | ] 42 | 43 | { #category : #comparing } 44 | LbTaggedVariableName >> hash [ 45 | ^ tag hash bitXor: name hash 46 | ] 47 | 48 | { #category : #accessing } 49 | LbTaggedVariableName >> name [ 50 | ^ name 51 | ] 52 | 53 | { #category : #accessing } 54 | LbTaggedVariableName >> name: anLbOperatorName [ 55 | name := anLbOperatorName 56 | ] 57 | 58 | { #category : #printing } 59 | LbTaggedVariableName >> printOn: aStream [ 60 | super printOn: aStream. 61 | aStream nextPut: $(. 62 | tag printOn: aStream. 63 | aStream nextPut: $.. 64 | name printOn: aStream. 65 | aStream nextPut: $). 66 | ] 67 | 68 | { #category : #accessing } 69 | LbTaggedVariableName >> tag [ 70 | ^ tag 71 | ] 72 | 73 | { #category : #accessing } 74 | LbTaggedVariableName >> tag: aSymbol [ 75 | tag := aSymbol 76 | ] 77 | -------------------------------------------------------------------------------- /Leibniz/LbUniversalVarTerm.class.st: -------------------------------------------------------------------------------- 1 | " 2 | I represent a special Leibniz variable that matches terms of any sort. 3 | " 4 | Class { 5 | #name : #LbUniversalVarTerm, 6 | #superclass : #LbVarTerm, 7 | #category : 'Leibniz-3-Terms' 8 | } 9 | 10 | { #category : #'instance creation' } 11 | LbUniversalVarTerm class >> symbol: aSymbol signature: aSignature [ 12 | ^self basicNew 13 | initializeWithSymbol: aSymbol signature: aSignature; 14 | yourself 15 | ] 16 | 17 | { #category : #converting } 18 | LbUniversalVarTerm >> convertToSignature: aSignature extraVariables: aDictionary [ 19 | ^ self class symbol: name signature: aSignature 20 | ] 21 | 22 | { #category : #initialization } 23 | LbUniversalVarTerm >> initializeWithSymbol: aSymbol signature: aSignature [ 24 | name := aSymbol. 25 | signature := aSignature. 26 | sort := #boolean. 27 | ] 28 | -------------------------------------------------------------------------------- /Leibniz/LeibnizBuiltins.class.st: -------------------------------------------------------------------------------- 1 | " 2 | My unique instance is a special document that contains the built-in contexts of Leibniz. 3 | " 4 | Class { 5 | #name : #LeibnizBuiltins, 6 | #superclass : #LeibnizDocument, 7 | #category : 'Leibniz-8-Documents' 8 | } 9 | 10 | { #category : #initialization } 11 | LeibnizBuiltins >> createContextContext [ 12 | | contextsBuilder | 13 | contextsBuilder := self newContextBuilderNamed: 'contexts'. 14 | contextsBuilder include: 'strings' mode: 'use'. 15 | contextsBuilder addSort: #context. 16 | contextsBuilder addOp: #context withArgs: #(#string) ofSort: #context. 17 | contextsBuilder addOp: #context withArgs: #(#string #string) ofSort: #context. 18 | contextsBuilder addOp: #'replace-sort' withArgs: #(#context #string #string) ofSort: #context. 19 | contextsBuilder addOp: #'replace-sort-prefix' withArgs: #(#context #string #string) ofSort: #context. 20 | contextsBuilder addOp: #'replace-include' withArgs: #(#context #context #context) ofSort: #context. 21 | contextsBuilder addOp: #'remove-vars' withArgs: #(#context) ofSort: #context. 22 | contextsBuilder build. 23 | ] 24 | 25 | { #category : #initialization } 26 | LeibnizBuiltins >> initialize [ 27 | super initialize. 28 | self docHash: (SHA256 hashMessage: 'builtins') hex. 29 | self createTruthContext. 30 | self createIntegerContext. 31 | self createRationalContext. 32 | self createRealNumberContext. 33 | self createStringContext. 34 | self createContextContext. 35 | self createFPContext. 36 | 37 | ] 38 | -------------------------------------------------------------------------------- /Leibniz/LeibnizDocument.class.st: -------------------------------------------------------------------------------- 1 | " 2 | I represent a Leibniz document containing named contexts and references to other Leibniz documents. 3 | 4 | " 5 | Class { 6 | #name : #LeibnizDocument, 7 | #superclass : #Object, 8 | #instVars : [ 9 | 'docHash', 10 | 'contexts' 11 | ], 12 | #category : 'Leibniz-8-Documents' 13 | } 14 | 15 | { #category : #'XML import' } 16 | LeibnizDocument >> addContextFromXML: anXMLElement [ 17 | | name builder context | 18 | name := anXMLElement attributeAt: 'id'. 19 | builder := LbContextBuilder name: name document: self. 20 | builder fromXML: anXMLElement. 21 | context := builder context. 22 | contexts at: context name put: context. 23 | 24 | ] 25 | 26 | { #category : #accessing } 27 | LeibnizDocument >> contextNamed: aString [ 28 | ^ contexts at: aString. 29 | 30 | ] 31 | 32 | { #category : #accessing } 33 | LeibnizDocument >> contexts [ 34 | ^ contexts. 35 | ] 36 | 37 | { #category : #accessing } 38 | LeibnizDocument >> docHash [ 39 | ^ docHash 40 | ] 41 | 42 | { #category : #accessing } 43 | LeibnizDocument >> docHash: anObject [ 44 | docHash := anObject 45 | ] 46 | 47 | { #category : #'XML import' } 48 | LeibnizDocument >> fromXML: anXMLElement [ 49 | anXMLElement descendantElementsNamed: 'context' do: [ :c | self addContextFromXML: c ]. 50 | 51 | ] 52 | 53 | { #category : #initialization } 54 | LeibnizDocument >> initialize [ 55 | contexts := Dictionary new. 56 | 57 | ] 58 | 59 | { #category : #adding } 60 | LeibnizDocument >> newContextBuilderNamed: aString [ 61 | | builder | 62 | builder := LbContextBuilder name: aString document: self. 63 | contexts at: aString put: builder. 64 | ^ builder. 65 | ] 66 | 67 | { #category : #adding } 68 | LeibnizDocument >> replaceBuilderByContextNamed: aString [ 69 | | builder | 70 | builder := contexts at: aString. 71 | contexts at: aString put: builder context. 72 | 73 | ] 74 | -------------------------------------------------------------------------------- /Leibniz/LeibnizDocumentTest.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LeibnizDocumentTest, 3 | #superclass : #TestCase, 4 | #category : 'Leibniz-8-Documents' 5 | } 6 | 7 | { #category : #testing } 8 | LeibnizDocumentTest >> testGoodContextDefinition [ 9 | | doc builder | 10 | doc := LeibnizDocument new. 11 | "bar" 12 | builder := doc newContextBuilderNamed: 'bar'. 13 | builder build. 14 | "foo" 15 | builder := doc newContextBuilderNamed: 'foo'. 16 | builder addSort: #A. 17 | builder addSort: #B. 18 | builder make: #A subsortOf: #B. 19 | self assert: builder name equals: 'foo'. 20 | self assert: builder context sortGraph size equals: 2. 21 | builder build. 22 | 23 | ] 24 | 25 | { #category : #testing } 26 | LeibnizDocumentTest >> testPhaseErrorInCOntextDefinition [ 27 | | doc builder | 28 | doc := LeibnizDocument new. 29 | builder := doc newContextBuilderNamed: 'foo'. 30 | builder addSort: #A. 31 | self should: [builder include: 'bar' mode: 'use'.] 32 | raise: Exception. 33 | 34 | 35 | ] 36 | -------------------------------------------------------------------------------- /Leibniz/LeibnizParserTest.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LeibnizParserTest, 3 | #superclass : #PP2CompositeNodeTest, 4 | #category : 'Leibniz-3-Terms' 5 | } 6 | 7 | { #category : #'term construction' } 8 | LeibnizParserTest >> fpNumberTerm: aFloat [ 9 | ^ LbFPNumberTerm value: aFloat signature: parser signature 10 | ] 11 | 12 | { #category : #'term construction' } 13 | LeibnizParserTest >> integerTerm: anInteger [ 14 | ^ LbIntegerTerm value: anInteger signature: parser signature 15 | ] 16 | 17 | { #category : #'term construction' } 18 | LeibnizParserTest >> rationalNumberTerm: aFraction [ 19 | ^ LbRationalNumberTerm value: aFraction signature: parser signature 20 | ] 21 | 22 | { #category : #running } 23 | LeibnizParserTest >> setUp [ 24 | | b sg | 25 | super setUp. 26 | 27 | b := LbSortGraphBuilder new. 28 | b parseAndAdd: 'A'; 29 | parseAndAdd: 'B ⊆ A'. 30 | b parseAndAdd: 'boolean'. 31 | sg := b sortGraph. 32 | 33 | b := LbSignatureBuilder sortGraph: sg. 34 | b addBuiltin: #integers. 35 | b addBuiltin: #rationalNumbers. 36 | b addBuiltin: #fpNumbers. 37 | b addBuiltin: #strings. 38 | b parseAndAddVar: 'aVar:A'. 39 | b parseAndAddOp: 'aZeroArgOp : B'. 40 | b parseAndAddOp: 'aOneArgOp(A) : A'. 41 | b parseAndAddOp: 'aOneArgOp(B) : B'. 42 | b parseAndAddOp: 'aTwoArgOp(A, A) : A'. 43 | b parseAndAddOp: 'A[A] : A'. 44 | b parseAndAddOp: 'A^{A} : A'. 45 | b parseAndAddOp: 'A^{A, A} : A'. 46 | b parseAndAddOp: 'A_{A} : A'. 47 | b parseAndAddOp: 'A_{A, A} : A'. 48 | b parseAndAddOp: 'A infixOp1 A : A'. 49 | b parseAndAddOp: 'A infixOp2 A : A'. 50 | b parseAndAddOp: 'true : boolean'. 51 | b parseAndAddOp: 'false : boolean'. 52 | parser signature: b signature. 53 | ] 54 | 55 | { #category : #'term construction' } 56 | LeibnizParserTest >> stringTerm: aString [ 57 | ^ LbStringTerm value: aString signature: parser signature 58 | ] 59 | -------------------------------------------------------------------------------- /Leibniz/LeibnizRewriteSystemTest.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LeibnizRewriteSystemTest, 3 | #superclass : #TestCase, 4 | #instVars : [ 5 | 'library', 6 | 'builtins', 7 | 'examples' 8 | ], 9 | #category : 'Leibniz-4-Rules' 10 | } 11 | 12 | { #category : #running } 13 | LeibnizRewriteSystemTest >> setUp [ 14 | super setUp. 15 | library := LeibnizLibrary uniqueInstance. 16 | builtins := library builtins. 17 | examples := LeibnizExamples new. 18 | ] 19 | 20 | { #category : #tests } 21 | LeibnizRewriteSystemTest >> testMassExample [ 22 | | rws tp test | 23 | 24 | rws := (LbContextExamples new massUnitContext) rewriteSystem. 25 | tp := LbParser newStartingAt: #term. 26 | test := [ :in :out | 27 | | inTerm outTerm | 28 | inTerm := (tp parse: in) 29 | cull: rws signature 30 | cull: Dictionary new. 31 | outTerm := (tp parse: out) 32 | cull: rws signature 33 | cull: Dictionary new. 34 | self 35 | assert: (rws reduce: inTerm) 36 | equals: outTerm ]. 37 | 38 | test value: '2 × 3 × kg' value: '6 × kg'. 39 | 40 | ] 41 | -------------------------------------------------------------------------------- /Leibniz/Object.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Object } 2 | 3 | { #category : #'*Leibniz' } 4 | Object >> leibnizAtomicTermValue [ 5 | LbRewriteFailure signal: 'not an atomic term: ', self asString 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz/SequenceableCollection.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #SequenceableCollection } 2 | 3 | { #category : #'*Leibniz' } 4 | SequenceableCollection >> cartesianProductDo: aBlock [ 5 | self cartesianProductWith: #() do: aBlock 6 | ] 7 | 8 | { #category : #'*Leibniz' } 9 | SequenceableCollection >> cartesianProductWith: anArray do: aBlock [ 10 | self 11 | ifEmpty: [ aBlock cull: anArray ] 12 | ifNotEmpty: [ self first do: [ :each | 13 | self allButFirst 14 | cartesianProductWith: (anArray, { each }) 15 | do: aBlock ] ] 16 | ] 17 | -------------------------------------------------------------------------------- /Leibniz/String.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #String } 2 | 3 | { #category : #'*Leibniz' } 4 | String >> lbAtomicTermClass [ 5 | ^ LbStringTerm 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz/Symbol.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Symbol } 2 | 3 | { #category : #'*Leibniz' } 4 | Symbol >> asLbOperatorName [ 5 | ^ LbOperatorName fromInternalSymbol: self 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz/package.st: -------------------------------------------------------------------------------- 1 | Package { #name : #Leibniz } 2 | -------------------------------------------------------------------------------- /Leibniz2/Character.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Character } 2 | 3 | { #category : #'*Leibniz2' } 4 | Character >> isLzIdentifierCharacter [ 5 | ^ self isLetter "Unicode categories Ll Lm Lo Lt Lu" 6 | or: [ ('-*/☰□' includes: self) 7 | or: [ self isMathSymbol "Unicode category Sm" 8 | or: [ self isCurrencySymbol "Unicode category Sc" 9 | or: [ (self isModifierSymbol "Unicode category Sk" 10 | and: [ ('^' includes: self) not ]) 11 | or: [ self isOtherSymbol "Unicode category So" ] ] ] ] ] 12 | ] 13 | -------------------------------------------------------------------------------- /Leibniz2/Color.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Color } 2 | 3 | { #category : #'*Leibniz2' } 4 | Color >> lzDeemphasized [ 5 | ^ self quiteWhiter quiteWhiter 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz2/GtHome.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtHome } 2 | 3 | { #category : #'*Leibniz2' } 4 | GtHome >> leibnizSection [ 5 | 6 | ^ LzHomeSection new 7 | ] 8 | -------------------------------------------------------------------------------- /Leibniz2/GtPhlowColumnedListView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowColumnedListView } 2 | 3 | { #category : #'*Leibniz2' } 4 | GtPhlowColumnedListView >> column: aTitleString lzCode: aBlock [ 5 | self flag: #todo. "Obsolete, to be deleted." 6 | "A variant of column:text: that uses 7 | an appropriate Unicode font for Leibniz code" 8 | self column: aTitleString do: [ :aColumn | 9 | aColumn cellStencil: LzCodeFont brLabelCellStencil; 10 | dataBinder: [ :eachLabel :eachItem | 11 | eachLabel text: (aBlock value: eachItem) ] ] 12 | ] 13 | 14 | { #category : #'*Leibniz2' } 15 | GtPhlowColumnedListView >> column: aTitleString lzCode: aBlock weight: aNumber [ 16 | self flag: #todo. "Obsolete, to be deleted." 17 | "A variant of column:text: that uses 18 | an appropriate Unicode font for Leibniz code" 19 | self column: aTitleString do: [ :aColumn | 20 | aColumn cellStencil: LzCodeFont brLabelCellStencil; 21 | dataBinder: [ :eachLabel :eachItem | 22 | eachLabel text: (aBlock value: eachItem) ]; 23 | weight: aNumber ] 24 | ] 25 | -------------------------------------------------------------------------------- /Leibniz2/GtPhlowColumnedTreeView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowColumnedTreeView } 2 | 3 | { #category : #'*Leibniz2' } 4 | GtPhlowColumnedTreeView >> column: aTitleString lzCode: aBlock [ 5 | self flag: #todo. "Obsolete, to be deleted." 6 | "A variant of column:text: that uses 7 | an appropriate Unicode font for Leibniz code" 8 | self column: aTitleString do: [ :aColumn | 9 | aColumn cellStencil: LzCodeFont brLabelCellStencil; 10 | dataBinder: [ :eachLabel :eachItem | 11 | eachLabel text: (aBlock value: eachItem) ] ] 12 | ] 13 | 14 | { #category : #'*Leibniz2' } 15 | GtPhlowColumnedTreeView >> column: aTitleString lzCode: aBlock weight: aNumber [ 16 | self flag: #todo. "Obsolete, to be deleted." 17 | "A variant of column:text: that uses 18 | an appropriate Unicode font for Leibniz code" 19 | self column: aTitleString do: [ :aColumn | 20 | aColumn cellStencil: LzCodeFont brLabelCellStencil; 21 | dataBinder: [ :eachLabel :eachItem | 22 | eachLabel text: (aBlock value: eachItem) ]; 23 | weight: aNumber ] 24 | ] 25 | -------------------------------------------------------------------------------- /Leibniz2/GtPhlowListView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowListView } 2 | 3 | { #category : #'*Leibniz2' } 4 | GtPhlowListView >> itemLzCode: aBlockOrSymbol [ 5 | self flag: #todo. "Obsolete, to be deleted." 6 | "Variant of itemText: that uses an appropriate Unicode font for Leibniz code" 7 | self itemText: aBlockOrSymbol. 8 | self itemStencil: LzCodeFont brLabelCellStencil 9 | ] 10 | -------------------------------------------------------------------------------- /Leibniz2/GtPhlowProtoView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowProtoView } 2 | 3 | { #category : #'*Leibniz2' } 4 | GtPhlowProtoView >> lzColumnedTree [ 5 | ^ LzPhlowColumnedTreeView new 6 | originalView: self; 7 | definingMethod: (GtPhlowDefiningMethodsCollector new 8 | stack: thisContext stack; 9 | collect) 10 | ] 11 | 12 | { #category : #'*Leibniz2' } 13 | GtPhlowProtoView >> lzTree [ 14 | ^ LbPhlowTreeView new 15 | originalView: self; 16 | definingMethod: (GtPhlowDefiningMethodsCollector new 17 | stack: thisContext stack; 18 | collect) 19 | ] 20 | -------------------------------------------------------------------------------- /Leibniz2/GtPhlowTreeView.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #GtPhlowTreeView } 2 | 3 | { #category : #'*Leibniz2' } 4 | GtPhlowTreeView >> itemLzCode: aBlockOrSymbol [ 5 | self flag: #todo. "Obsolete, to be deleted." 6 | "Variant of itemText: that uses an appropriate Unicode font for Leibniz code" 7 | self itemText: aBlockOrSymbol. 8 | self itemStencil: LzCodeFont brLabelCellStencil 9 | ] 10 | -------------------------------------------------------------------------------- /Leibniz2/LeContent.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #LeContent } 2 | 3 | { #category : #'*Leibniz2' } 4 | LeContent >> nestingLevel [ 5 | self subclassResponsibility 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz2/LeDatabase.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #LeDatabase } 2 | 3 | { #category : #'*Leibniz2' } 4 | LeDatabase >> importLeibnizBookPageNamed: aString [ 5 | self addPage: 6 | (Smalltalk compiler 7 | evaluate: (LzBook pageNamed: aString) 8 | storeString) 9 | ] 10 | 11 | { #category : #'*Leibniz2' } 12 | LeDatabase >> lzDBCache [ 13 | ^ LzDBRegistry uniqueInstance dbCacheFor: self 14 | ] 15 | -------------------------------------------------------------------------------- /Leibniz2/LeExportVisitor.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #LeExportVisitor } 2 | 3 | { #category : #'*Leibniz2' } 4 | LeExportVisitor >> visitTopLevelUseContext: aLzTopLevelUseContextNode [ 5 | ] 6 | -------------------------------------------------------------------------------- /Leibniz2/LeSnippet.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #LeSnippet } 2 | 3 | { #category : #'*Leibniz2' } 4 | LeSnippet >> nestingLevel [ 5 | ^ 1 + self parent nestingLevel 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz2/LeTextSnippet.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #LeTextSnippet } 2 | 3 | { #category : #'*Leibniz2' } 4 | LeTextSnippet >> gtASTFor: aView [ 5 | 6 | ^ aView forward 7 | title: 'AST'; 8 | priority: 5; 9 | object: [ self ast ]; 10 | view: #gtTreeFor:; 11 | yourself 12 | ] 13 | -------------------------------------------------------------------------------- /Leibniz2/LzArgNameAnnotation.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzArgNameAnnotation, 3 | #superclass : #LzDeclarationAnnotation, 4 | #instVars : [ 5 | 'name' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #converting } 11 | LzArgNameAnnotation >> addAsFirstArgOfInfixTermWithOpName: anOpName asRopedTextTo: aRopedText [ 12 | self addAsRopedTextTo: aRopedText 13 | ] 14 | 15 | { #category : #converting } 16 | LzArgNameAnnotation >> addAsRopedTextTo: aRopedText [ 17 | aRopedText append: 18 | (name asRopedText attribute: LzArgNameAttribute new). 19 | aRopedText append: ':' asRopedText. 20 | declaration addAsRopedTextTo: aRopedText 21 | ] 22 | 23 | { #category : #testing } 24 | LzArgNameAnnotation >> isInfix [ 25 | ^ false 26 | ] 27 | 28 | { #category : #accessing } 29 | LzArgNameAnnotation >> name [ 30 | ^ name 31 | ] 32 | 33 | { #category : #accessing } 34 | LzArgNameAnnotation >> name: aSymbol [ 35 | name := aSymbol 36 | ] 37 | -------------------------------------------------------------------------------- /Leibniz2/LzArgNameAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzArgNameAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzArrayTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzArrayTermNode, 3 | #superclass : #LzTermNode, 4 | #instVars : [ 5 | 'leftBrace', 6 | 'arrayElements', 7 | 'rightBrace' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzArrayTermNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitArrayTerm: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzArrayTermNode >> arrayElements [ 19 | ^ arrayElements 20 | ] 21 | 22 | { #category : #generated } 23 | LzArrayTermNode >> arrayElements: aLzArrayElementsNode [ 24 | self arrayElements notNil ifTrue: [ self arrayElements parent: nil ]. 25 | arrayElements := aLzArrayElementsNode. 26 | self arrayElements notNil ifTrue: [ self arrayElements parent: self ] 27 | ] 28 | 29 | { #category : #generated } 30 | LzArrayTermNode >> leftBrace [ 31 | ^ leftBrace 32 | ] 33 | 34 | { #category : #generated } 35 | LzArrayTermNode >> leftBrace: aSmaCCToken [ 36 | leftBrace := aSmaCCToken 37 | ] 38 | 39 | { #category : #generated } 40 | LzArrayTermNode >> nodeVariables [ 41 | ^ #(#arrayElements) 42 | ] 43 | 44 | { #category : #generated } 45 | LzArrayTermNode >> rightBrace [ 46 | ^ rightBrace 47 | ] 48 | 49 | { #category : #generated } 50 | LzArrayTermNode >> rightBrace: aSmaCCToken [ 51 | rightBrace := aSmaCCToken 52 | ] 53 | 54 | { #category : #generated } 55 | LzArrayTermNode >> tokenVariables [ 56 | ^ #(#leftBrace #rightBrace) 57 | ] 58 | -------------------------------------------------------------------------------- /Leibniz2/LzAssetDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzAssetDeclaration, 3 | #superclass : #LzDeclaration, 4 | #instVars : [ 5 | 'label', 6 | 'order' 7 | ], 8 | #category : #'Leibniz2-Declarations' 9 | } 10 | 11 | { #category : #converting } 12 | LzAssetDeclaration >> addAsRopedTextTo: aRopedText [ 13 | aRopedText append: 14 | (self label asRopedText attribute: LzAssetLabelAttribute new). 15 | self order ifNotNil: [ :o | 16 | aRopedText append: '[' asRopedText. 17 | aRopedText append: 18 | (o asRopedText attribute: LzRuleOrderAttribute new). 19 | aRopedText append: ']' asRopedText ]. 20 | ] 21 | 22 | { #category : #accessing } 23 | LzAssetDeclaration >> label [ 24 | 25 | ^ label 26 | ] 27 | 28 | { #category : #accessing } 29 | LzAssetDeclaration >> label: anObject [ 30 | 31 | label := anObject 32 | ] 33 | 34 | { #category : #constructing } 35 | LzAssetDeclaration >> objectFor: aContext [ 36 | ^ aContext parsedAsset: self 37 | ] 38 | 39 | { #category : #accessing } 40 | LzAssetDeclaration >> order [ 41 | 42 | ^ order 43 | ] 44 | 45 | { #category : #accessing } 46 | LzAssetDeclaration >> order: anObject [ 47 | 48 | order := anObject 49 | ] 50 | -------------------------------------------------------------------------------- /Leibniz2/LzAssetLabelAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzAssetLabelAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #accessing } 8 | LzAssetLabelAttribute >> visualAttributesForColor: aColor [ 9 | ^ { BlFontWeightAttribute bold. 10 | BlTextForegroundAttribute new 11 | paint: aColor darker } 12 | ] 13 | -------------------------------------------------------------------------------- /Leibniz2/LzAssetPrefixNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzAssetPrefixNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'label' 6 | ], 7 | #category : #'Leibniz2-SmaCCParser' 8 | } 9 | 10 | { #category : #generated } 11 | LzAssetPrefixNode >> acceptVisitor: aParseTreeVisitor [ 12 | ^ aParseTreeVisitor visitAssetPrefix: self 13 | ] 14 | 15 | { #category : #generated } 16 | LzAssetPrefixNode >> label [ 17 | ^ label 18 | ] 19 | 20 | { #category : #generated } 21 | LzAssetPrefixNode >> label: aSmaCCToken [ 22 | label := aSmaCCToken 23 | ] 24 | 25 | { #category : #generated } 26 | LzAssetPrefixNode >> tokenVariables [ 27 | ^ #(#label) 28 | ] 29 | -------------------------------------------------------------------------------- /Leibniz2/LzAxiom.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzAxiom, 3 | #superclass : #LzTermsWithSharedVars, 4 | #instVars : [ 5 | 'label' 6 | ], 7 | #category : #'Leibniz2-Axioms' 8 | } 9 | 10 | { #category : #converting } 11 | LzAxiom >> addAsRopedTextTo: aRopedText [ 12 | self label ifNotNil: [ :l | 13 | aRopedText append: 14 | (l asRopedText attribute: LzAssetLabelAttribute new). 15 | aRopedText append: ': ' asRopedText ]. 16 | super addAsRopedTextTo: aRopedText 17 | ] 18 | 19 | { #category : #initialization } 20 | LzAxiom >> buildTermsFrom: aDictionary [ 21 | self subclassResponsibility 22 | ] 23 | 24 | { #category : #'instance creation' } 25 | LzAxiom >> checkSteps [ 26 | self subclassResponsibility 27 | ] 28 | 29 | { #category : #copying } 30 | LzAxiom >> copy [ 31 | ^ self 32 | ] 33 | 34 | { #category : #copying } 35 | LzAxiom >> deepCopy [ 36 | ^ self 37 | ] 38 | 39 | { #category : #accessing } 40 | LzAxiom >> label [ 41 | 42 | ^ label 43 | ] 44 | 45 | { #category : #accessing } 46 | LzAxiom >> label: anObject [ 47 | 48 | label := anObject 49 | ] 50 | 51 | { #category : #printing } 52 | LzAxiom >> printAsLeibnizSyntaxOn: aStream [ 53 | self printVariablesAsLeibnizSyntaxOn: aStream. 54 | self printBodyAsLeibnizSyntaxOn: aStream. 55 | ] 56 | 57 | { #category : #printing } 58 | LzAxiom >> printBodyAsLeibnizSyntaxOn: aStream [ 59 | self subclassResponsibility 60 | ] 61 | -------------------------------------------------------------------------------- /Leibniz2/LzAxiomDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzAxiomDeclaration, 3 | #superclass : #LzDeclarationWithVariables, 4 | #instVars : [ 5 | 'label' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #converting } 11 | LzAxiomDeclaration >> addAsRopedTextTo: aRopedText [ 12 | self label ifNotNil: [ :l | 13 | aRopedText append: 14 | (l asRopedText attribute: LzAssetLabelAttribute new). 15 | aRopedText append: ': ' asRopedText ]. 16 | super addAsRopedTextTo: aRopedText 17 | ] 18 | 19 | { #category : #accessing } 20 | LzAxiomDeclaration >> axiomClass [ 21 | self subclassResponsibility 22 | ] 23 | 24 | { #category : #accessing } 25 | LzAxiomDeclaration >> label [ 26 | 27 | ^ label 28 | ] 29 | 30 | { #category : #accessing } 31 | LzAxiomDeclaration >> label: anObject [ 32 | 33 | label := anObject 34 | ] 35 | 36 | { #category : #accessing } 37 | LzAxiomDeclaration >> terms [ 38 | self subclassResponsibility 39 | ] 40 | -------------------------------------------------------------------------------- /Leibniz2/LzBaselineAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzBaselineAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzBindingsSortVarNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzBindingsSortVarNode, 3 | #superclass : #LzBindingsVarNode, 4 | #category : #'Leibniz2-Terms' 5 | } 6 | 7 | { #category : #accessing } 8 | LzBindingsSortVarNode >> unifyWithValue: aTerm bindings: anLzBindings [ 9 | value 10 | ifNil: [ 11 | anLzBindings failUnless: aTerm sort isSubsortOf: sort. 12 | self value: aTerm ] 13 | ifNotNil: [ 14 | | sortGraph sortPair | 15 | sortGraph := anLzBindings sortGraph. 16 | sortPair := LzSortPair new 17 | sortGraph: sortGraph; 18 | sort1: (sortGraph sortWithTerm: aTerm) ; 19 | sort2: (sortGraph sortWithTerm: value). 20 | sortPair leastUniqueCommonSupersort 21 | ifNil: [ anLzBindings failWith: aTerm notUnifiableWith: value ] 22 | ifNotNil: [ :s | self value: s term ] ] 23 | ] 24 | -------------------------------------------------------------------------------- /Leibniz2/LzBlockLinksVisitor.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzBlockLinksVisitor, 3 | #superclass : #LzParseTreeNodeVisitor, 4 | #traits : 'TSmaCCComponentVisitor + TLzParseTreeNodeVisitor', 5 | #classTraits : 'TSmaCCComponentVisitor classTrait + TLzParseTreeNodeVisitor classTrait', 6 | #category : #'Leibniz2-Lepiter' 7 | } 8 | 9 | { #category : #initializing } 10 | LzBlockLinksVisitor class >> initialize [ 11 | LeBlockLinksVisitor addComponentVisitorClass: self. 12 | ] 13 | 14 | { #category : #initializing } 15 | LzBlockLinksVisitor class >> obsolete [ 16 | LeBlockLinksVisitor removeComponentVisitorClass: self. 17 | ^ super obsolete 18 | ] 19 | 20 | { #category : #visiting } 21 | LzBlockLinksVisitor >> acceptNode: aSmaCCParseNode [ 22 | "A copy of TSmaCCComponentVisitor>>#acceptNode: for 23 | resolving a trait conflict." 24 | aSmaCCParseNode isNil 25 | ifTrue: [ ^ nil ]. 26 | ^ composite notNil 27 | ifTrue: [ composite acceptNode: aSmaCCParseNode ] 28 | ifFalse: [ aSmaCCParseNode acceptVisitor: self ] 29 | ] 30 | 31 | { #category : #scanning } 32 | LzBlockLinksVisitor >> visitTopLevelUseContext: aTopLevelUseContext [ 33 | | pageName | 34 | pageName := aTopLevelUseContext pageName value. 35 | pageName := pageName copyFrom: 2 to: pageName size - 1. 36 | pageName := ($/ split: pageName) first. 37 | self composite links 38 | add: (LzUseContextLink new 39 | node: aTopLevelUseContext; 40 | targetPageTitle: pageName) 41 | ] 42 | -------------------------------------------------------------------------------- /Leibniz2/LzBooleanTerm.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzBooleanTerm, 3 | #superclass : #LzAtomicTerm, 4 | #category : #'Leibniz2-Terms' 5 | } 6 | 7 | { #category : #'instance creation' } 8 | LzBooleanTerm class >> signature: aSignature value: aBoolean [ 9 | | opName | 10 | opName := LzPrefixOpName for: 11 | (aBoolean 12 | ifTrue: [ LzConstants opNameTrue ] 13 | ifFalse: [ LzConstants opNameFalse ]). 14 | ^ aSignature opTerm: opName args: #() 15 | ] 16 | -------------------------------------------------------------------------------- /Leibniz2/LzBracketOpNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzBracketOpNode, 3 | #superclass : #LzOpNode, 4 | #instVars : [ 5 | 'opName', 6 | 'commas', 7 | 'rightBracket' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzBracketOpNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitBracketOp: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzBracketOpNode >> commas [ 19 | ^ commas 20 | ] 21 | 22 | { #category : #generated } 23 | LzBracketOpNode >> commas: anOrderedCollection [ 24 | commas := anOrderedCollection 25 | ] 26 | 27 | { #category : #generated } 28 | LzBracketOpNode >> compositeTokenVariables [ 29 | ^ #(#commas) 30 | ] 31 | 32 | { #category : #'generated-initialize-release' } 33 | LzBracketOpNode >> initialize [ 34 | super initialize. 35 | commas := OrderedCollection new: 2. 36 | ] 37 | 38 | { #category : #generated } 39 | LzBracketOpNode >> opName [ 40 | ^ opName 41 | ] 42 | 43 | { #category : #generated } 44 | LzBracketOpNode >> opName: aSmaCCToken [ 45 | opName := aSmaCCToken 46 | ] 47 | 48 | { #category : #generated } 49 | LzBracketOpNode >> rightBracket [ 50 | ^ rightBracket 51 | ] 52 | 53 | { #category : #generated } 54 | LzBracketOpNode >> rightBracket: aSmaCCToken [ 55 | rightBracket := aSmaCCToken 56 | ] 57 | 58 | { #category : #generated } 59 | LzBracketOpNode >> tokenVariables [ 60 | ^ #(#opName #rightBracket) 61 | ] 62 | -------------------------------------------------------------------------------- /Leibniz2/LzButtonLabelAptitude.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzButtonLabelAptitude, 3 | #superclass : #BrTextLabelAptitude, 4 | #category : #'Leibniz2-Lepiter' 5 | } 6 | 7 | { #category : #accessing } 8 | LzButtonLabelAptitude >> initialize [ 9 | super initialize. 10 | self 11 | weight: 400; 12 | fontName: LzCodeFont defaultFamily. 13 | labelElement 14 | addAptitude: 15 | (BrSizeAdjustmentAptitude new 16 | mini: [ :aStyle | aStyle fontSizeEm: 0.55 ]; 17 | tiny: [ :aStyle | aStyle fontSizeEm: 0.7 ]; 18 | small: [ :aStyle | aStyle fontSizeEm: 0.85 ]; 19 | normal: [ :aStyle | aStyle fontSizeEm: 1.0 ]; 20 | large: [ :aStyle | aStyle fontSizeEm: 1.15 ]; 21 | huge: [ :aStyle | aStyle fontSizeEm: 1.55 ]) 22 | ] 23 | -------------------------------------------------------------------------------- /Leibniz2/LzCodeFont.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzCodeFont, 3 | #superclass : #Object, 4 | #classVars : [ 5 | 'DefaultFamily' 6 | ], 7 | #category : #'Leibniz2-Infrastructure' 8 | } 9 | 10 | { #category : #inspecting } 11 | LzCodeFont class >> brLabelCellStencil [ 12 | ^ [ BrLabel new 13 | aptitude: (BrGlamorousLabelAptitude new fontName: self defaultFamily); 14 | alignCenterLeft; 15 | hMatchParent; 16 | vFitContent ] 17 | ] 18 | 19 | { #category : #inspecting } 20 | LzCodeFont class >> brLabelFor: aString [ 21 | ^ self brLabelCellStencil value 22 | text: aString asRopedText; 23 | yourself 24 | ] 25 | 26 | { #category : #choosing } 27 | LzCodeFont class >> chooseDefaultFamily [ 28 | | availableFamilies | 29 | availableFamilies := SkiaFontManager default familyNames. 30 | #('JuliaMono' 'Arial Unicode MS' 'Noto Sans Math') do: [ :family | 31 | (availableFamilies includes: family) 32 | ifTrue: [ DefaultFamily := family. ^ self] ]. 33 | DefaultFamily := (' ' asRopedText glamorousCodeFont 34 | attributesAt: 1) first name 35 | ] 36 | 37 | { #category : #accessing } 38 | LzCodeFont class >> defaultFamily [ 39 | ^ DefaultFamily 40 | ] 41 | 42 | { #category : #accessing } 43 | LzCodeFont class >> textFrom: aBlock [ 44 | | text | 45 | text := '' asRopedText. 46 | aBlock value: text. 47 | text fontName: LzCodeFont defaultFamily. 48 | ^ text 49 | ] 50 | -------------------------------------------------------------------------------- /Leibniz2/LzColonAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzColonAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzColors.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzColors, 3 | #superclass : #Object, 4 | #category : #'Leibniz2-Infrastructure' 5 | } 6 | 7 | { #category : #accessing } 8 | LzColors class >> declarationColor [ 9 | ^ Color blue 10 | ] 11 | 12 | { #category : #accessing } 13 | LzColors class >> exampleColor [ 14 | ^ Color brown 15 | ] 16 | 17 | { #category : #accessing } 18 | LzColors class >> resultColor [ 19 | ^ Color green muchDarker 20 | ] 21 | 22 | { #category : #accessing } 23 | LzColors class >> subcontextColor [ 24 | ^ Color purple 25 | ] 26 | -------------------------------------------------------------------------------- /Leibniz2/LzConditionAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzConditionAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzConstants.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzConstants, 3 | #superclass : #Object, 4 | #category : #'Leibniz2-Infrastructure' 5 | } 6 | 7 | { #category : #accessing } 8 | LzConstants class >> opNameBoolean [ 9 | ^ '𝔹' 10 | ] 11 | 12 | { #category : #accessing } 13 | LzConstants class >> opNameContravariant [ 14 | ^ '⇅' 15 | ] 16 | 17 | { #category : #accessing } 18 | LzConstants class >> opNameFalse [ 19 | ^ '⊥' 20 | ] 21 | 22 | { #category : #accessing } 23 | LzConstants class >> opNameSort [ 24 | ^ '𝕊' 25 | ] 26 | 27 | { #category : #accessing } 28 | LzConstants class >> opNameTrue [ 29 | ^ '⊤' 30 | ] 31 | 32 | { #category : #accessing } 33 | LzConstants class >> reservedIdentifiers [ 34 | | rewriteArrow functionArrow equalSign 35 | forAllSymbol conditionSymbol subsortSymbol | 36 | rewriteArrow := '⇒'. 37 | functionArrow := '→'. 38 | equalSign := '='. 39 | forAllSymbol := '∀'. 40 | conditionSymbol := '|'. 41 | subsortSymbol := '⊆'. 42 | ^ { 43 | rewriteArrow. 44 | functionArrow. 45 | equalSign. 46 | forAllSymbol. 47 | conditionSymbol. 48 | subsortSymbol 49 | } 50 | ] 51 | 52 | { #category : #accessing } 53 | LzConstants class >> tempVarPrefix [ 54 | ^ '□' 55 | ] 56 | -------------------------------------------------------------------------------- /Leibniz2/LzContextNameAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzContextNameAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzDBRegistry.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzDBRegistry, 3 | #superclass : #Object, 4 | #traits : 'TSingleton', 5 | #classTraits : 'TSingleton classTrait', 6 | #instVars : [ 7 | 'dbCaches' 8 | ], 9 | #classInstVars : [ 10 | 'uniqueInstance' 11 | ], 12 | #category : #'Leibniz2-Lepiter' 13 | } 14 | 15 | { #category : #querying } 16 | LzDBRegistry >> dbCacheFor: anLeDatabase [ 17 | ^ dbCaches at: anLeDatabase 18 | ifAbsentPut: [ LzDBCache forDatabase: anLeDatabase ] 19 | ] 20 | 21 | { #category : #initialialize } 22 | LzDBRegistry >> initialize [ 23 | dbCaches := IdentityDictionary new. 24 | ] 25 | -------------------------------------------------------------------------------- /Leibniz2/LzDebuggingUtilities.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzDebuggingUtilities, 3 | #superclass : #Object, 4 | #category : #'Leibniz2-Infrastructure' 5 | } 6 | 7 | { #category : #debugging } 8 | LzDebuggingUtilities class >> checkForInfiniteRecursion [ 9 | thisContext stack size > 500 ifTrue: [ self halt ] 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzDeclarationAnnotation.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzDeclarationAnnotation, 3 | #superclass : #LzDeclaration, 4 | #instVars : [ 5 | 'declaration' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #converting } 11 | LzDeclarationAnnotation >> addAsRopedTextTo: aRopedText [ 12 | self declaration addAsRopedTextTo: aRopedText 13 | ] 14 | 15 | { #category : #accessing } 16 | LzDeclarationAnnotation >> declaration [ 17 | ^ declaration 18 | ] 19 | 20 | { #category : #visiting } 21 | LzDeclarationAnnotation >> declaration: aDeclaration [ 22 | declaration := aDeclaration 23 | ] 24 | 25 | { #category : #testing } 26 | LzDeclarationAnnotation >> definesContext [ 27 | ^ self declaration definesContext 28 | ] 29 | 30 | { #category : #printing } 31 | LzDeclarationAnnotation >> printAsLeibnizSyntaxOn: aStream [ 32 | self declaration printAsLeibnizSyntaxOn: aStream 33 | ] 34 | -------------------------------------------------------------------------------- /Leibniz2/LzDeclarationWithVariables.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzDeclarationWithVariables, 3 | #superclass : #LzDeclaration, 4 | #instVars : [ 5 | 'variables' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #converting } 11 | LzDeclarationWithVariables >> addAsRopedTextTo: aRopedText [ 12 | self addVariablesAsRopedTextTo: aRopedText. 13 | self addBodyAsRopedTextTo: aRopedText 14 | ] 15 | 16 | { #category : #converting } 17 | LzDeclarationWithVariables >> addBodyAsRopedTextTo: aRopedText [ 18 | self subclassResponsibility 19 | ] 20 | 21 | { #category : #converting } 22 | LzDeclarationWithVariables >> addVariablesAsRopedTextTo: aRopedText [ 23 | (variables reject: #isDerived) 24 | do: [ :var | 25 | var addAsRopedTextTo: aRopedText. 26 | aRopedText append: 27 | (', ' asRopedText attribute: LzVarDeclarationAttribute new) ] 28 | ] 29 | 30 | { #category : #printing } 31 | LzDeclarationWithVariables >> printAsLeibnizSyntaxOn: aStream [ 32 | self printVariablesAsLeibnizSyntaxOn: aStream. 33 | self printBodyAsLeibnizSyntaxOn: aStream 34 | ] 35 | 36 | { #category : #printing } 37 | LzDeclarationWithVariables >> printVariablesAsLeibnizSyntaxOn: aStream [ 38 | (variables reject: #isDerived) 39 | do: [ :var | 40 | var printAsLeibnizSyntaxOn: aStream. 41 | aStream nextPutAll: ', ' ] 42 | ] 43 | 44 | { #category : #accessing } 45 | LzDeclarationWithVariables >> variables [ 46 | 47 | ^ variables 48 | ] 49 | 50 | { #category : #accessing } 51 | LzDeclarationWithVariables >> variables: anObject [ 52 | 53 | variables := anObject 54 | ] 55 | -------------------------------------------------------------------------------- /Leibniz2/LzDoNotRenderAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzDoNotRenderAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #rendering } 8 | LzDoNotRenderAttribute >> visualAttributesForColor: aColor [ 9 | ^ { BlFontSizeAttribute new size: 0 } 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzEGraphMatch.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzEGraphMatch, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'graph', 6 | 'classId', 7 | 'substitution' 8 | ], 9 | #category : #'Leibniz2-EGraphs' 10 | } 11 | 12 | { #category : #accessing } 13 | LzEGraphMatch >> classId [ 14 | ^ classId 15 | ] 16 | 17 | { #category : #accessing } 18 | LzEGraphMatch >> classId: anEClassId [ 19 | classId := anEClassId 20 | ] 21 | 22 | { #category : #accessing } 23 | LzEGraphMatch >> eClass [ 24 | ^ graph classForId: classId 25 | ] 26 | 27 | { #category : #accessing } 28 | LzEGraphMatch >> graph [ 29 | ^ graph 30 | ] 31 | 32 | { #category : #accessing } 33 | LzEGraphMatch >> graph: anEGraph [ 34 | graph := anEGraph 35 | ] 36 | 37 | { #category : #inspecting } 38 | LzEGraphMatch >> gtBindingsFor: aView [ 39 | 40 | substitution ifFailure: [ ^ aView empty ]. 41 | ^ aView forward 42 | title: 'Bindings'; 43 | priority: 1; 44 | object: [ substitution ]; 45 | view: #gtBindingsFor:; 46 | yourself 47 | ] 48 | 49 | { #category : #inspecting } 50 | LzEGraphMatch >> gtEClassNodesFor: aView [ 51 | 52 | ^ aView forward 53 | title: 'Parent eClass nodes'; 54 | priority: 5; 55 | object: [ self eClass ]; 56 | view: #gtNodesFor:; 57 | yourself 58 | ] 59 | 60 | { #category : #inspecting } 61 | LzEGraphMatch >> gtFailureFor: aView [ 62 | 63 | substitution ifSuccess: [ ^ aView empty ]. 64 | ^ aView forward 65 | title: 'Failure'; 66 | priority: 1; 67 | object: [ substitution ]; 68 | view: #gtFailureFor:; 69 | yourself 70 | ] 71 | 72 | { #category : #accessing } 73 | LzEGraphMatch >> substitution [ 74 | ^ substitution 75 | ] 76 | 77 | { #category : #accessing } 78 | LzEGraphMatch >> substitution: bindings [ 79 | substitution := bindings 80 | ] 81 | -------------------------------------------------------------------------------- /Leibniz2/LzEGraphMatchStreamContents.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzEGraphMatchStreamContents, 3 | #superclass : #LzStreamContents, 4 | #category : #'Leibniz2-EGraphs' 5 | } 6 | 7 | { #category : #inspecting } 8 | LzEGraphMatchStreamContents >> gtMatchesFor: aView [ 9 | 10 | | view | 11 | view := aView columnedList 12 | title: 'Matches'; 13 | priority: 0; 14 | items: [ retrievedItems ]; 15 | column: 'EClass' text: #eClass; 16 | column: 'Substitution' text: [ :each | 17 | each substitution gtDisplayString ]; 18 | updateWhen: LzStreamContentsMoreItemsEvent in: [ self announcer ] 19 | yourself. 20 | self isComplete ifFalse: [ 21 | view 22 | actionButtonIcon: BrGlamorousVectorIcons add 23 | tooltip: 'More' 24 | action: [ self moreItems ] ]. 25 | ^ view 26 | ] 27 | -------------------------------------------------------------------------------- /Leibniz2/LzEGraphRewriteCycleError.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzEGraphRewriteCycleError, 3 | #superclass : #Error, 4 | #instVars : [ 5 | 'rule' 6 | ], 7 | #category : #'Leibniz2-EGraphs' 8 | } 9 | 10 | { #category : #adding } 11 | LzEGraphRewriteCycleError >> rule: aRule [ 12 | rule := aRule 13 | ] 14 | -------------------------------------------------------------------------------- /Leibniz2/LzEqualSignAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzEqualSignAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzExecutionState.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzExecutionState, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'values' 6 | ], 7 | #category : #'Leibniz2-Terms' 8 | } 9 | 10 | { #category : #updating } 11 | LzExecutionState >> addStateVar: anLzVarName [ 12 | (values includesKey: anLzVarName) 13 | ifFalse: [ values at: anLzVarName put: nil ] 14 | ] 15 | 16 | { #category : #accessing } 17 | LzExecutionState >> bindingFor: aName [ 18 | ^ values at: aName ifAbsent: [ nil ] 19 | ] 20 | 21 | { #category : #inspecting } 22 | LzExecutionState >> gtDisplayOn: aStream [ 23 | values keysAndValuesDo: [ :name :value | 24 | aStream 25 | << name asLeibnizSyntaxString; 26 | << '='; 27 | << (value ifNil: 'nil' ifNotNil: [ :v | v asLeibnizSyntaxString ]); 28 | << ' ' ] 29 | ] 30 | 31 | { #category : #accessing } 32 | LzExecutionState >> gtValuesFor: aView [ 33 | 34 | ^ aView forward 35 | title: 'Values'; 36 | priority: 1; 37 | object: [ values ]; 38 | view: #gtItemsFor:; 39 | yourself 40 | ] 41 | 42 | { #category : #accessing } 43 | LzExecutionState >> hasNoBindings [ 44 | ^ values values 45 | detect: #isNotNil 46 | ifFound: [ false ] 47 | ifNone: [ true] 48 | ] 49 | 50 | { #category : #initializing } 51 | LzExecutionState >> initialize [ 52 | values := Dictionary new 53 | ] 54 | 55 | { #category : #printing } 56 | LzExecutionState >> printOn: aStream [ 57 | super printOn: aStream. 58 | aStream nextPut: $(. 59 | self gtDisplayOn: aStream. 60 | aStream nextPut: $) 61 | ] 62 | 63 | { #category : #initializing } 64 | LzExecutionState >> stateVars: aSet [ 65 | aSet do: [ :each | self addStateVar: each ] 66 | ] 67 | 68 | { #category : #updating } 69 | LzExecutionState >> updateFromBindings: bindings [ 70 | bindings bindings keysAndValuesDo: [ :eachName :eachValue | 71 | (values includesKey: eachName) ifTrue: [ 72 | values at: eachName put: eachValue ] ] 73 | ] 74 | -------------------------------------------------------------------------------- /Leibniz2/LzFPLiteralDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzFPLiteralDeclaration, 3 | #superclass : #LzLiteralDeclaration, 4 | #category : #'Leibniz2-Declarations' 5 | } 6 | 7 | { #category : #accessing } 8 | LzFPLiteralDeclaration >> builtin [ 9 | ^ #floatingPointNumbers 10 | ] 11 | 12 | { #category : #accessing } 13 | LzFPLiteralDeclaration >> printAsLeibnizSyntaxOn: aStream [ 14 | value printOn: aStream 15 | ] 16 | 17 | { #category : #accessing } 18 | LzFPLiteralDeclaration >> termClass [ 19 | ^ LzFloatingPointNumberTerm 20 | ] 21 | -------------------------------------------------------------------------------- /Leibniz2/LzFloatingPointNumberTerm.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzFloatingPointNumberTerm, 3 | #superclass : #LzAtomicTerm, 4 | #category : #'Leibniz2-Terms' 5 | } 6 | 7 | { #category : #accessing } 8 | LzFloatingPointNumberTerm >> sort [ 9 | | symbol | 10 | symbol := value isNaN 11 | ifTrue: [ #'FP64.NaN' ] 12 | ifFalse: [ value isInfinite 13 | ifTrue: [ #'FP64.inf' ] 14 | ifFalse: [ #'FP64.number' ] ]. 15 | ^ self signature sort: symbol 16 | ] 17 | -------------------------------------------------------------------------------- /Leibniz2/LzFpNumberLiteralTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzFpNumberLiteralTermNode, 3 | #superclass : #LzLiteralTermNode, 4 | #category : #'Leibniz2-SmaCCParser' 5 | } 6 | 7 | { #category : #generated } 8 | LzFpNumberLiteralTermNode >> acceptVisitor: aParseTreeVisitor [ 9 | ^ aParseTreeVisitor visitFpNumberLiteralTerm: self 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzGlobalCache.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzGlobalCache, 3 | #superclass : #Object, 4 | #traits : 'TSingleton', 5 | #classTraits : 'TSingleton classTrait', 6 | #instVars : [ 7 | 'rewriteCaches' 8 | ], 9 | #category : #'Leibniz2-Lepiter' 10 | } 11 | 12 | { #category : #initializing } 13 | LzGlobalCache >> initialize [ 14 | rewriteCaches := WeakIdentityKeyDictionary new. 15 | ] 16 | 17 | { #category : #accessing } 18 | LzGlobalCache >> rewriteCacheFor: aContext [ 19 | ^ rewriteCaches at: aContext ifAbsent: [ 20 | rewriteCaches 21 | at: aContext 22 | put: (LzRewriteCache new 23 | rewriteSystem: aContext rewriteSystem) ] 24 | ] 25 | -------------------------------------------------------------------------------- /Leibniz2/LzGrammarRulesAndAxioms.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzGrammarRulesAndAxioms, 3 | #superclass : #LzGrammarSignaturesAndTerms, 4 | #instVars : [ 5 | 'conditionClause', 6 | 'code', 7 | 'equalityAxiom', 8 | 'subsortAxiom', 9 | 'rewriteRule', 10 | 'fnRule' 11 | ], 12 | #category : #'Leibniz2-Parser' 13 | } 14 | 15 | { #category : #axioms } 16 | LzGrammarRulesAndAxioms >> axiomEnd [ 17 | ^ (equalityAxiom / subsortAxiom) end 18 | ] 19 | 20 | { #category : #rules } 21 | LzGrammarRulesAndAxioms >> code [ 22 | ^ $' asPParser , $' asPParser negate star flatten, $' asPParser, $: asPParser, opIdentifier 23 | ] 24 | 25 | { #category : #clauses } 26 | LzGrammarRulesAndAxioms >> conditionClause [ 27 | ^ conditionSymbol trim, term 28 | ] 29 | 30 | { #category : #axioms } 31 | LzGrammarRulesAndAxioms >> equalityAxiom [ 32 | ^ forAllClause star trim, term, equalSign trim, term, conditionClause optional 33 | ] 34 | 35 | { #category : #accessing } 36 | LzGrammarRulesAndAxioms >> fnRule [ 37 | ^ forAllClause star trim, term, fnArrow trim, code, conditionClause optional 38 | ] 39 | 40 | { #category : #rules } 41 | LzGrammarRulesAndAxioms >> rewriteRule [ 42 | ^ forAllClause star trim, term, rewriteArrow trim, term, conditionClause optional 43 | ] 44 | 45 | { #category : #rules } 46 | LzGrammarRulesAndAxioms >> ruleEnd [ 47 | ^ (rewriteRule / fnRule) end 48 | ] 49 | 50 | { #category : #axioms } 51 | LzGrammarRulesAndAxioms >> subsortAxiom [ 52 | ^ forAllClause star trim, term, subsortSymbol trim, term 53 | ] 54 | 55 | { #category : #axioms } 56 | LzGrammarRulesAndAxioms >> subsortAxiomEnd [ 57 | ^ subsortAxiom end 58 | ] 59 | -------------------------------------------------------------------------------- /Leibniz2/LzHomeSection.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHomeSection, 3 | #superclass : #GtHomeMultiCardSection, 4 | #category : #'Leibniz2-Infrastructure' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHomeSection >> defaultPriority [ 9 | ^ 30 10 | ] 11 | 12 | { #category : #accessing } 13 | LzHomeSection >> leibnizBookCard [ 14 | 15 | ^ GtHomeCard lepiterBaseWithTableOfContents 16 | title: 'Leibniz'; 17 | description: 'Leibniz is a notation for embedding machine-readable computational models in human-readable document.'; 18 | priority: 1; 19 | pageName: 'Leibniz - a Digital Scientific Notation'; 20 | databaseName: LzBook database databaseName; 21 | readMoreToolbar; 22 | details: [ :db | 23 | | pages pagesWithDeclarations | 24 | pages := db pages. 25 | pagesWithDeclarations := pages select: [ :each | 26 | ((each lzDBCache declarationCacheFor: each) declarationsFor: nil) isEmpty not ]. 27 | 'The book is expressed as a knowledge base. ', 28 | 'It documents Leibniz in ', pages size asString , 29 | ' pages, of which ', 30 | pagesWithDeclarations size asString, 31 | ' contain context definitions.' ] 32 | yourself 33 | ] 34 | 35 | { #category : #accessing } 36 | LzHomeSection >> sectionTitle [ 37 | ^ 'Leibniz' 38 | ] 39 | -------------------------------------------------------------------------------- /Leibniz2/LzHtlmTextSnippetRuleWriter.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHtlmTextSnippetRuleWriter, 3 | #superclass : #LzHtmlTextSnippetAnnotationWriter, 4 | #category : #'Leibniz2-HTML-Export' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHtlmTextSnippetRuleWriter >> tag [ 9 | ^ #'leibniz-rule' 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzHtlmTextSnippetSortWriter.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHtlmTextSnippetSortWriter, 3 | #superclass : #LzHtmlTextSnippetAnnotationWriter, 4 | #category : #'Leibniz2-HTML-Export' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHtlmTextSnippetSortWriter >> tag [ 9 | ^ #'leibniz-sort' 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzHtmlPageExporter.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHtmlPageExporter, 3 | #superclass : #LeHtmlPageExporter, 4 | #category : #'Leibniz2-HTML-Export' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHtmlPageExporter class >> exportPage: page to: directory [ 9 | | pageLinks context database html pageLinkBuilder | 10 | database := page database. 11 | context := LeHtmlContext new 12 | page: page; 13 | database: database. 14 | 15 | pageLinkBuilder := LeExportPageLinksBuilder new 16 | in: [ :theBuilder | database ifNotNil: [ theBuilder database: database ] ]; 17 | mainPage: page; 18 | sequencer: context sequencer; 19 | html; 20 | build. 21 | pageLinks := pageLinkBuilder links. 22 | context pageLinks: pageLinks. 23 | 24 | LeHtmlAssetsUtility 25 | addAssetResourcesFrom: LzBook htmlAssetLocation 26 | into: context resources. 27 | 28 | html := LeHtmlPageExporter new 29 | context: context; 30 | piece: (LeHtmlGtBookPiece fromFile: LzBook htmlSinglePageTemplateLocation); 31 | contents. 32 | 33 | context resources 34 | addResource: (LeExportPageOutputResource new 35 | content: html; 36 | hrefBuilder: context hrefBuilder; 37 | pageLink: (pageLinks 38 | linkForPage: page 39 | ifFound: [ :thePage | thePage ] 40 | ifNone: [ "ignore" ])). 41 | 42 | context assembler assemble. 43 | 44 | LeExportResourcesDirectorySaver new 45 | resources: context resources; 46 | rootDirectory: directory; 47 | save. 48 | 49 | ^ LeHtmlPage new 50 | directory: directory; 51 | pageFile: directory / pageLinkBuilder mainFileName; 52 | resources: context resources; 53 | log: context log 54 | ] 55 | -------------------------------------------------------------------------------- /Leibniz2/LzHtmlTextSnippetAssetWriter.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHtmlTextSnippetAssetWriter, 3 | #superclass : #LzHtmlTextSnippetAnnotationWriter, 4 | #category : #'Leibniz2-HTML-Export' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHtmlTextSnippetAssetWriter >> tag [ 9 | ^ #'leibniz-asset' 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzHtmlTextSnippetEqualityAxiomWriter.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHtmlTextSnippetEqualityAxiomWriter, 3 | #superclass : #LzHtmlTextSnippetAnnotationWriter, 4 | #category : #'Leibniz2-HTML-Export' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHtmlTextSnippetEqualityAxiomWriter >> tag [ 9 | ^ #'leibniz-equality-axiom' 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzHtmlTextSnippetOpWriter.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHtmlTextSnippetOpWriter, 3 | #superclass : #LzHtmlTextSnippetAnnotationWriter, 4 | #category : #'Leibniz2-HTML-Export' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHtmlTextSnippetOpWriter >> tag [ 9 | ^ #'leibniz-op' 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzHtmlTextSnippetSpecialTermsWriter.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHtmlTextSnippetSpecialTermsWriter, 3 | #superclass : #LzHtmlTextSnippetAnnotationWriter, 4 | #category : #'Leibniz2-HTML-Export' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHtmlTextSnippetSpecialTermsWriter >> tag [ 9 | ^ #'leibniz-special-terms' 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzHtmlTextSnippetSubsortWriter.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHtmlTextSnippetSubsortWriter, 3 | #superclass : #LzHtmlTextSnippetAnnotationWriter, 4 | #category : #'Leibniz2-HTML-Export' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHtmlTextSnippetSubsortWriter >> tag [ 9 | ^ #'leibniz-subsort' 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzHtmlTextSnippetUseContextWriter.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzHtmlTextSnippetUseContextWriter, 3 | #superclass : #LzHtmlTextSnippetAnnotationWriter, 4 | #category : #'Leibniz2-HTML-Export' 5 | } 6 | 7 | { #category : #accessing } 8 | LzHtmlTextSnippetUseContextWriter >> tag [ 9 | ^ #'leibniz-use-context' 10 | ] 11 | 12 | { #category : #'private - writing' } 13 | LzHtmlTextSnippetUseContextWriter >> writeDeclaration [ 14 | context pageLinks 15 | linkTitled: annotation pageName 16 | source allButFirst allButLast 17 | ifFound: [ :aPageLink | 18 | | url | 19 | url := self context hrefBuilder hrefFromPageLink: aPageLink. 20 | context html 21 | inlineTag: #a 22 | attributes: {'href' . url } 23 | do: [ LzHtmlSyntaxPiece new 24 | text: self declaration asLeibnizSyntax; 25 | writeWithContext: context ] ] 26 | ifNone: [ LzHtmlSyntaxPiece new 27 | text: self declaration asLeibnizSyntax; 28 | writeWithContext: context ] 29 | ] 30 | -------------------------------------------------------------------------------- /Leibniz2/LzIdentifierAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzIdentifierAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzInfixOpNameAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzInfixOpNameAttribute, 3 | #superclass : #LzIdentifierAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #rendering } 8 | LzInfixOpNameAttribute >> visualAttributesForColor: aColor [ 9 | ^ { BlTextForegroundAttribute new 10 | paint: aColor darker } 11 | ] 12 | -------------------------------------------------------------------------------- /Leibniz2/LzInfixOpNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzInfixOpNode, 3 | #superclass : #LzOpNode, 4 | #instVars : [ 5 | 'opName' 6 | ], 7 | #category : #'Leibniz2-SmaCCParser' 8 | } 9 | 10 | { #category : #generated } 11 | LzInfixOpNode >> acceptVisitor: aParseTreeVisitor [ 12 | ^ aParseTreeVisitor visitInfixOp: self 13 | ] 14 | 15 | { #category : #generated } 16 | LzInfixOpNode >> opName [ 17 | ^ opName 18 | ] 19 | 20 | { #category : #generated } 21 | LzInfixOpNode >> opName: aSmaCCToken [ 22 | opName := aSmaCCToken 23 | ] 24 | 25 | { #category : #generated } 26 | LzInfixOpNode >> tokenVariables [ 27 | ^ #(#opName) 28 | ] 29 | -------------------------------------------------------------------------------- /Leibniz2/LzInfixOpTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzInfixOpTermNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'args', 6 | 'opNames' 7 | ], 8 | #category : #'Leibniz2-SmaCCParser' 9 | } 10 | 11 | { #category : #generated } 12 | LzInfixOpTermNode >> acceptVisitor: aParseTreeVisitor [ 13 | ^ aParseTreeVisitor visitInfixOpTerm: self 14 | ] 15 | 16 | { #category : #generated } 17 | LzInfixOpTermNode >> args [ 18 | ^ args 19 | ] 20 | 21 | { #category : #generated } 22 | LzInfixOpTermNode >> args: anOrderedCollection [ 23 | self setParents: self args to: nil. 24 | args := anOrderedCollection. 25 | self setParents: self args to: self 26 | ] 27 | 28 | { #category : #generated } 29 | LzInfixOpTermNode >> compositeNodeVariables [ 30 | ^ #(#args) 31 | ] 32 | 33 | { #category : #generated } 34 | LzInfixOpTermNode >> compositeTokenVariables [ 35 | ^ #(#opNames) 36 | ] 37 | 38 | { #category : #'generated-initialize-release' } 39 | LzInfixOpTermNode >> initialize [ 40 | super initialize. 41 | args := OrderedCollection new: 2. 42 | opNames := OrderedCollection new: 2. 43 | ] 44 | 45 | { #category : #generated } 46 | LzInfixOpTermNode >> opNames [ 47 | ^ opNames 48 | ] 49 | 50 | { #category : #generated } 51 | LzInfixOpTermNode >> opNames: anOrderedCollection [ 52 | opNames := anOrderedCollection 53 | ] 54 | -------------------------------------------------------------------------------- /Leibniz2/LzIntegerLiteralDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzIntegerLiteralDeclaration, 3 | #superclass : #LzLiteralDeclaration, 4 | #category : #'Leibniz2-Declarations' 5 | } 6 | 7 | { #category : #accessing } 8 | LzIntegerLiteralDeclaration >> builtin [ 9 | ^ #integers 10 | ] 11 | 12 | { #category : #printing } 13 | LzIntegerLiteralDeclaration >> printAsLeibnizSyntaxOn: aStream [ 14 | value printOn: aStream 15 | ] 16 | 17 | { #category : #accessing } 18 | LzIntegerLiteralDeclaration >> termClass [ 19 | ^ LzIntegerTerm 20 | ] 21 | -------------------------------------------------------------------------------- /Leibniz2/LzIntegerLiteralTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzIntegerLiteralTermNode, 3 | #superclass : #LzLiteralTermNode, 4 | #category : #'Leibniz2-SmaCCParser' 5 | } 6 | 7 | { #category : #generated } 8 | LzIntegerLiteralTermNode >> acceptVisitor: aParseTreeVisitor [ 9 | ^ aParseTreeVisitor visitIntegerLiteralTerm: self 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzIntegerTerm.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzIntegerTerm, 3 | #superclass : #LzRationalNumberTerm, 4 | #category : #'Leibniz2-Terms' 5 | } 6 | 7 | { #category : #rewriting } 8 | LzIntegerTerm >> div: otherInteger [ 9 | | x y | 10 | x := self value. 11 | y := otherInteger value. 12 | (y = 0) 13 | ifTrue: [ LzRewriteFailure signal: 'division by zero' ]. 14 | ^ LzIntegerTerm 15 | signature: self signature 16 | value: ((x abs // y abs) * x sign * y sign) 17 | ] 18 | 19 | { #category : #rewriting } 20 | LzIntegerTerm >> rem: otherInteger [ 21 | | x y | 22 | x := self value. 23 | y := otherInteger value. 24 | (y = 0) 25 | ifTrue: [ LzRewriteFailure signal: 'division by zero' ]. 26 | ^ LzIntegerTerm 27 | signature: self signature 28 | value: ((x abs % y abs) * x sign * y sign) 29 | ] 30 | 31 | { #category : #accessing } 32 | LzIntegerTerm >> sort [ 33 | | symbol | 34 | symbol := value isZero 35 | ifTrue: [ #zero ] 36 | ifFalse: [ value positive 37 | ifTrue: [ value = 1 38 | ifTrue: [ #one ] 39 | ifFalse: [ #'ℕ.nz' ] ] 40 | ifFalse: [ #'ℤ.nz' ] ]. 41 | ^ self signature sort: symbol 42 | ] 43 | -------------------------------------------------------------------------------- /Leibniz2/LzLanguageTagAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzLanguageTagAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzLeafENode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzLeafENode, 3 | #superclass : #LzENode, 4 | #type : #variable, 5 | #instVars : [ 6 | 'leafTerm' 7 | ], 8 | #category : #'Leibniz2-EGraphs' 9 | } 10 | 11 | { #category : #comparing } 12 | LzLeafENode >> = anObject [ 13 | self == anObject ifTrue: [ ^ true ]. 14 | self class == anObject class ifFalse: [ ^ false ]. 15 | ^ self leafTerm = anObject leafTerm 16 | ] 17 | 18 | { #category : #converting } 19 | LzLeafENode >> addAsFirstArgOfInfixTermWithOpName: anOpName asRopedTextTo: aRopedText [ 20 | self leafTerm addAsFirstArgOfInfixTermWithOpName: anOpName asRopedTextTo: aRopedText 21 | ] 22 | 23 | { #category : #converting } 24 | LzLeafENode >> addAsRopedTextTo: aRopedText [ 25 | self leafTerm addAsRopedTextTo: aRopedText 26 | ] 27 | 28 | { #category : #enumerating } 29 | LzLeafENode >> allTerms [ 30 | ^ { self leafTerm } 31 | ] 32 | 33 | { #category : #updating } 34 | LzLeafENode >> canonicalizeIn: anEGraph [ 35 | "nothing to do!" 36 | ] 37 | 38 | { #category : #comparing } 39 | LzLeafENode >> hash [ 40 | ^ leafTerm hash 41 | ] 42 | 43 | { #category : #accessing } 44 | LzLeafENode >> leafTerm [ 45 | ^ leafTerm 46 | ] 47 | 48 | { #category : #accessing } 49 | LzLeafENode >> leafTerm: aTerm [ 50 | leafTerm := aTerm 51 | ] 52 | 53 | { #category : #matching } 54 | LzLeafENode >> matchesFor: aPattern bindings: bindings [ 55 | | b | 56 | b := bindings copy. 57 | aPattern match: self leafTerm bindings: b. 58 | ^ b 59 | ifSuccess: [ { b } ] 60 | ifFailure: [ #() ] 61 | ] 62 | 63 | { #category : #printing } 64 | LzLeafENode >> printAsLeibnizSyntaxOn: aStream [ 65 | self leafTerm printAsLeibnizSyntaxOn: aStream 66 | ] 67 | 68 | { #category : #printing } 69 | LzLeafENode >> printAsLeibnizSyntaxOn: aStream parents: aNodeSet [ 70 | self printAsLeibnizSyntaxOn: aStream 71 | ] 72 | 73 | { #category : #accessing } 74 | LzLeafENode >> sort [ 75 | ^ self leafTerm sort 76 | ] 77 | -------------------------------------------------------------------------------- /Leibniz2/LzLeafErrorAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzLeafErrorAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #accessing } 8 | LzLeafErrorAttribute >> visualAttributesForColor: aColor [ 9 | ^ { BlTextDecorationAttribute new 10 | underline; 11 | dashed; 12 | double; 13 | color: Color red } 14 | ] 15 | -------------------------------------------------------------------------------- /Leibniz2/LzLinePlot.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzLinePlot, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'points' 6 | ], 7 | #category : #'Leibniz2-Plotting' 8 | } 9 | 10 | { #category : #accessing } 11 | LzLinePlot >> asElement [ 12 | | data linePlot | 13 | data := GtPlotterDataGroup new 14 | values: points. 15 | linePlot := GtPlotterLineChart new 16 | valueX: #first; 17 | labelFormatX: [ :each | each printShowingDecimalPlaces: 1] ; 18 | scaleX: GtPlotterLinearScale new; 19 | titleX: 'x'; 20 | ticksX: 10; 21 | valueY: #second; 22 | labelFormatY: [ :each | each printShowingDecimalPlaces: 2 ] ; 23 | scaleY: GtPlotterLinearScale new; 24 | titleY: 'y'; 25 | ticksY: 10; 26 | with: data. 27 | 28 | ^ linePlot create 29 | ] 30 | 31 | { #category : #accessing } 32 | LzLinePlot >> points [ 33 | 34 | ^ points 35 | ] 36 | 37 | { #category : #accessing } 38 | LzLinePlot >> points: anObject [ 39 | 40 | points := anObject 41 | ] 42 | -------------------------------------------------------------------------------- /Leibniz2/LzLiteralAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzLiteralAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzLiteralDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzLiteralDeclaration, 3 | #superclass : #LzTermDeclaration, 4 | #instVars : [ 5 | 'value' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #converting } 11 | LzLiteralDeclaration >> addAsRopedTextTo: aRopedText [ 12 | aRopedText append: 13 | (self asLeibnizSyntaxString asRopedText attribute: LzLiteralAttribute new) 14 | ] 15 | 16 | { #category : #constructing } 17 | LzLiteralDeclaration >> buildFor: aSignature variables: aDictionary [ 18 | ^ aSignature 19 | literalTerm: self value 20 | class: self termClass 21 | builtin: self builtin 22 | ] 23 | 24 | { #category : #accessing } 25 | LzLiteralDeclaration >> builtin [ 26 | self subclassResponsibility 27 | ] 28 | 29 | { #category : #accessing } 30 | LzLiteralDeclaration >> termClass [ 31 | self subclassResponsibility 32 | ] 33 | 34 | { #category : #accessing } 35 | LzLiteralDeclaration >> value [ 36 | ^ value 37 | ] 38 | 39 | { #category : #accessing } 40 | LzLiteralDeclaration >> value: anObject [ 41 | value := anObject 42 | ] 43 | 44 | { #category : #accessing } 45 | LzLiteralDeclaration >> valueSlots [ 46 | ^ #(value) 47 | ] 48 | -------------------------------------------------------------------------------- /Leibniz2/LzLiteralTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzLiteralTermNode, 3 | #superclass : #LzTermNode, 4 | #instVars : [ 5 | 'text' 6 | ], 7 | #category : #'Leibniz2-SmaCCParser' 8 | } 9 | 10 | { #category : #generated } 11 | LzLiteralTermNode >> acceptVisitor: aParseTreeVisitor [ 12 | ^ aParseTreeVisitor visitLiteralTerm: self 13 | ] 14 | 15 | { #category : #generated } 16 | LzLiteralTermNode >> text [ 17 | ^ text 18 | ] 19 | 20 | { #category : #generated } 21 | LzLiteralTermNode >> text: aSmaCCToken [ 22 | text := aSmaCCToken 23 | ] 24 | 25 | { #category : #generated } 26 | LzLiteralTermNode >> tokenVariables [ 27 | ^ #(#text) 28 | ] 29 | -------------------------------------------------------------------------------- /Leibniz2/LzNonLeafENode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzNonLeafENode, 3 | #superclass : #LzENode, 4 | #type : #variable, 5 | #instVars : [ 6 | 'sort' 7 | ], 8 | #category : #'Leibniz2-EGraphs' 9 | } 10 | 11 | { #category : #enumerating } 12 | LzNonLeafENode >> allArgTerms: classIds [ 13 | classIds ifEmpty: [ ^ #(#()) ]. 14 | ^ Generator on: [ :generator | 15 | | gFirst gRest | 16 | gFirst := (graph classForId: classIds first) allTerms. 17 | gRest := self allArgTerms: classIds allButFirst. 18 | gFirst do: [ :firstArg | 19 | gRest do: [ :restArgs | 20 | generator yield: { firstArg }, restArgs ] ] ] 21 | ] 22 | 23 | { #category : #updating } 24 | LzNonLeafENode >> canonicalizeIn: anEGraph [ 25 | | oldClassId | 26 | oldClassId := nil. 27 | 1 to: self size do: [ :index | 28 | | classId rootId | 29 | classId := self at: index. 30 | rootId := anEGraph findRootFor: classId. 31 | (oldClassId isNil and: [ rootId ~= classId ]) ifTrue: [ 32 | oldClassId := anEGraph removeFromMemo: self ]. 33 | self at: index put: rootId ]. 34 | oldClassId ifNotNil: [ anEGraph addMemoEntry: self classId: oldClassId ] 35 | ] 36 | 37 | { #category : #testing } 38 | LzNonLeafENode >> hasLinkToAncestorIn: aSet [ 39 | ^ self 40 | detect: [ :each | 41 | | class | 42 | class := graph classForId: each. 43 | (aSet includes: class) or: [ class hasLinkToAncestorIn: aSet ] ] 44 | ifFound: [ true ] 45 | ifNone: [ false ] 46 | ] 47 | 48 | { #category : #printing } 49 | LzNonLeafENode >> printAsLeibnizSyntaxOn: aStream [ 50 | self 51 | printAsLeibnizSyntaxOn: aStream 52 | parents: IdentitySet new 53 | ] 54 | 55 | { #category : #accessing } 56 | LzNonLeafENode >> sort [ 57 | ^ sort 58 | ] 59 | 60 | { #category : #accessing } 61 | LzNonLeafENode >> sort: aSort [ 62 | sort := aSort 63 | ] 64 | -------------------------------------------------------------------------------- /Leibniz2/LzOpArgNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzOpArgNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'name', 6 | 'colon', 7 | 'sort' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzOpArgNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitOpArg: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzOpArgNode >> colon [ 19 | ^ colon 20 | ] 21 | 22 | { #category : #generated } 23 | LzOpArgNode >> colon: aSmaCCToken [ 24 | colon := aSmaCCToken 25 | ] 26 | 27 | { #category : #generated } 28 | LzOpArgNode >> name [ 29 | ^ name 30 | ] 31 | 32 | { #category : #generated } 33 | LzOpArgNode >> name: aSmaCCToken [ 34 | name := aSmaCCToken 35 | ] 36 | 37 | { #category : #generated } 38 | LzOpArgNode >> nodeVariables [ 39 | ^ #(#sort) 40 | ] 41 | 42 | { #category : #generated } 43 | LzOpArgNode >> sort [ 44 | ^ sort 45 | ] 46 | 47 | { #category : #generated } 48 | LzOpArgNode >> sort: aLzParseTreeNode [ 49 | self sort notNil ifTrue: [ self sort parent: nil ]. 50 | sort := aLzParseTreeNode. 51 | self sort notNil ifTrue: [ self sort parent: self ] 52 | ] 53 | 54 | { #category : #generated } 55 | LzOpArgNode >> tokenVariables [ 56 | ^ #(#name #colon) 57 | ] 58 | -------------------------------------------------------------------------------- /Leibniz2/LzOpNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzOpNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'args' 6 | ], 7 | #category : #'Leibniz2-SmaCCParser' 8 | } 9 | 10 | { #category : #generated } 11 | LzOpNode >> acceptVisitor: aParseTreeVisitor [ 12 | ^ aParseTreeVisitor visitOp: self 13 | ] 14 | 15 | { #category : #generated } 16 | LzOpNode >> args [ 17 | ^ args 18 | ] 19 | 20 | { #category : #generated } 21 | LzOpNode >> args: anOrderedCollection [ 22 | self setParents: self args to: nil. 23 | args := anOrderedCollection. 24 | self setParents: self args to: self 25 | ] 26 | 27 | { #category : #generated } 28 | LzOpNode >> compositeNodeVariables [ 29 | ^ #(#args) 30 | ] 31 | 32 | { #category : #'generated-initialize-release' } 33 | LzOpNode >> initialize [ 34 | super initialize. 35 | args := OrderedCollection new: 2. 36 | ] 37 | -------------------------------------------------------------------------------- /Leibniz2/LzOpSortFamily.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzOpSortFamily, 3 | #superclass : #LzSortFamily, 4 | #instVars : [ 5 | 'op' 6 | ], 7 | #category : #'Leibniz2-Sorts' 8 | } 9 | 10 | { #category : #converting } 11 | LzOpSortFamily >> addAsRopedTextTo: aRopedText [ 12 | self op opName addForArity: op onlyRank key asRopedTextTo: aRopedText 13 | ] 14 | 15 | { #category : #accessing } 16 | LzOpSortFamily >> contravarianceFlags [ 17 | self flag: #contravariant. 18 | ^ self op onlyRank value term args 19 | ifEmpty: [ String new: self op onlyRank key size withAll: $0 ] 20 | ifNotEmpty: [ :args | args first value ] 21 | ] 22 | 23 | { #category : #inspecting } 24 | LzOpSortFamily >> gtGraphFor: aView [ 25 | 26 | ^ (self sortGraph 27 | graphFor: aView 28 | highlight: [ :x | x = self ]) 29 | priority: 1 30 | ] 31 | 32 | { #category : #accessing } 33 | LzOpSortFamily >> op [ 34 | ^ op 35 | ] 36 | 37 | { #category : #accessing } 38 | LzOpSortFamily >> op: anOperator [ 39 | self assert: anOperator size equals: 1. 40 | self flag: #todo. "Allow multiple ranks if there is a unique highest one." 41 | op := anOperator 42 | ] 43 | 44 | { #category : #printing } 45 | LzOpSortFamily >> printAsLeibnizSyntaxOn: aStream [ 46 | self op opName printForArity: op onlyRank key on: aStream 47 | ] 48 | 49 | { #category : #accessing } 50 | LzOpSortFamily >> valueSlots [ 51 | ^ #(op) 52 | ] 53 | -------------------------------------------------------------------------------- /Leibniz2/LzOpTermDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzOpTermDeclaration, 3 | #superclass : #LzTermDeclaration, 4 | #instVars : [ 5 | 'opName', 6 | 'args' 7 | ], 8 | #category : #'Leibniz2-Declarations' 9 | } 10 | 11 | { #category : #converting } 12 | LzOpTermDeclaration >> addAsRopedTextTo: aRopedText [ 13 | opName addForArgs: args asRopedTextTo: aRopedText 14 | ] 15 | 16 | { #category : #accessing } 17 | LzOpTermDeclaration >> args [ 18 | 19 | ^ args 20 | ] 21 | 22 | { #category : #accessing } 23 | LzOpTermDeclaration >> args: anObject [ 24 | args := anObject asArray 25 | ] 26 | 27 | { #category : #constructing } 28 | LzOpTermDeclaration >> buildFor: aSignature variables: aDictionary [ 29 | LzDebuggingUtilities checkForInfiniteRecursion. 30 | ^ aSignature 31 | opTerm: self opName 32 | args: (self args collect: [ :each | 33 | each buildFor: aSignature variables: aDictionary ]) 34 | ] 35 | 36 | { #category : #accessing } 37 | LzOpTermDeclaration >> hasInfixOpOtherThan: anOpName [ 38 | ^ self opName isInfixOpOtherThan: anOpName 39 | ] 40 | 41 | { #category : #testing } 42 | LzOpTermDeclaration >> isInfix [ 43 | ^ self opName isInfix 44 | ] 45 | 46 | { #category : #accessing } 47 | LzOpTermDeclaration >> opName [ 48 | 49 | ^ opName 50 | ] 51 | 52 | { #category : #acccessing } 53 | LzOpTermDeclaration >> opName: anOpName [ 54 | opName := anOpName 55 | ] 56 | 57 | { #category : #printing } 58 | LzOpTermDeclaration >> printAsLeibnizSyntaxOn: aStream [ 59 | opName printForArgs: args on: aStream 60 | ] 61 | 62 | { #category : #accessing } 63 | LzOpTermDeclaration >> valueSlots [ 64 | ^ #(opName args) 65 | ] 66 | -------------------------------------------------------------------------------- /Leibniz2/LzOptionNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzOptionNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'comma', 6 | 'key', 7 | 'value' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzOptionNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitOption: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzOptionNode >> comma [ 19 | ^ comma 20 | ] 21 | 22 | { #category : #generated } 23 | LzOptionNode >> comma: aSmaCCToken [ 24 | comma := aSmaCCToken 25 | ] 26 | 27 | { #category : #generated } 28 | LzOptionNode >> key [ 29 | ^ key 30 | ] 31 | 32 | { #category : #generated } 33 | LzOptionNode >> key: aSmaCCToken [ 34 | key := aSmaCCToken 35 | ] 36 | 37 | { #category : #generated } 38 | LzOptionNode >> nodeVariables [ 39 | ^ #(#value) 40 | ] 41 | 42 | { #category : #generated } 43 | LzOptionNode >> tokenVariables [ 44 | ^ #(#comma #key) 45 | ] 46 | 47 | { #category : #generated } 48 | LzOptionNode >> value [ 49 | ^ value 50 | ] 51 | 52 | { #category : #generated } 53 | LzOptionNode >> value: aLzLiteralTermNode [ 54 | self value notNil ifTrue: [ self value parent: nil ]. 55 | value := aLzLiteralTermNode. 56 | self value notNil ifTrue: [ self value parent: self ] 57 | ] 58 | -------------------------------------------------------------------------------- /Leibniz2/LzPageContextChanged.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPageContextChanged, 3 | #superclass : #Announcement, 4 | #instVars : [ 5 | 'page', 6 | 'subcontext' 7 | ], 8 | #category : #'Leibniz2-Lepiter' 9 | } 10 | 11 | { #category : #accessing } 12 | LzPageContextChanged >> page [ 13 | ^ page 14 | ] 15 | 16 | { #category : #accessing } 17 | LzPageContextChanged >> page: anObject [ 18 | page := anObject 19 | ] 20 | 21 | { #category : #accessing } 22 | LzPageContextChanged >> subcontext [ 23 | ^ subcontext 24 | ] 25 | 26 | { #category : #accessing } 27 | LzPageContextChanged >> subcontext: anObject [ 28 | subcontext := anObject 29 | ] 30 | -------------------------------------------------------------------------------- /Leibniz2/LzPageDeclarationsChanged.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPageDeclarationsChanged, 3 | #superclass : #Announcement, 4 | #instVars : [ 5 | 'subcontexts', 6 | 'page' 7 | ], 8 | #category : #'Leibniz2-Lepiter' 9 | } 10 | 11 | { #category : #accessing } 12 | LzPageDeclarationsChanged >> page [ 13 | 14 | ^ page 15 | ] 16 | 17 | { #category : #accessing } 18 | LzPageDeclarationsChanged >> page: aLePage [ 19 | page := aLePage 20 | ] 21 | 22 | { #category : #accessing } 23 | LzPageDeclarationsChanged >> subcontexts [ 24 | ^ subcontexts 25 | ] 26 | 27 | { #category : #accessing } 28 | LzPageDeclarationsChanged >> subcontexts: anArray [ 29 | subcontexts := anArray 30 | ] 31 | -------------------------------------------------------------------------------- /Leibniz2/LzPageReferenceNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPageReferenceNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'name', 6 | 'equals', 7 | 'value' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzPageReferenceNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitPageReference: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzPageReferenceNode >> equals [ 19 | ^ equals 20 | ] 21 | 22 | { #category : #generated } 23 | LzPageReferenceNode >> equals: aSmaCCToken [ 24 | equals := aSmaCCToken 25 | ] 26 | 27 | { #category : #generated } 28 | LzPageReferenceNode >> name [ 29 | ^ name 30 | ] 31 | 32 | { #category : #generated } 33 | LzPageReferenceNode >> name: aSmaCCToken [ 34 | name := aSmaCCToken 35 | ] 36 | 37 | { #category : #generated } 38 | LzPageReferenceNode >> tokenVariables [ 39 | ^ #(#name #equals #value) 40 | ] 41 | 42 | { #category : #generated } 43 | LzPageReferenceNode >> value [ 44 | ^ value 45 | ] 46 | 47 | { #category : #generated } 48 | LzPageReferenceNode >> value: aSmaCCToken [ 49 | value := aSmaCCToken 50 | ] 51 | -------------------------------------------------------------------------------- /Leibniz2/LzParenthesesAnnotation.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzParenthesesAnnotation, 3 | #superclass : #LzDeclarationAnnotation, 4 | #category : #'Leibniz2-Declarations' 5 | } 6 | 7 | { #category : #converting } 8 | LzParenthesesAnnotation >> addAsFirstArgOfInfixTermWithOpName: anOpName asRopedTextTo: aRopedText [ 9 | self declaration addAsRopedTextTo: aRopedText parenthesized: true 10 | ] 11 | 12 | { #category : #converting } 13 | LzParenthesesAnnotation >> addAsRopedTextTo: aRopedText [ 14 | self declaration addAsRopedTextTo: aRopedText parenthesized: true 15 | ] 16 | 17 | { #category : #constructing } 18 | LzParenthesesAnnotation >> buildFor: aSignature variables: aDictionary [ 19 | ^ self declaration buildFor: aSignature variables: aDictionary 20 | ] 21 | 22 | { #category : #testing } 23 | LzParenthesesAnnotation >> hasInfixOpOtherThan: aSymbol [ 24 | ^ false 25 | ] 26 | 27 | { #category : #testing } 28 | LzParenthesesAnnotation >> isInfix [ 29 | ^ false 30 | ] 31 | 32 | { #category : #printing } 33 | LzParenthesesAnnotation >> printAsFirstArgOfInfixTermWithOpName: anOpName on: aStream [ 34 | self declaration printAsLeibnizSyntaxOn: aStream parenthesized: true 35 | ] 36 | 37 | { #category : #printing } 38 | LzParenthesesAnnotation >> printAsLeibnizSyntaxOn: aStream [ 39 | self declaration printAsLeibnizSyntaxOn: aStream parenthesized: true 40 | ] 41 | -------------------------------------------------------------------------------- /Leibniz2/LzParenthesisAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzParenthesisAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #rendering } 8 | LzParenthesisAttribute >> visualAttributesForColor: aColor [ 9 | ^ { BlTextForegroundAttribute new 10 | paint: aColor darker } 11 | ] 12 | -------------------------------------------------------------------------------- /Leibniz2/LzParenthesizedTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzParenthesizedTermNode, 3 | #superclass : #LzTermNode, 4 | #instVars : [ 5 | 'leftParen', 6 | 'term', 7 | 'rightParen' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzParenthesizedTermNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitParenthesizedTerm: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzParenthesizedTermNode >> leftParen [ 19 | ^ leftParen 20 | ] 21 | 22 | { #category : #generated } 23 | LzParenthesizedTermNode >> leftParen: aSmaCCToken [ 24 | leftParen := aSmaCCToken 25 | ] 26 | 27 | { #category : #generated } 28 | LzParenthesizedTermNode >> nodeVariables [ 29 | ^ #(#term) 30 | ] 31 | 32 | { #category : #generated } 33 | LzParenthesizedTermNode >> rightParen [ 34 | ^ rightParen 35 | ] 36 | 37 | { #category : #generated } 38 | LzParenthesizedTermNode >> rightParen: aSmaCCToken [ 39 | rightParen := aSmaCCToken 40 | ] 41 | 42 | { #category : #generated } 43 | LzParenthesizedTermNode >> term [ 44 | ^ term 45 | ] 46 | 47 | { #category : #generated } 48 | LzParenthesizedTermNode >> term: aLzParseTreeNode [ 49 | self term notNil ifTrue: [ self term parent: nil ]. 50 | term := aLzParseTreeNode. 51 | self term notNil ifTrue: [ self term parent: self ] 52 | ] 53 | 54 | { #category : #generated } 55 | LzParenthesizedTermNode >> tokenVariables [ 56 | ^ #(#leftParen #rightParen) 57 | ] 58 | -------------------------------------------------------------------------------- /Leibniz2/LzParseTreeNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzParseTreeNode, 3 | #superclass : #SmaCCParseNode, 4 | #category : #'Leibniz2-SmaCCParser' 5 | } 6 | 7 | { #category : #generated } 8 | LzParseTreeNode >> acceptVisitor: aParseTreeVisitor [ 9 | ^ aParseTreeVisitor visitParseTree: self 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzParseTreeNodeVisitor.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzParseTreeNodeVisitor, 3 | #superclass : #Object, 4 | #traits : 'TLzParseTreeNodeVisitor', 5 | #classTraits : 'TLzParseTreeNodeVisitor classTrait', 6 | #category : #'Leibniz2-SmaCCParser' 7 | } 8 | -------------------------------------------------------------------------------- /Leibniz2/LzPatternDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPatternDeclaration, 3 | #superclass : #LzDeclarationWithVariables, 4 | #instVars : [ 5 | 'term' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #converting } 11 | LzPatternDeclaration >> addBodyAsRopedTextTo: aRopedText [ 12 | term addAsRopedTextTo: aRopedText 13 | ] 14 | 15 | { #category : #constructing } 16 | LzPatternDeclaration >> buildFor: aSignature [ 17 | ^ self term 18 | buildFor: aSignature 19 | variables: (aSignature parsedVariables: self variables) 20 | ] 21 | 22 | { #category : #constructing } 23 | LzPatternDeclaration >> buildFor: aSignature variables: aDictionary [ 24 | | localVars | 25 | localVars := aSignature parsedVariables: self variables. 26 | aDictionary keysAndValuesDo: [ :var :sort | 27 | | localSort | 28 | localSort := localVars at: var ifAbsent: [ sort ]. 29 | localSort = sort ifFalse: [ 30 | self error: 'Local var definition inconsistent with global definition' ]. 31 | localVars at: var put: sort ]. 32 | ^ self term 33 | buildFor: aSignature 34 | variables: localVars 35 | ] 36 | 37 | { #category : #testing } 38 | LzPatternDeclaration >> definesContext [ 39 | ^ false 40 | ] 41 | 42 | { #category : #constructing } 43 | LzPatternDeclaration >> objectFor: aContext [ 44 | ^ LzTermInContext 45 | term: (aContext parsedPattern: self) 46 | context: aContext 47 | ] 48 | 49 | { #category : #printing } 50 | LzPatternDeclaration >> printBodyAsLeibnizSyntaxOn: aStream [ 51 | term printAsLeibnizSyntaxOn: aStream 52 | ] 53 | 54 | { #category : #accessing } 55 | LzPatternDeclaration >> term [ 56 | ^ term 57 | ] 58 | 59 | { #category : #accessing } 60 | LzPatternDeclaration >> term: anObject [ 61 | term := anObject 62 | ] 63 | 64 | { #category : #accessing } 65 | LzPatternDeclaration >> valueSlots [ 66 | ^ #(term variables) 67 | ] 68 | -------------------------------------------------------------------------------- /Leibniz2/LzPatternNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPatternNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'vars', 6 | 'commas', 7 | 'term' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzPatternNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitPattern: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzPatternNode >> commas [ 19 | ^ commas 20 | ] 21 | 22 | { #category : #generated } 23 | LzPatternNode >> commas: anOrderedCollection [ 24 | commas := anOrderedCollection 25 | ] 26 | 27 | { #category : #generated } 28 | LzPatternNode >> compositeNodeVariables [ 29 | ^ #(#vars) 30 | ] 31 | 32 | { #category : #generated } 33 | LzPatternNode >> compositeTokenVariables [ 34 | ^ #(#commas) 35 | ] 36 | 37 | { #category : #'generated-initialize-release' } 38 | LzPatternNode >> initialize [ 39 | super initialize. 40 | vars := OrderedCollection new: 2. 41 | commas := OrderedCollection new: 2. 42 | ] 43 | 44 | { #category : #generated } 45 | LzPatternNode >> nodeVariables [ 46 | ^ #(#term) 47 | ] 48 | 49 | { #category : #generated } 50 | LzPatternNode >> term [ 51 | ^ term 52 | ] 53 | 54 | { #category : #generated } 55 | LzPatternNode >> term: aLzParseTreeNode [ 56 | self term notNil ifTrue: [ self term parent: nil ]. 57 | term := aLzParseTreeNode. 58 | self term notNil ifTrue: [ self term parent: self ] 59 | ] 60 | 61 | { #category : #generated } 62 | LzPatternNode >> vars [ 63 | ^ vars 64 | ] 65 | 66 | { #category : #generated } 67 | LzPatternNode >> vars: anOrderedCollection [ 68 | self setParents: self vars to: nil. 69 | vars := anOrderedCollection. 70 | self setParents: self vars to: self 71 | ] 72 | -------------------------------------------------------------------------------- /Leibniz2/LzPharoCodeAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPharoCodeAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzPhlowColumnedTreeView.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPhlowColumnedTreeView, 3 | #superclass : #GtPhlowColumnedTreeView, 4 | #instVars : [ 5 | 'initiallyExpandedRootNodes' 6 | ], 7 | #category : #'Leibniz2-Infrastructure' 8 | } 9 | 10 | { #category : #'api - scripting tree node expansion' } 11 | LzPhlowColumnedTreeView >> expandItems: anArray [ 12 | initiallyExpandedRootNodes := anArray 13 | ] 14 | 15 | { #category : #'private - actions' } 16 | LzPhlowColumnedTreeView >> expandTree: aBrColumnedTree [ 17 | aBrColumnedTree collapseAll. 18 | aBrColumnedTree viewModel root childrenNodes do: [ :each | 19 | (initiallyExpandedRootNodes includes: each value) 20 | ifTrue: [ each expand ] ] 21 | ] 22 | -------------------------------------------------------------------------------- /Leibniz2/LzPhlowTreeView.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPhlowTreeView, 3 | #superclass : #GtPhlowTreeView, 4 | #instVars : [ 5 | 'initiallyExpandedRootNodes' 6 | ], 7 | #category : #'Leibniz2-Infrastructure' 8 | } 9 | 10 | { #category : #'api - scripting tree node expansion' } 11 | LzPhlowTreeView >> expandItems: anArray [ 12 | initiallyExpandedRootNodes := anArray 13 | ] 14 | 15 | { #category : #'private - building' } 16 | LzPhlowTreeView >> expandTree: aBrTree [ 17 | aBrTree collapseAll. 18 | aBrTree viewModel root childrenNodes do: [ :each | 19 | (initiallyExpandedRootNodes includes: each value first) 20 | ifTrue: [ each expand ] ] 21 | ] 22 | -------------------------------------------------------------------------------- /Leibniz2/LzPlotTerm.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPlotTerm, 3 | #superclass : #LzTermInContext, 4 | #category : #'Leibniz2-Plotting' 5 | } 6 | 7 | { #category : #inspecting } 8 | LzPlotTerm >> gtViewFor: aView [ 9 | 10 | ^ aView forward 11 | title: 'Plot'; 12 | priority: 0; 13 | object: [ self inlineView ]; 14 | view: #gtLiveFor:. 15 | ] 16 | 17 | { #category : #testing } 18 | LzPlotTerm >> hasInlineView [ 19 | ^ true 20 | ] 21 | 22 | { #category : #viewing } 23 | LzPlotTerm >> inlineView [ 24 | self assert: self normalForm opName asSymbol = #linePlot. 25 | ^ (LzLinePlot new 26 | points: self xyValues) 27 | asElement 28 | ] 29 | 30 | { #category : #data } 31 | LzPlotTerm >> xValuesFrom: xArray yValuesFrom: yArray [ 32 | | x y | 33 | x := xArray elements collect: #value. 34 | y := yArray elements collect: #value. 35 | ^ x with: y collect: [ :xv :yv | { xv. yv } ] 36 | ] 37 | 38 | { #category : #data } 39 | LzPlotTerm >> xyValues [ 40 | | args | 41 | args := self normalForm args. 42 | args size = 1 ifTrue: [ ^ self xyValuesFrom: args first ]. 43 | args size = 2 ifTrue: [ ^ self xValuesFrom: args first yValuesFrom: args second ]. 44 | self notYetImplemented 45 | ] 46 | 47 | { #category : #data } 48 | LzPlotTerm >> xyValuesFrom: anArrayTerm [ 49 | ^ anArrayTerm elements collect: [ :each | 50 | { each args first value. each args second value. } ] 51 | ] 52 | -------------------------------------------------------------------------------- /Leibniz2/LzPrefixOpName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPrefixOpName, 3 | #superclass : #LzOpName, 4 | #category : #'Leibniz2-Declarations' 5 | } 6 | 7 | { #category : #'instance creation' } 8 | LzPrefixOpName class >> for: aStringOrSymbol [ 9 | ^ self new internalSymbol: aStringOrSymbol 10 | ] 11 | 12 | { #category : #converting } 13 | LzPrefixOpName >> addAsRopedTextTo: aRopedText [ 14 | aRopedText append: 15 | (internalSymbol asRopedText attribute: LzPrefixOpNameAttribute new). 16 | ] 17 | 18 | { #category : #converting } 19 | LzPrefixOpName >> addForArgs: anArrayOfTerms asRopedTextTo: aRopedText argAttributes: anArrayOfAttributes [ 20 | self addAsRopedTextTo: aRopedText. 21 | anArrayOfTerms ifNotEmpty: [ 22 | aRopedText append: '(' asRopedText. 23 | anArrayOfTerms 24 | do: [ :each | 25 | self 26 | do: [ :t | each addAsRopedTextTo: t ] 27 | to: aRopedText 28 | withAttributes: anArrayOfAttributes ] 29 | separatedBy: [ aRopedText append: ', ' asRopedText ]. 30 | aRopedText append: ')' asRopedText ] 31 | ] 32 | 33 | { #category : #printing } 34 | LzPrefixOpName >> printForArgs: anENodeArray on: aStream parents: aNodeSet [ 35 | aStream nextPutAll: internalSymbol. 36 | anENodeArray ifNotEmpty: [ 37 | aStream nextPut: $(. 38 | anENodeArray allButLastDo: [ :each | 39 | each printAsLeibnizSyntaxOn: aStream parents: aNodeSet. 40 | aStream nextPutAll: ', ' ]. 41 | anENodeArray last 42 | printAsLeibnizSyntaxOn: aStream 43 | parents: aNodeSet. 44 | aStream nextPut: $) ] 45 | ] 46 | 47 | { #category : #printing } 48 | LzPrefixOpName >> printForArity: anArity on: aStream [ 49 | aStream nextPutAll: internalSymbol. 50 | anArity ifNotEmpty: [ 51 | aStream nextPut: $(. 52 | anArity allButLastDo: [ :each | 53 | each printAsLeibnizSyntaxOn: aStream. 54 | aStream nextPutAll: ', ' ]. 55 | anArity last printAsLeibnizSyntaxOn: aStream. 56 | aStream nextPut: $) ] 57 | ] 58 | -------------------------------------------------------------------------------- /Leibniz2/LzPrefixOpNameAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPrefixOpNameAttribute, 3 | #superclass : #LzIdentifierAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzPrefixOpNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPrefixOpNode, 3 | #superclass : #LzOpNode, 4 | #instVars : [ 5 | 'opName', 6 | 'leftParen', 7 | 'commas', 8 | 'rightParen' 9 | ], 10 | #category : #'Leibniz2-SmaCCParser' 11 | } 12 | 13 | { #category : #generated } 14 | LzPrefixOpNode >> acceptVisitor: aParseTreeVisitor [ 15 | ^ aParseTreeVisitor visitPrefixOp: self 16 | ] 17 | 18 | { #category : #generated } 19 | LzPrefixOpNode >> commas [ 20 | ^ commas 21 | ] 22 | 23 | { #category : #generated } 24 | LzPrefixOpNode >> commas: anOrderedCollection [ 25 | commas := anOrderedCollection 26 | ] 27 | 28 | { #category : #generated } 29 | LzPrefixOpNode >> compositeTokenVariables [ 30 | ^ #(#commas) 31 | ] 32 | 33 | { #category : #'generated-initialize-release' } 34 | LzPrefixOpNode >> initialize [ 35 | super initialize. 36 | commas := OrderedCollection new: 2. 37 | ] 38 | 39 | { #category : #generated } 40 | LzPrefixOpNode >> leftParen [ 41 | ^ leftParen 42 | ] 43 | 44 | { #category : #generated } 45 | LzPrefixOpNode >> leftParen: aSmaCCToken [ 46 | leftParen := aSmaCCToken 47 | ] 48 | 49 | { #category : #generated } 50 | LzPrefixOpNode >> opName [ 51 | ^ opName 52 | ] 53 | 54 | { #category : #generated } 55 | LzPrefixOpNode >> opName: aSmaCCToken [ 56 | opName := aSmaCCToken 57 | ] 58 | 59 | { #category : #generated } 60 | LzPrefixOpNode >> rightParen [ 61 | ^ rightParen 62 | ] 63 | 64 | { #category : #generated } 65 | LzPrefixOpNode >> rightParen: aSmaCCToken [ 66 | rightParen := aSmaCCToken 67 | ] 68 | 69 | { #category : #generated } 70 | LzPrefixOpNode >> tokenVariables [ 71 | ^ #(#opName #leftParen #rightParen) 72 | ] 73 | -------------------------------------------------------------------------------- /Leibniz2/LzPythonCode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzPythonCode, 3 | #superclass : #Object, 4 | #category : #'Leibniz2-Lepiter' 5 | } 6 | 7 | { #category : #accessing } 8 | LzPythonCode class >> fromChildrenOfSnippet: aUidString [ 9 | | snippet code | 10 | snippet := LzSnippetTerm snippetWithUID: aUidString. 11 | code := String streamContents: [ :s | 12 | snippet allChildrenDepthFirstDo: [ :each | 13 | (each isKindOf: LePythonSnippet) ifTrue: [ 14 | s << each text asString. 15 | s << Character cr ] ] ]. 16 | ^ code 17 | ] 18 | -------------------------------------------------------------------------------- /Leibniz2/LzRationalLiteralDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzRationalLiteralDeclaration, 3 | #superclass : #LzLiteralDeclaration, 4 | #category : #'Leibniz2-Declarations' 5 | } 6 | 7 | { #category : #accessing } 8 | LzRationalLiteralDeclaration >> builtin [ 9 | ^ #rationalNumbers 10 | ] 11 | 12 | { #category : #printing } 13 | LzRationalLiteralDeclaration >> printAsLeibnizSyntaxOn: aStream [ 14 | value numerator printOn: aStream. 15 | value denominator = 1 ifFalse: [ 16 | aStream nextPut: $/. 17 | value denominator printOn: aStream ] 18 | ] 19 | 20 | { #category : #accessing } 21 | LzRationalLiteralDeclaration >> termClass [ 22 | ^ LzRationalNumberTerm 23 | ] 24 | -------------------------------------------------------------------------------- /Leibniz2/LzRationalNumberLiteralTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzRationalNumberLiteralTermNode, 3 | #superclass : #LzLiteralTermNode, 4 | #category : #'Leibniz2-SmaCCParser' 5 | } 6 | 7 | { #category : #generated } 8 | LzRationalNumberLiteralTermNode >> acceptVisitor: aParseTreeVisitor [ 9 | ^ aParseTreeVisitor visitRationalNumberLiteralTerm: self 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzRewriteArrowAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzRewriteArrowAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzRewriteCache.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzRewriteCache, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'rewriteSystem', 6 | 'termCache', 7 | 'signature' 8 | ], 9 | #category : #'Leibniz2-Rules' 10 | } 11 | 12 | { #category : #initializing } 13 | LzRewriteCache >> clearCache [ 14 | termCache := Dictionary new 15 | ] 16 | 17 | { #category : #inspecting } 18 | LzRewriteCache >> gtTermsFor: aView [ 19 | 20 | termCache ifEmpty: [ ^ aView empty ]. 21 | ^ aView columnedList 22 | title: 'Terms'; 23 | priority: 5; 24 | items: [ termCache associations ]; 25 | column: 'Term' text: [ :each | each key asLeibnizSyntax ]; 26 | column: 'Normal form' text: [ :each | each value asLeibnizSyntax ]; 27 | yourself. 28 | ] 29 | 30 | { #category : #initializing } 31 | LzRewriteCache >> initialize [ 32 | self clearCache 33 | ] 34 | 35 | { #category : #rewriting } 36 | LzRewriteCache >> reduce: aTerm [ 37 | self assert: aTerm signature equals: signature. 38 | ^ termCache 39 | at: aTerm 40 | ifAbsentPut: [ 41 | | rewritten | 42 | rewritten := self rewriteSystem 43 | rewriteLeftmostInnermost: aTerm 44 | reducer: [ :t | self reduce: t ]. 45 | rewritten = aTerm 46 | ifTrue: [ aTerm ] 47 | ifFalse: [ self reduce: rewritten ] ] 48 | ] 49 | 50 | { #category : #accessing } 51 | LzRewriteCache >> rewriteSystem [ 52 | 53 | ^ rewriteSystem 54 | ] 55 | 56 | { #category : #accessing } 57 | LzRewriteCache >> rewriteSystem: aRewriteSystem [ 58 | rewriteSystem := aRewriteSystem. 59 | signature := aRewriteSystem signature 60 | ] 61 | -------------------------------------------------------------------------------- /Leibniz2/LzRewriteFailure.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzRewriteFailure, 3 | #superclass : #Exception, 4 | #category : #'Leibniz2-Rules' 5 | } 6 | 7 | { #category : #accessing } 8 | LzRewriteFailure >> defaultAction [ 9 | "The default action taken if the exception is signaled." 10 | UnhandledError signalForException: self 11 | ] 12 | -------------------------------------------------------------------------------- /Leibniz2/LzRewriteRuleDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzRewriteRuleDeclaration, 3 | #superclass : #LzRuleDeclaration, 4 | #instVars : [ 5 | 'replacement' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #converting } 11 | LzRewriteRuleDeclaration >> addBodyAsRopedTextTo: aRopedText [ 12 | self pattern addAsRopedTextTo: aRopedText. 13 | aRopedText append: 14 | (' ⇒ ' asRopedText attribute: LzRewriteArrowAttribute new). 15 | self replacement addAsRopedTextTo: aRopedText. 16 | condition ifNotNil: [ :c | 17 | aRopedText append: 18 | (' | ' asRopedText attribute: LzConditionAttribute new). 19 | c addAsRopedTextTo: aRopedText ] 20 | ] 21 | 22 | { #category : #printing } 23 | LzRewriteRuleDeclaration >> printBodyAsLeibnizSyntaxOn: aStream [ 24 | self pattern printAsLeibnizSyntaxOn: aStream. 25 | aStream nextPutAll: ' ⇒ '. 26 | self replacement printAsLeibnizSyntaxOn: aStream. 27 | condition ifNotNil: [ 28 | aStream nextPutAll: ' | '. 29 | self condition printAsLeibnizSyntaxOn: aStream ] 30 | ] 31 | 32 | { #category : #accessing } 33 | LzRewriteRuleDeclaration >> replacement [ 34 | ^ replacement 35 | ] 36 | 37 | { #category : #accessing } 38 | LzRewriteRuleDeclaration >> replacement: aTermNode [ 39 | replacement := aTermNode 40 | ] 41 | 42 | { #category : #accessing } 43 | LzRewriteRuleDeclaration >> ruleClass [ 44 | ^ LzRewriteRule 45 | ] 46 | 47 | { #category : #accessing } 48 | LzRewriteRuleDeclaration >> valueSlots [ 49 | ^ super valueSlots, #(replacement) 50 | ] 51 | -------------------------------------------------------------------------------- /Leibniz2/LzRuleMatcher.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzRuleMatcher, 3 | #superclass : #LzPatternMatcher, 4 | #instVars : [ 5 | 'rule' 6 | ], 7 | #category : #'Leibniz2-Rules' 8 | } 9 | 10 | { #category : #inspecting } 11 | LzRuleMatcher >> gtReplacementFor: aView [ 12 | 13 | self bindings bindings ifEmpty: [ ^ aView empty ]. 14 | ^ aView forward 15 | title: 'Replacement'; 16 | priority: 3; 17 | object: [ self replacementInContext ]; 18 | view: #gtTreeFor:; 19 | yourself 20 | ] 21 | 22 | { #category : #printing } 23 | LzRuleMatcher >> printOn: aStream [ 24 | super printOn: aStream. 25 | aStream 26 | << $(; 27 | << self rule asLeibnizSyntaxString; 28 | << $) 29 | ] 30 | 31 | { #category : #accessing } 32 | LzRuleMatcher >> replacement [ 33 | | reducer | 34 | reducer := self context 35 | ifNil: [ [ :aTerm | aTerm ] ] 36 | ifNotNil: [ [ :aTerm | self context reduce: aTerm ] ]. 37 | ^ self rule apply: bindings reducer: reducer. 38 | ] 39 | 40 | { #category : #accessing } 41 | LzRuleMatcher >> replacementInContext [ 42 | ^ self replacement inContext: self context 43 | ] 44 | 45 | { #category : #accessing } 46 | LzRuleMatcher >> rule [ 47 | ^ rule 48 | ] 49 | 50 | { #category : #accessing } 51 | LzRuleMatcher >> rule: anLzRule [ 52 | rule := anLzRule. 53 | self pattern: rule pattern 54 | ] 55 | -------------------------------------------------------------------------------- /Leibniz2/LzRuleOrderAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzRuleOrderAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzRulePrefixNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzRulePrefixNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'label', 6 | 'order' 7 | ], 8 | #category : #'Leibniz2-SmaCCParser' 9 | } 10 | 11 | { #category : #generated } 12 | LzRulePrefixNode >> acceptVisitor: aParseTreeVisitor [ 13 | ^ aParseTreeVisitor visitRulePrefix: self 14 | ] 15 | 16 | { #category : #generated } 17 | LzRulePrefixNode >> label [ 18 | ^ label 19 | ] 20 | 21 | { #category : #generated } 22 | LzRulePrefixNode >> label: aSmaCCToken [ 23 | label := aSmaCCToken 24 | ] 25 | 26 | { #category : #generated } 27 | LzRulePrefixNode >> order [ 28 | ^ order 29 | ] 30 | 31 | { #category : #generated } 32 | LzRulePrefixNode >> order: aSmaCCToken [ 33 | order := aSmaCCToken 34 | ] 35 | 36 | { #category : #generated } 37 | LzRulePrefixNode >> tokenVariables [ 38 | ^ #(#label #order) 39 | ] 40 | -------------------------------------------------------------------------------- /Leibniz2/LzScopedVarName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzScopedVarName, 3 | #superclass : #LzVarName, 4 | #instVars : [ 5 | 'scope' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #'instance creation' } 11 | LzScopedVarName class >> for: internalSymbol scope: aSymbol [ 12 | ^ (super for: internalSymbol) 13 | scope: aSymbol; 14 | yourself 15 | ] 16 | 17 | { #category : #converting } 18 | LzScopedVarName >> addAsRopedTextTo: aRopedText [ 19 | | text | 20 | text := scope asRopedText 21 | attribute: LzVarNameAttribute new; 22 | attribute: LzVarNameScopeAttribute new; 23 | fontSize: 8. 24 | aRopedText append: text. 25 | super addAsRopedTextTo: aRopedText 26 | ] 27 | 28 | { #category : #'instance creation' } 29 | LzScopedVarName >> for: aSymbol [ 30 | self shouldNotImplement 31 | ] 32 | 33 | { #category : #printing } 34 | LzScopedVarName >> printAsLeibnizSyntaxOn: aStream [ 35 | aStream nextPutAll: scope. 36 | super printAsLeibnizSyntaxOn: aStream 37 | ] 38 | 39 | { #category : #accessing } 40 | LzScopedVarName >> scope [ 41 | ^ scope 42 | ] 43 | 44 | { #category : #accessing } 45 | LzScopedVarName >> scope: anObject [ 46 | scope := anObject 47 | ] 48 | 49 | { #category : #accessing } 50 | LzScopedVarName >> valueSlots [ 51 | ^ super valueSlots, #(scope) 52 | ] 53 | -------------------------------------------------------------------------------- /Leibniz2/LzShadowedBindings.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzShadowedBindings, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'shadowedVars', 6 | 'bindings' 7 | ], 8 | #category : #'Leibniz2-Terms' 9 | } 10 | 11 | { #category : #accessing } 12 | LzShadowedBindings >> bindingFor: aName [ 13 | (shadowedVars includes: aName) ifTrue: [ ^ nil ]. 14 | ^ bindings bindingFor: aName 15 | ] 16 | 17 | { #category : #accessing } 18 | LzShadowedBindings >> bindings [ 19 | ^ bindings 20 | ] 21 | 22 | { #category : #accessing } 23 | LzShadowedBindings >> bindings: anObject [ 24 | bindings := anObject 25 | ] 26 | 27 | { #category : #testing } 28 | LzShadowedBindings >> hasNoBindings [ 29 | ^ bindings hasNoBindings 30 | ] 31 | 32 | { #category : #accessing } 33 | LzShadowedBindings >> shadowedVars [ 34 | ^ shadowedVars 35 | ] 36 | 37 | { #category : #accessing } 38 | LzShadowedBindings >> shadowedVars: anObject [ 39 | shadowedVars := anObject 40 | ] 41 | -------------------------------------------------------------------------------- /Leibniz2/LzSimpleOpArgNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSimpleOpArgNode, 3 | #superclass : #LzOpArgNode, 4 | #instVars : [ 5 | 'leftParen', 6 | 'rightParen' 7 | ], 8 | #category : #'Leibniz2-SmaCCParser' 9 | } 10 | 11 | { #category : #generated } 12 | LzSimpleOpArgNode >> acceptVisitor: aParseTreeVisitor [ 13 | ^ aParseTreeVisitor visitSimpleOpArg: self 14 | ] 15 | 16 | { #category : #generated } 17 | LzSimpleOpArgNode >> leftParen [ 18 | ^ leftParen 19 | ] 20 | 21 | { #category : #generated } 22 | LzSimpleOpArgNode >> leftParen: aSmaCCToken [ 23 | leftParen := aSmaCCToken 24 | ] 25 | 26 | { #category : #generated } 27 | LzSimpleOpArgNode >> rightParen [ 28 | ^ rightParen 29 | ] 30 | 31 | { #category : #generated } 32 | LzSimpleOpArgNode >> rightParen: aSmaCCToken [ 33 | rightParen := aSmaCCToken 34 | ] 35 | 36 | { #category : #generated } 37 | LzSimpleOpArgNode >> tokenVariables [ 38 | ^ #(#leftParen #rightParen #name #colon) 39 | ] 40 | -------------------------------------------------------------------------------- /Leibniz2/LzSnippetTerm.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSnippetTerm, 3 | #superclass : #LzTermInContext, 4 | #category : #'Leibniz2-Lepiter' 5 | } 6 | 7 | { #category : #accessing } 8 | LzSnippetTerm class >> firstSnippetStartingWith: text page: pageName [ 9 | | page snippet | 10 | [ 11 | page := LzBook pageNamed: pageName value. 12 | snippet := page allChildrenTextSnippets 13 | detect: [ :each | each text asString beginsWith: text value ] 14 | ] 15 | on: Error 16 | do: [ LzRewriteFailure signal: 'No such snippet' ]. 17 | ^ snippet uid uidString. 18 | ] 19 | 20 | { #category : #accessing } 21 | LzSnippetTerm class >> snippetWithUID: uidString [ 22 | ^ LzBook database 23 | blockWithUID: (LeUID new uidString: uidString) 24 | ] 25 | 26 | { #category : #inspecting } 27 | LzSnippetTerm >> gtLiveFor: aView [ 28 | 29 | | snippet | 30 | [ snippet := self snippet ] 31 | on: Error 32 | do: [ ^ aView empty ]. 33 | ^ aView forward 34 | title: 'Snippet'; 35 | priority: 0; 36 | object: [ snippet ]; 37 | view: #gtLiveFor: 38 | ] 39 | 40 | { #category : #inspecting } 41 | LzSnippetTerm >> gtSpawnSnippetFor: anAction [ 42 | 43 | | snippet | 44 | [ snippet := self snippet ] 45 | on: Error 46 | do: [ ^ anAction noAction ]. 47 | ^ anAction button 48 | tooltip: 'Inspect the snippet'; 49 | priority: 1; 50 | icon: BrGlamorousIcons fromhere; 51 | action: [ :aButton | 52 | aButton phlow spawnObject: snippet ] 53 | ] 54 | 55 | { #category : #accessing } 56 | LzSnippetTerm >> page [ 57 | ^ self snippet page 58 | ] 59 | 60 | { #category : #accessing } 61 | LzSnippetTerm >> snippet [ 62 | ^ self class snippetWithUID: self uidString 63 | ] 64 | 65 | { #category : #accessing } 66 | LzSnippetTerm >> uidString [ 67 | ^ self normalForm args first value 68 | ] 69 | -------------------------------------------------------------------------------- /Leibniz2/LzSortAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSortAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #accessing } 8 | LzSortAttribute >> visualAttributesForColor: aColor [ 9 | ^ { BlFontItalicAttribute new } 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzSortDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSortDeclaration, 3 | #superclass : #LzDeclaration, 4 | #instVars : [ 5 | 'op' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #converting } 11 | LzSortDeclaration >> addAsRopedTextTo: aRopedText [ 12 | op addVariablesAsRopedTextTo: aRopedText. 13 | self 14 | do: [ :t | op name addForArity: op args asRopedTextTo: t ] 15 | to: aRopedText 16 | withAttribute: LzSortAttribute new 17 | ] 18 | 19 | { #category : #constructing } 20 | LzSortDeclaration >> objectFor: aContext [ 21 | ^ aContext sortGraph familyForParsedOp: self op rewriteContravariance 22 | ] 23 | 24 | { #category : #accessing } 25 | LzSortDeclaration >> op [ 26 | ^ op 27 | ] 28 | 29 | { #category : #accessing } 30 | LzSortDeclaration >> op: anOpNode [ 31 | anOpNode sort: 32 | (LzOpTermDeclaration new 33 | opName: (LzPrefixOpName for: LzConstants opNameSort); 34 | args: #()). 35 | op := anOpNode 36 | ] 37 | 38 | { #category : #printing } 39 | LzSortDeclaration >> printAsLeibnizSyntaxOn: aStream [ 40 | op printVariablesAsLeibnizSyntaxOn: aStream. 41 | self printBodyAsLeibnizSyntaxOn: aStream 42 | ] 43 | 44 | { #category : #printing } 45 | LzSortDeclaration >> printBodyAsLeibnizSyntaxOn: aStream [ 46 | op name printForArity: op args on: aStream 47 | ] 48 | -------------------------------------------------------------------------------- /Leibniz2/LzSortFlagNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSortFlagNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'name', 6 | 'equals', 7 | 'yesno' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzSortFlagNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitSortFlag: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzSortFlagNode >> equals [ 19 | ^ equals 20 | ] 21 | 22 | { #category : #generated } 23 | LzSortFlagNode >> equals: aSmaCCToken [ 24 | equals := aSmaCCToken 25 | ] 26 | 27 | { #category : #generated } 28 | LzSortFlagNode >> name [ 29 | ^ name 30 | ] 31 | 32 | { #category : #generated } 33 | LzSortFlagNode >> name: aSmaCCToken [ 34 | name := aSmaCCToken 35 | ] 36 | 37 | { #category : #generated } 38 | LzSortFlagNode >> tokenVariables [ 39 | ^ #(#name #equals #yesno) 40 | ] 41 | 42 | { #category : #generated } 43 | LzSortFlagNode >> yesno [ 44 | ^ yesno 45 | ] 46 | 47 | { #category : #generated } 48 | LzSortFlagNode >> yesno: aSmaCCToken [ 49 | yesno := aSmaCCToken 50 | ] 51 | -------------------------------------------------------------------------------- /Leibniz2/LzSpecialTermAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSpecialTermAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzSpecialTermsDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSpecialTermsDeclaration, 3 | #superclass : #LzDeclaration, 4 | #instVars : [ 5 | 'termTypes' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #converting } 11 | LzSpecialTermsDeclaration >> addAsRopedTextTo: aRopedText [ 12 | termTypes do: [ :each | 13 | aRopedText append: (each asRopedText attribute: LzSpecialTermAttribute new) ] 14 | separatedBy: [ 15 | aRopedText append: ', ' asRopedText ] 16 | ] 17 | 18 | { #category : #printing } 19 | LzSpecialTermsDeclaration >> printAsLeibnizSyntaxOn: aStream [ 20 | termTypes allButLastDo: [ :each | 21 | aStream nextPutAll: each. 22 | aStream << ', ' ]. 23 | aStream nextPutAll: termTypes last 24 | ] 25 | 26 | { #category : #accessing } 27 | LzSpecialTermsDeclaration >> termTypes [ 28 | ^ termTypes 29 | ] 30 | 31 | { #category : #accessing } 32 | LzSpecialTermsDeclaration >> termTypes: aSymbol [ 33 | termTypes := aSymbol 34 | ] 35 | -------------------------------------------------------------------------------- /Leibniz2/LzStateDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzStateDeclaration, 3 | #superclass : #LzDeclaration, 4 | #instVars : [ 5 | 'sort', 6 | 'name' 7 | ], 8 | #category : #'Leibniz2-Declarations' 9 | } 10 | 11 | { #category : #converting } 12 | LzStateDeclaration >> addAsRopedTextTo: aRopedText [ 13 | self 14 | do: [ :t | 15 | name addAsRopedTextTo: t. 16 | t append: 17 | (':' asRopedText attribute: LzColonAttribute new). 18 | self 19 | do: [ :tt | sort addAsRopedTextTo: tt ] 20 | to: t 21 | withAttribute: LzSortAttribute new ] 22 | to: aRopedText 23 | withAttribute: LzVarDeclarationAttribute new 24 | ] 25 | 26 | { #category : #accessing } 27 | LzStateDeclaration >> name [ 28 | ^ name 29 | ] 30 | 31 | { #category : #accessing } 32 | LzStateDeclaration >> name: anObject [ 33 | name := anObject 34 | ] 35 | 36 | { #category : #constructing } 37 | LzStateDeclaration >> objectFor: aContext [ 38 | ^ aContext signature 39 | varTerm: self name 40 | variables: Dictionary new 41 | ] 42 | 43 | { #category : #printing } 44 | LzStateDeclaration >> printAsLeibnizSyntaxOn: aStream [ 45 | name printAsLeibnizSyntaxOn: aStream. 46 | aStream nextPut: $:. 47 | sort printAsLeibnizSyntaxOn: aStream. 48 | ] 49 | 50 | { #category : #accessing } 51 | LzStateDeclaration >> sort [ 52 | 53 | ^ sort 54 | ] 55 | 56 | { #category : #accessing } 57 | LzStateDeclaration >> sort: anObject [ 58 | 59 | sort := anObject 60 | ] 61 | 62 | { #category : #accessing } 63 | LzStateDeclaration >> valueSlots [ 64 | ^ #(name sort) 65 | ] 66 | -------------------------------------------------------------------------------- /Leibniz2/LzStepNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzStepNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'term', 6 | 'arrow', 7 | 'pattern' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzStepNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitStep: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzStepNode >> arrow [ 19 | ^ arrow 20 | ] 21 | 22 | { #category : #generated } 23 | LzStepNode >> arrow: aSmaCCToken [ 24 | arrow := aSmaCCToken 25 | ] 26 | 27 | { #category : #generated } 28 | LzStepNode >> nodeVariables [ 29 | ^ #(#term #pattern) 30 | ] 31 | 32 | { #category : #generated } 33 | LzStepNode >> pattern [ 34 | ^ pattern 35 | ] 36 | 37 | { #category : #generated } 38 | LzStepNode >> pattern: aLzPatternNode [ 39 | self pattern notNil ifTrue: [ self pattern parent: nil ]. 40 | pattern := aLzPatternNode. 41 | self pattern notNil ifTrue: [ self pattern parent: self ] 42 | ] 43 | 44 | { #category : #generated } 45 | LzStepNode >> term [ 46 | ^ term 47 | ] 48 | 49 | { #category : #generated } 50 | LzStepNode >> term: aLzParseTreeNode [ 51 | self term notNil ifTrue: [ self term parent: nil ]. 52 | term := aLzParseTreeNode. 53 | self term notNil ifTrue: [ self term parent: self ] 54 | ] 55 | 56 | { #category : #generated } 57 | LzStepNode >> tokenVariables [ 58 | ^ #(#arrow) 59 | ] 60 | -------------------------------------------------------------------------------- /Leibniz2/LzStepTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzStepTermNode, 3 | #superclass : #LzTermNode, 4 | #category : #'Leibniz2-SmaCCParser' 5 | } 6 | 7 | { #category : #generated } 8 | LzStepTermNode >> acceptVisitor: aParseTreeVisitor [ 9 | ^ aParseTreeVisitor visitStepTerm: self 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzStreamContents.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzStreamContents, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'announcer', 6 | 'retrievedItems', 7 | 'streamOrSequence' 8 | ], 9 | #category : #'Leibniz2-Infrastructure' 10 | } 11 | 12 | { #category : #accessing } 13 | LzStreamContents >> announcer [ 14 | ^ announcer ifNil: [ announcer := Announcer new ] 15 | ] 16 | 17 | { #category : #testing } 18 | LzStreamContents >> isComplete [ 19 | ^ streamOrSequence isStream not or: [ streamOrSequence atEnd ] 20 | ] 21 | 22 | { #category : #accessing } 23 | LzStreamContents >> moreItems [ 24 | | counter | 25 | streamOrSequence isStream 26 | ifFalse: [ retrievedItems addAll: streamOrSequence ] 27 | ifTrue: [ 28 | counter := 0. 29 | [ streamOrSequence atEnd and: [ counter < 100] ] whileFalse: [ 30 | retrievedItems add: streamOrSequence next. 31 | counter := counter + 1 ] ]. 32 | self announcer announce: LzStreamContentsMoreItemsEvent new 33 | ] 34 | 35 | { #category : #accessing } 36 | LzStreamContents >> streamOrSequence: aGeneratorOrSequence [ 37 | streamOrSequence := aGeneratorOrSequence. 38 | retrievedItems := OrderedCollection new. 39 | self moreItems. 40 | ] 41 | -------------------------------------------------------------------------------- /Leibniz2/LzStreamContentsMoreItemsEvent.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzStreamContentsMoreItemsEvent, 3 | #superclass : #Announcement, 4 | #category : #'Leibniz2-Infrastructure' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzStringLiteralDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzStringLiteralDeclaration, 3 | #superclass : #LzLiteralDeclaration, 4 | #category : #'Leibniz2-Declarations' 5 | } 6 | 7 | { #category : #accessing } 8 | LzStringLiteralDeclaration >> builtin [ 9 | ^ #strings 10 | ] 11 | 12 | { #category : #accessing } 13 | LzStringLiteralDeclaration >> printAsLeibnizSyntaxOn: aStream [ 14 | aStream nextPut: $". 15 | aStream nextPutAll: self value. 16 | aStream nextPut: $" 17 | ] 18 | 19 | { #category : #accessing } 20 | LzStringLiteralDeclaration >> termClass [ 21 | ^ LzStringTerm 22 | ] 23 | -------------------------------------------------------------------------------- /Leibniz2/LzStringLiteralTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzStringLiteralTermNode, 3 | #superclass : #LzLiteralTermNode, 4 | #category : #'Leibniz2-SmaCCParser' 5 | } 6 | 7 | { #category : #generated } 8 | LzStringLiteralTermNode >> acceptVisitor: aParseTreeVisitor [ 9 | ^ aParseTreeVisitor visitStringLiteralTerm: self 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzStringTerm.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzStringTerm, 3 | #superclass : #LzAtomicTerm, 4 | #category : #'Leibniz2-Terms' 5 | } 6 | 7 | { #category : #rewriting } 8 | LzStringTerm >> , otherString [ 9 | ^ self class 10 | signature: self signature 11 | value: self value , otherString value 12 | ] 13 | 14 | { #category : #converting } 15 | LzStringTerm >> addAsRopedTextTo: aRopedText [ 16 | self 17 | do: [ :t | 18 | t append: '"' asRopedText. 19 | t append: value asRopedText. 20 | t append: '"' asRopedText ] 21 | to: aRopedText 22 | withAttribute: LzLiteralAttribute new 23 | ] 24 | 25 | { #category : #rewriting } 26 | LzStringTerm >> ensureString [ 27 | ] 28 | 29 | { #category : #printing } 30 | LzStringTerm >> printAsLeibnizSyntaxOn: aStream [ 31 | aStream 32 | << $"; 33 | << value; 34 | << $". 35 | ] 36 | 37 | { #category : #accessing } 38 | LzStringTerm >> sort [ 39 | ^ self signature sort: #String 40 | ] 41 | -------------------------------------------------------------------------------- /Leibniz2/LzSubcontextNameAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSubcontextNameAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzSubscriptAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSubscriptAttribute, 3 | #superclass : #LzBaselineAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzSubscriptOpNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSubscriptOpNode, 3 | #superclass : #LzOpNode, 4 | #instVars : [ 5 | 'opName', 6 | 'commas', 7 | 'rightParen' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzSubscriptOpNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitSubscriptOp: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzSubscriptOpNode >> commas [ 19 | ^ commas 20 | ] 21 | 22 | { #category : #generated } 23 | LzSubscriptOpNode >> commas: anOrderedCollection [ 24 | commas := anOrderedCollection 25 | ] 26 | 27 | { #category : #generated } 28 | LzSubscriptOpNode >> compositeTokenVariables [ 29 | ^ #(#commas) 30 | ] 31 | 32 | { #category : #'generated-initialize-release' } 33 | LzSubscriptOpNode >> initialize [ 34 | super initialize. 35 | commas := OrderedCollection new: 2. 36 | ] 37 | 38 | { #category : #generated } 39 | LzSubscriptOpNode >> opName [ 40 | ^ opName 41 | ] 42 | 43 | { #category : #generated } 44 | LzSubscriptOpNode >> opName: aSmaCCToken [ 45 | opName := aSmaCCToken 46 | ] 47 | 48 | { #category : #generated } 49 | LzSubscriptOpNode >> rightParen [ 50 | ^ rightParen 51 | ] 52 | 53 | { #category : #generated } 54 | LzSubscriptOpNode >> rightParen: aSmaCCToken [ 55 | rightParen := aSmaCCToken 56 | ] 57 | 58 | { #category : #generated } 59 | LzSubscriptOpNode >> tokenVariables [ 60 | ^ #(#opName #rightParen) 61 | ] 62 | -------------------------------------------------------------------------------- /Leibniz2/LzSubsortAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSubsortAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzSubsortRelation.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSubsortRelation, 3 | #superclass : #Object, 4 | #traits : 'TLzPrintable', 5 | #classTraits : 'TLzPrintable classTrait', 6 | #instVars : [ 7 | 'sortGraph', 8 | 'axiom' 9 | ], 10 | #category : #'Leibniz2-Sorts' 11 | } 12 | 13 | { #category : #converting } 14 | LzSubsortRelation >> addAsRopedTextTo: aRopedText [ 15 | self axiom addAsRopedTextTo: aRopedText 16 | ] 17 | 18 | { #category : #accessing } 19 | LzSubsortRelation >> axiom [ 20 | ^ axiom 21 | ] 22 | 23 | { #category : #accessing } 24 | LzSubsortRelation >> axiom: aSubsortAxiom [ 25 | axiom := aSubsortAxiom 26 | ] 27 | 28 | { #category : #inspecting } 29 | LzSubsortRelation >> gtSortGraphFor: aView [ 30 | 31 | ^ aView forward 32 | title: 'Sort graph'; 33 | priority: 0; 34 | object: [ LzSortPair 35 | sort1: (self sortGraph sortWithTerm: self axiom subsort) 36 | sort2: (self sortGraph sortWithTerm: self axiom supersort) ]; 37 | view: #gtSortGraphFor:; 38 | yourself 39 | ] 40 | 41 | { #category : #printing } 42 | LzSubsortRelation >> printAsLeibnizSyntaxOn: aStream [ 43 | self axiom printAsLeibnizSyntaxOn: aStream 44 | ] 45 | 46 | { #category : #accessing } 47 | LzSubsortRelation >> sortGraph [ 48 | ^ sortGraph 49 | ] 50 | 51 | { #category : #accessing } 52 | LzSubsortRelation >> sortGraph: aSortGraph [ 53 | sortGraph := aSortGraph 54 | ] 55 | -------------------------------------------------------------------------------- /Leibniz2/LzSuperscriptAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSuperscriptAttribute, 3 | #superclass : #LzBaselineAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzSuperscriptOpNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSuperscriptOpNode, 3 | #superclass : #LzOpNode, 4 | #instVars : [ 5 | 'opName', 6 | 'commas', 7 | 'rightParen' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzSuperscriptOpNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitSuperscriptOp: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzSuperscriptOpNode >> commas [ 19 | ^ commas 20 | ] 21 | 22 | { #category : #generated } 23 | LzSuperscriptOpNode >> commas: anOrderedCollection [ 24 | commas := anOrderedCollection 25 | ] 26 | 27 | { #category : #generated } 28 | LzSuperscriptOpNode >> compositeTokenVariables [ 29 | ^ #(#commas) 30 | ] 31 | 32 | { #category : #'generated-initialize-release' } 33 | LzSuperscriptOpNode >> initialize [ 34 | super initialize. 35 | commas := OrderedCollection new: 2. 36 | ] 37 | 38 | { #category : #generated } 39 | LzSuperscriptOpNode >> opName [ 40 | ^ opName 41 | ] 42 | 43 | { #category : #generated } 44 | LzSuperscriptOpNode >> opName: aSmaCCToken [ 45 | opName := aSmaCCToken 46 | ] 47 | 48 | { #category : #generated } 49 | LzSuperscriptOpNode >> rightParen [ 50 | ^ rightParen 51 | ] 52 | 53 | { #category : #generated } 54 | LzSuperscriptOpNode >> rightParen: aSmaCCToken [ 55 | rightParen := aSmaCCToken 56 | ] 57 | 58 | { #category : #generated } 59 | LzSuperscriptOpNode >> tokenVariables [ 60 | ^ #(#opName #rightParen) 61 | ] 62 | -------------------------------------------------------------------------------- /Leibniz2/LzSyntaxAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSyntaxAttribute, 3 | #superclass : #BlTextAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #rendering } 8 | LzSyntaxAttribute >> visualAttributesForColor: aColor [ 9 | ^ #() 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzSyntaxLabelSegment.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzSyntaxLabelSegment, 3 | #superclass : #Object, 4 | #instVars : [ 5 | 'text', 6 | 'baseline' 7 | ], 8 | #category : #'Leibniz2-Rendering' 9 | } 10 | 11 | { #category : #accessing } 12 | LzSyntaxLabelSegment >> baseline [ 13 | ^ baseline 14 | ] 15 | 16 | { #category : #rendering } 17 | LzSyntaxLabelSegment >> marginsForTop: topMargin bottom: bottomMargin [ 18 | ^ BlInsets 19 | top: (baseline = LzSuperscriptAttribute ifTrue: [ 0 ] ifFalse: [ topMargin ]) 20 | left: 0 21 | bottom: (baseline = LzSubscriptAttribute ifTrue: [ 0 ] ifFalse: [ bottomMargin ]) 22 | right: 0 23 | ] 24 | 25 | { #category : #printing } 26 | LzSyntaxLabelSegment >> printOn: aStream [ 27 | super printOn: aStream. 28 | aStream 29 | << '('''; 30 | << self text asString; 31 | << $'. 32 | baseline ifNotNil: [ 33 | aStream 34 | << ', '; 35 | << baseline printString]. 36 | aStream 37 | << ')' 38 | ] 39 | 40 | { #category : #accessing } 41 | LzSyntaxLabelSegment >> text [ 42 | ^ text 43 | ] 44 | 45 | { #category : #accessing } 46 | LzSyntaxLabelSegment >> text: aText [ 47 | baseline := (aText attributesAt: 1) 48 | detect: [ :each | each isKindOf: LzBaselineAttribute ] 49 | ifFound: [ :each | each class ] 50 | ifNone: [ nil ]. 51 | text := '' asRopedText. 52 | aText attributesDo: [ :attrs :index | 53 | attrs 54 | detect: [ :each | each isKindOf: LzDoNotRenderAttribute ] 55 | ifNone: [ text append: (aText copyFrom: index +1 to: index + 1) ] ]. 56 | text fontName: LzCodeFont defaultFamily 57 | ] 58 | -------------------------------------------------------------------------------- /Leibniz2/LzTaggedVarName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTaggedVarName, 3 | #superclass : #Object, 4 | #traits : 'TLzEquality', 5 | #classTraits : 'TLzEquality classTrait', 6 | #instVars : [ 7 | 'tag', 8 | 'name' 9 | ], 10 | #category : #'Leibniz2-Terms' 11 | } 12 | 13 | { #category : #'instance creation' } 14 | LzTaggedVarName class >> tag: aSymbolOrNil name: anOpName [ 15 | ^ aSymbolOrNil 16 | ifNil: [ anOpName ] 17 | ifNotNil: [ 18 | self new 19 | tag: aSymbolOrNil; 20 | name: anOpName ] 21 | ] 22 | 23 | { #category : #comparing } 24 | LzTaggedVarName >> <= other [ 25 | ^ self asString <= other asString 26 | ] 27 | 28 | { #category : #converting } 29 | LzTaggedVarName >> addAsRopedTextTo: aRopedText [ 30 | aRopedText append: tag asRopedText. 31 | aRopedText append: '.' asRopedText. 32 | name addAsRopedTextTo: aRopedText 33 | ] 34 | 35 | { #category : #converting } 36 | LzTaggedVarName >> asString [ 37 | ^ tag asString, '.', name asString 38 | ] 39 | 40 | { #category : #converting } 41 | LzTaggedVarName >> asSymbol [ 42 | ^ self asString asSymbol 43 | ] 44 | 45 | { #category : #accessing } 46 | LzTaggedVarName >> name [ 47 | ^ name 48 | ] 49 | 50 | { #category : #accessing } 51 | LzTaggedVarName >> name: anLbOperatorName [ 52 | name := anLbOperatorName 53 | ] 54 | 55 | { #category : #printing } 56 | LzTaggedVarName >> printAsLeibnizSyntaxOn: aStream [ 57 | tag printOn: aStream. 58 | aStream nextPut: $.. 59 | name printAsLeibnizSyntaxOn: aStream. 60 | ] 61 | 62 | { #category : #accessing } 63 | LzTaggedVarName >> tag [ 64 | ^ tag 65 | ] 66 | 67 | { #category : #accessing } 68 | LzTaggedVarName >> tag: aSymbol [ 69 | tag := aSymbol 70 | ] 71 | 72 | { #category : #accessing } 73 | LzTaggedVarName >> valueSlots [ 74 | ^ #(tag name) 75 | ] 76 | -------------------------------------------------------------------------------- /Leibniz2/LzTermDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTermDeclaration, 3 | #superclass : #LzDeclaration, 4 | #category : #'Leibniz2-Declarations' 5 | } 6 | 7 | { #category : #converting } 8 | LzTermDeclaration >> addAsFirstArgOfInfixTermWithOpName: anOpName asRopedTextTo: aRopedText [ 9 | self 10 | addAsRopedTextTo: aRopedText 11 | parenthesized: (self hasInfixOpOtherThan: anOpName) 12 | ] 13 | 14 | { #category : #constructing } 15 | LzTermDeclaration >> buildFor: aSignature [ 16 | ^ self buildFor: aSignature variables: Dictionary new 17 | ] 18 | 19 | { #category : #constructing } 20 | LzTermDeclaration >> buildFor: aSignature variables: aDictionary [ 21 | self subclassResponsibility 22 | ] 23 | 24 | { #category : #testing } 25 | LzTermDeclaration >> definesContext [ 26 | ^ false 27 | ] 28 | 29 | { #category : #testing } 30 | LzTermDeclaration >> hasInfixOpOtherThan: aSymbol [ 31 | ^ false 32 | ] 33 | 34 | { #category : #testing } 35 | LzTermDeclaration >> isInfix [ 36 | ^ false 37 | ] 38 | 39 | { #category : #constructing } 40 | LzTermDeclaration >> objectFor: aContext [ 41 | ^ LzTermInContext 42 | term: (aContext parsedPattern: self) 43 | context: aContext 44 | ] 45 | 46 | { #category : #printing } 47 | LzTermDeclaration >> printAsFirstArgOfInfixTermWithOpName: anOpName on: aStream [ 48 | self 49 | printAsLeibnizSyntaxOn: aStream 50 | parenthesized: (self hasInfixOpOtherThan: anOpName) 51 | ] 52 | -------------------------------------------------------------------------------- /Leibniz2/LzTermInContextWithEGraph.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTermInContextWithEGraph, 3 | #superclass : #LzTermInContext, 4 | #instVars : [ 5 | 'eGraph' 6 | ], 7 | #category : #'Leibniz2-Terms' 8 | } 9 | 10 | { #category : #constructing } 11 | LzTermInContextWithEGraph >> constructEGraph [ 12 | eGraph := LzEGraph new 13 | context: context. 14 | term asENodeIn: eGraph. 15 | eGraph saturateFromRewriteSystem: context rewriteSystemWithEqualityAxioms. 16 | ] 17 | 18 | { #category : #accessing } 19 | LzTermInContextWithEGraph >> eGraph [ 20 | eGraph ifNil: [ self constructEGraph ]. 21 | ^ eGraph 22 | ] 23 | 24 | { #category : #inspecting } 25 | LzTermInContextWithEGraph >> gtEquivalentTermsFor: aView [ 26 | 27 | ^ aView forward 28 | title: 'Equivalent terms'; 29 | priority: 2; 30 | object: [ self eGraph classForId: (self term asENodeIn: self eGraph) ]; 31 | view: #gtTermsFor:; 32 | yourself 33 | ] 34 | -------------------------------------------------------------------------------- /Leibniz2/LzTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTermNode, 3 | #superclass : #LzParseTreeNode, 4 | #category : #'Leibniz2-SmaCCParser' 5 | } 6 | 7 | { #category : #generated } 8 | LzTermNode >> acceptVisitor: aParseTreeVisitor [ 9 | ^ aParseTreeVisitor visitTerm: self 10 | ] 11 | -------------------------------------------------------------------------------- /Leibniz2/LzTermStreamContents.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTermStreamContents, 3 | #superclass : #LzStreamContents, 4 | #category : #'Leibniz2-EGraphs' 5 | } 6 | 7 | { #category : #inspecting } 8 | LzTermStreamContents >> gtTermsFor: aView [ 9 | 10 | | view | 11 | view := aView list 12 | title: 'Terms'; 13 | priority: 0; 14 | items: [ retrievedItems ]; 15 | itemText: #asLeibnizSyntax; 16 | updateWhen: LzStreamContentsMoreItemsEvent in: [ self announcer ] 17 | yourself. 18 | self isComplete ifFalse: [ 19 | view 20 | actionButtonIcon: BrGlamorousVectorIcons add 21 | tooltip: 'More' 22 | action: [ self moreItems ] ]. 23 | ^ view 24 | ] 25 | -------------------------------------------------------------------------------- /Leibniz2/LzTextRenderer.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTextRenderer, 3 | #superclass : #Object, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #rendering } 8 | LzTextRenderer >> render: aText baseColor: aColor [ 9 | aText attribute: (BlTextForegroundAttribute new paint: aColor). 10 | aText attributesDo: [ :attrs :index | 11 | attrs 12 | select: [ :each | each isKindOf: LzSyntaxAttribute ] 13 | thenDo: [ :attr | 14 | (attr visualAttributesForColor: aColor) 15 | ifNotEmpty: [ :visualAttrs | 16 | aText 17 | attributes: visualAttrs 18 | from: (index + 1) to: ((index + 1) min: aText size) ] ] ] 19 | ] 20 | -------------------------------------------------------------------------------- /Leibniz2/LzTopLevelAnnotation.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTopLevelAnnotation, 3 | #superclass : #LzDeclarationAnnotation, 4 | #instVars : [ 5 | 'options' 6 | ], 7 | #category : #'Leibniz2-Declarations' 8 | } 9 | 10 | { #category : #rendering } 11 | LzTopLevelAnnotation >> color [ 12 | ({ nil. true } includes: (self optionsAt: #example)) 13 | ifTrue: [ ^ LzColors exampleColor ]. 14 | ^ LzColors declarationColor 15 | ] 16 | 17 | { #category : #testing } 18 | LzTopLevelAnnotation >> definesContext [ 19 | ^ self declaration definesContext 20 | and: [ (self optionsAt: #example) 21 | ifNil: [ true ] 22 | ifNotNil: [ :e | e not ] ] 23 | ] 24 | 25 | { #category : #testing } 26 | LzTopLevelAnnotation >> definesSubcontext: aSubcontextName [ 27 | ^ self definesContext 28 | and: [ 29 | | subcontext | 30 | subcontext := (self optionsAt: #subcontext). 31 | subcontext isNil or: [ subcontext = aSubcontextName ] ] 32 | ] 33 | 34 | { #category : #accessing } 35 | LzTopLevelAnnotation >> options [ 36 | ^ options 37 | ] 38 | 39 | { #category : #accessing } 40 | LzTopLevelAnnotation >> options: aDictionary [ 41 | options := aDictionary 42 | ] 43 | 44 | { #category : #accessing } 45 | LzTopLevelAnnotation >> optionsAt: aSymbol [ 46 | ^ options at: aSymbol ifAbsent: [ nil ] 47 | ] 48 | -------------------------------------------------------------------------------- /Leibniz2/LzTopLevelAssetNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTopLevelAssetNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'label', 6 | 'options', 7 | 'order' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzTopLevelAssetNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitTopLevelAsset: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzTopLevelAssetNode >> compositeNodeVariables [ 19 | ^ #(#options) 20 | ] 21 | 22 | { #category : #'generated-initialize-release' } 23 | LzTopLevelAssetNode >> initialize [ 24 | super initialize. 25 | options := OrderedCollection new: 2. 26 | ] 27 | 28 | { #category : #generated } 29 | LzTopLevelAssetNode >> label [ 30 | ^ label 31 | ] 32 | 33 | { #category : #generated } 34 | LzTopLevelAssetNode >> label: aSmaCCToken [ 35 | label := aSmaCCToken 36 | ] 37 | 38 | { #category : #generated } 39 | LzTopLevelAssetNode >> options [ 40 | ^ options 41 | ] 42 | 43 | { #category : #generated } 44 | LzTopLevelAssetNode >> options: anOrderedCollection [ 45 | self setParents: self options to: nil. 46 | options := anOrderedCollection. 47 | self setParents: self options to: self 48 | ] 49 | 50 | { #category : #generated } 51 | LzTopLevelAssetNode >> order [ 52 | ^ order 53 | ] 54 | 55 | { #category : #generated } 56 | LzTopLevelAssetNode >> order: aSmaCCToken [ 57 | order := aSmaCCToken 58 | ] 59 | 60 | { #category : #generated } 61 | LzTopLevelAssetNode >> tokenVariables [ 62 | ^ #(#label #order) 63 | ] 64 | -------------------------------------------------------------------------------- /Leibniz2/LzTopLevelFunctionRuleNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTopLevelFunctionRuleNode, 3 | #superclass : #LzTopLevelRuleNode, 4 | #instVars : [ 5 | 'pharo', 6 | 'code' 7 | ], 8 | #category : #'Leibniz2-SmaCCParser' 9 | } 10 | 11 | { #category : #generated } 12 | LzTopLevelFunctionRuleNode >> acceptVisitor: aParseTreeVisitor [ 13 | ^ aParseTreeVisitor visitTopLevelFunctionRule: self 14 | ] 15 | 16 | { #category : #generated } 17 | LzTopLevelFunctionRuleNode >> code [ 18 | ^ code 19 | ] 20 | 21 | { #category : #generated } 22 | LzTopLevelFunctionRuleNode >> code: aSmaCCToken [ 23 | code := aSmaCCToken 24 | ] 25 | 26 | { #category : #generated } 27 | LzTopLevelFunctionRuleNode >> pharo [ 28 | ^ pharo 29 | ] 30 | 31 | { #category : #generated } 32 | LzTopLevelFunctionRuleNode >> pharo: aSmaCCToken [ 33 | pharo := aSmaCCToken 34 | ] 35 | 36 | { #category : #generated } 37 | LzTopLevelFunctionRuleNode >> tokenVariables [ 38 | ^ #(#pharo #code #arrow) 39 | ] 40 | -------------------------------------------------------------------------------- /Leibniz2/LzTopLevelRewriteRuleNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTopLevelRewriteRuleNode, 3 | #superclass : #LzTopLevelRuleNode, 4 | #instVars : [ 5 | 'replacement' 6 | ], 7 | #category : #'Leibniz2-SmaCCParser' 8 | } 9 | 10 | { #category : #generated } 11 | LzTopLevelRewriteRuleNode >> acceptVisitor: aParseTreeVisitor [ 12 | ^ aParseTreeVisitor visitTopLevelRewriteRule: self 13 | ] 14 | 15 | { #category : #generated } 16 | LzTopLevelRewriteRuleNode >> nodeVariables [ 17 | ^ #(#replacement #pattern #condition #prefix) 18 | ] 19 | 20 | { #category : #generated } 21 | LzTopLevelRewriteRuleNode >> replacement [ 22 | ^ replacement 23 | ] 24 | 25 | { #category : #generated } 26 | LzTopLevelRewriteRuleNode >> replacement: aLzParseTreeNode [ 27 | self replacement notNil ifTrue: [ self replacement parent: nil ]. 28 | replacement := aLzParseTreeNode. 29 | self replacement notNil ifTrue: [ self replacement parent: self ] 30 | ] 31 | -------------------------------------------------------------------------------- /Leibniz2/LzTopLevelSpecialTermsNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTopLevelSpecialTermsNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'specialTerms', 6 | 'commas', 7 | 'options' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzTopLevelSpecialTermsNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitTopLevelSpecialTerms: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzTopLevelSpecialTermsNode >> commas [ 19 | ^ commas 20 | ] 21 | 22 | { #category : #generated } 23 | LzTopLevelSpecialTermsNode >> commas: anOrderedCollection [ 24 | commas := anOrderedCollection 25 | ] 26 | 27 | { #category : #generated } 28 | LzTopLevelSpecialTermsNode >> compositeNodeVariables [ 29 | ^ #(#options) 30 | ] 31 | 32 | { #category : #generated } 33 | LzTopLevelSpecialTermsNode >> compositeTokenVariables [ 34 | ^ #(#specialTerms #commas) 35 | ] 36 | 37 | { #category : #'generated-initialize-release' } 38 | LzTopLevelSpecialTermsNode >> initialize [ 39 | super initialize. 40 | specialTerms := OrderedCollection new: 2. 41 | commas := OrderedCollection new: 2. 42 | options := OrderedCollection new: 2. 43 | ] 44 | 45 | { #category : #generated } 46 | LzTopLevelSpecialTermsNode >> options [ 47 | ^ options 48 | ] 49 | 50 | { #category : #generated } 51 | LzTopLevelSpecialTermsNode >> options: anOrderedCollection [ 52 | self setParents: self options to: nil. 53 | options := anOrderedCollection. 54 | self setParents: self options to: self 55 | ] 56 | 57 | { #category : #generated } 58 | LzTopLevelSpecialTermsNode >> specialTerms [ 59 | ^ specialTerms 60 | ] 61 | 62 | { #category : #generated } 63 | LzTopLevelSpecialTermsNode >> specialTerms: anOrderedCollection [ 64 | specialTerms := anOrderedCollection 65 | ] 66 | -------------------------------------------------------------------------------- /Leibniz2/LzTopLevelStateNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTopLevelStateNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'var', 6 | 'options' 7 | ], 8 | #category : #'Leibniz2-SmaCCParser' 9 | } 10 | 11 | { #category : #generated } 12 | LzTopLevelStateNode >> acceptVisitor: aParseTreeVisitor [ 13 | ^ aParseTreeVisitor visitTopLevelState: self 14 | ] 15 | 16 | { #category : #generated } 17 | LzTopLevelStateNode >> compositeNodeVariables [ 18 | ^ #(#options) 19 | ] 20 | 21 | { #category : #'generated-initialize-release' } 22 | LzTopLevelStateNode >> initialize [ 23 | super initialize. 24 | options := OrderedCollection new: 2. 25 | ] 26 | 27 | { #category : #generated } 28 | LzTopLevelStateNode >> nodeVariables [ 29 | ^ #(#var) 30 | ] 31 | 32 | { #category : #generated } 33 | LzTopLevelStateNode >> options [ 34 | ^ options 35 | ] 36 | 37 | { #category : #generated } 38 | LzTopLevelStateNode >> options: anOrderedCollection [ 39 | self setParents: self options to: nil. 40 | options := anOrderedCollection. 41 | self setParents: self options to: self 42 | ] 43 | 44 | { #category : #generated } 45 | LzTopLevelStateNode >> var [ 46 | ^ var 47 | ] 48 | 49 | { #category : #generated } 50 | LzTopLevelStateNode >> var: aLzVarNode [ 51 | self var notNil ifTrue: [ self var parent: nil ]. 52 | var := aLzVarNode. 53 | self var notNil ifTrue: [ self var parent: self ] 54 | ] 55 | -------------------------------------------------------------------------------- /Leibniz2/LzTopLevelTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTopLevelTermNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'pattern', 6 | 'options', 7 | 'prefix' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzTopLevelTermNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitTopLevelTerm: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzTopLevelTermNode >> compositeNodeVariables [ 19 | ^ #(#options) 20 | ] 21 | 22 | { #category : #'generated-initialize-release' } 23 | LzTopLevelTermNode >> initialize [ 24 | super initialize. 25 | options := OrderedCollection new: 2. 26 | ] 27 | 28 | { #category : #generated } 29 | LzTopLevelTermNode >> nodeVariables [ 30 | ^ #(#pattern #prefix) 31 | ] 32 | 33 | { #category : #generated } 34 | LzTopLevelTermNode >> options [ 35 | ^ options 36 | ] 37 | 38 | { #category : #generated } 39 | LzTopLevelTermNode >> options: anOrderedCollection [ 40 | self setParents: self options to: nil. 41 | options := anOrderedCollection. 42 | self setParents: self options to: self 43 | ] 44 | 45 | { #category : #generated } 46 | LzTopLevelTermNode >> pattern [ 47 | ^ pattern 48 | ] 49 | 50 | { #category : #generated } 51 | LzTopLevelTermNode >> pattern: aLzPatternNode [ 52 | self pattern notNil ifTrue: [ self pattern parent: nil ]. 53 | pattern := aLzPatternNode. 54 | self pattern notNil ifTrue: [ self pattern parent: self ] 55 | ] 56 | 57 | { #category : #generated } 58 | LzTopLevelTermNode >> prefix [ 59 | ^ prefix 60 | ] 61 | 62 | { #category : #generated } 63 | LzTopLevelTermNode >> prefix: aLzAssetPrefixNode [ 64 | self prefix notNil ifTrue: [ self prefix parent: nil ]. 65 | prefix := aLzAssetPrefixNode. 66 | self prefix notNil ifTrue: [ self prefix parent: self ] 67 | ] 68 | -------------------------------------------------------------------------------- /Leibniz2/LzTopLevelUseContextNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTopLevelUseContextNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'pageName', 6 | 'options' 7 | ], 8 | #category : #'Leibniz2-SmaCCParser' 9 | } 10 | 11 | { #category : #generated } 12 | LzTopLevelUseContextNode >> acceptVisitor: aParseTreeVisitor [ 13 | ^ aParseTreeVisitor visitTopLevelUseContext: self 14 | ] 15 | 16 | { #category : #generated } 17 | LzTopLevelUseContextNode >> compositeNodeVariables [ 18 | ^ #(#options) 19 | ] 20 | 21 | { #category : #'generated-initialize-release' } 22 | LzTopLevelUseContextNode >> initialize [ 23 | super initialize. 24 | options := OrderedCollection new: 2. 25 | ] 26 | 27 | { #category : #generated } 28 | LzTopLevelUseContextNode >> options [ 29 | ^ options 30 | ] 31 | 32 | { #category : #generated } 33 | LzTopLevelUseContextNode >> options: anOrderedCollection [ 34 | self setParents: self options to: nil. 35 | options := anOrderedCollection. 36 | self setParents: self options to: self 37 | ] 38 | 39 | { #category : #generated } 40 | LzTopLevelUseContextNode >> pageName [ 41 | ^ pageName 42 | ] 43 | 44 | { #category : #generated } 45 | LzTopLevelUseContextNode >> pageName: aSmaCCToken [ 46 | pageName := aSmaCCToken 47 | ] 48 | 49 | { #category : #generated } 50 | LzTopLevelUseContextNode >> tokenVariables [ 51 | ^ #(#pageName) 52 | ] 53 | -------------------------------------------------------------------------------- /Leibniz2/LzTupleOpName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTupleOpName, 3 | #superclass : #LzOpName, 4 | #category : #'Leibniz2-Declarations' 5 | } 6 | 7 | { #category : #converting } 8 | LzTupleOpName >> addForArgs: anArrayOfTerms asRopedTextTo: aRopedText argAttributes: anArrayOfAttributes [ 9 | self assert: anArrayOfTerms size > 0. 10 | aRopedText append: '(' asRopedText. 11 | anArrayOfTerms 12 | do: [ : each | 13 | self 14 | do: [ :t | each addAsRopedTextTo: t ] 15 | to: aRopedText 16 | withAttributes: anArrayOfAttributes ] 17 | separatedBy: [ aRopedText append: ', ' asRopedText ]. 18 | aRopedText append: ')' asRopedText 19 | ] 20 | 21 | { #category : #initializing } 22 | LzTupleOpName >> initialize [ 23 | internalSymbol := #'()' 24 | ] 25 | 26 | { #category : #printing } 27 | LzTupleOpName >> printForArgs: anArrayOfTerms on: aStream [ 28 | self assert: anArrayOfTerms size > 0. 29 | aStream nextPut: $(. 30 | anArrayOfTerms 31 | do: [ : each | each printAsLeibnizSyntaxOn: aStream ] 32 | separatedBy: [ aStream nextPutAll: ', ' ]. 33 | aStream nextPut: $) 34 | ] 35 | 36 | { #category : #printing } 37 | LzTupleOpName >> printForArgs: anENodeArray on: aStream parents: aNodeSet [ 38 | self assert: anENodeArray size > 0. 39 | aStream nextPut: $(. 40 | anENodeArray 41 | do: [ : each | each printAsLeibnizSyntaxOn: aStream parents: aNodeSet ] 42 | separatedBy: [ aStream nextPutAll: ', ' ]. 43 | aStream nextPut: $) 44 | ] 45 | 46 | { #category : #printing } 47 | LzTupleOpName >> printForArity: anArity on: aStream [ 48 | self printForArgs: anArity on: aStream 49 | ] 50 | 51 | { #category : #inspecting } 52 | LzTupleOpName >> synopsis [ 53 | ^ '(•, ...)' 54 | ] 55 | -------------------------------------------------------------------------------- /Leibniz2/LzTupleOpNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTupleOpNode, 3 | #superclass : #LzOpNode, 4 | #instVars : [ 5 | 'leftParen', 6 | 'commas', 7 | 'rightParen' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzTupleOpNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitTupleOp: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzTupleOpNode >> commas [ 19 | ^ commas 20 | ] 21 | 22 | { #category : #generated } 23 | LzTupleOpNode >> commas: anOrderedCollection [ 24 | commas := anOrderedCollection 25 | ] 26 | 27 | { #category : #generated } 28 | LzTupleOpNode >> compositeTokenVariables [ 29 | ^ #(#commas) 30 | ] 31 | 32 | { #category : #'generated-initialize-release' } 33 | LzTupleOpNode >> initialize [ 34 | super initialize. 35 | commas := OrderedCollection new: 2. 36 | ] 37 | 38 | { #category : #generated } 39 | LzTupleOpNode >> leftParen [ 40 | ^ leftParen 41 | ] 42 | 43 | { #category : #generated } 44 | LzTupleOpNode >> leftParen: aSmaCCToken [ 45 | leftParen := aSmaCCToken 46 | ] 47 | 48 | { #category : #generated } 49 | LzTupleOpNode >> rightParen [ 50 | ^ rightParen 51 | ] 52 | 53 | { #category : #generated } 54 | LzTupleOpNode >> rightParen: aSmaCCToken [ 55 | rightParen := aSmaCCToken 56 | ] 57 | 58 | { #category : #generated } 59 | LzTupleOpNode >> tokenVariables [ 60 | ^ #(#leftParen #rightParen) 61 | ] 62 | -------------------------------------------------------------------------------- /Leibniz2/LzTupleTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzTupleTermNode, 3 | #superclass : #LzTermNode, 4 | #instVars : [ 5 | 'leftParen', 6 | 'args', 7 | 'commas', 8 | 'rightParen' 9 | ], 10 | #category : #'Leibniz2-SmaCCParser' 11 | } 12 | 13 | { #category : #generated } 14 | LzTupleTermNode >> acceptVisitor: aParseTreeVisitor [ 15 | ^ aParseTreeVisitor visitTupleTerm: self 16 | ] 17 | 18 | { #category : #generated } 19 | LzTupleTermNode >> args [ 20 | ^ args 21 | ] 22 | 23 | { #category : #generated } 24 | LzTupleTermNode >> args: anOrderedCollection [ 25 | self setParents: self args to: nil. 26 | args := anOrderedCollection. 27 | self setParents: self args to: self 28 | ] 29 | 30 | { #category : #generated } 31 | LzTupleTermNode >> commas [ 32 | ^ commas 33 | ] 34 | 35 | { #category : #generated } 36 | LzTupleTermNode >> commas: anOrderedCollection [ 37 | commas := anOrderedCollection 38 | ] 39 | 40 | { #category : #generated } 41 | LzTupleTermNode >> compositeNodeVariables [ 42 | ^ #(#args) 43 | ] 44 | 45 | { #category : #generated } 46 | LzTupleTermNode >> compositeTokenVariables [ 47 | ^ #(#commas) 48 | ] 49 | 50 | { #category : #'generated-initialize-release' } 51 | LzTupleTermNode >> initialize [ 52 | super initialize. 53 | args := OrderedCollection new: 2. 54 | commas := OrderedCollection new: 2. 55 | ] 56 | 57 | { #category : #generated } 58 | LzTupleTermNode >> leftParen [ 59 | ^ leftParen 60 | ] 61 | 62 | { #category : #generated } 63 | LzTupleTermNode >> leftParen: aSmaCCToken [ 64 | leftParen := aSmaCCToken 65 | ] 66 | 67 | { #category : #generated } 68 | LzTupleTermNode >> rightParen [ 69 | ^ rightParen 70 | ] 71 | 72 | { #category : #generated } 73 | LzTupleTermNode >> rightParen: aSmaCCToken [ 74 | rightParen := aSmaCCToken 75 | ] 76 | 77 | { #category : #generated } 78 | LzTupleTermNode >> tokenVariables [ 79 | ^ #(#leftParen #rightParen) 80 | ] 81 | -------------------------------------------------------------------------------- /Leibniz2/LzUniversalSortFamily.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzUniversalSortFamily, 3 | #superclass : #LzSortFamily, 4 | #category : #'Leibniz2-Sorts' 5 | } 6 | 7 | { #category : #accessing } 8 | LzUniversalSortFamily >> printAsLeibnizSyntaxOn: aStream [ 9 | aStream nextPutAll: LzConstants opNameSort 10 | ] 11 | 12 | { #category : #accessing } 13 | LzUniversalSortFamily >> valueSlots [ 14 | ^ #() 15 | ] 16 | -------------------------------------------------------------------------------- /Leibniz2/LzUseContextDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzUseContextDeclaration, 3 | #superclass : #LzDeclaration, 4 | #instVars : [ 5 | 'contextName', 6 | 'subcontext' 7 | ], 8 | #category : #'Leibniz2-Declarations' 9 | } 10 | 11 | { #category : #converting } 12 | LzUseContextDeclaration >> addAsRopedTextTo: aRopedText [ 13 | aRopedText append: 14 | (contextName asRopedText attribute: LzContextNameAttribute new). 15 | subcontext ifNotNil: [ :s | 16 | aRopedText append: '/' asRopedText. 17 | aRopedText append: (s asRopedText attribute: LzSubcontextNameAttribute new) ] 18 | ] 19 | 20 | { #category : #accessing } 21 | LzUseContextDeclaration >> contextName [ 22 | ^ contextName 23 | ] 24 | 25 | { #category : #accessing } 26 | LzUseContextDeclaration >> contextName: aString [ 27 | contextName := aString 28 | ] 29 | 30 | { #category : #printing } 31 | LzUseContextDeclaration >> printAsLeibnizSyntaxOn: aStream [ 32 | aStream << contextName. 33 | subcontext ifNotNil: [ :s | 34 | aStream 35 | << ', '; 36 | << s ] 37 | ] 38 | 39 | { #category : #accessing } 40 | LzUseContextDeclaration >> subcontext [ 41 | ^ subcontext 42 | ] 43 | 44 | { #category : #accessing } 45 | LzUseContextDeclaration >> subcontext: aString [ 46 | subcontext := aString 47 | ] 48 | -------------------------------------------------------------------------------- /Leibniz2/LzUseContextLink.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzUseContextLink, 3 | #superclass : #LeTextualLink, 4 | #category : #'Leibniz2-Lepiter' 5 | } 6 | 7 | { #category : #printing } 8 | LzUseContextLink >> printOn: aStream [ 9 | self targetPageTitle ifNil: [ ^ super printOn: aStream ]. 10 | aStream 11 | nextPutAll: 'Context Link: '; 12 | nextPutAll: self targetUID 13 | ] 14 | 15 | { #category : #accessing } 16 | LzUseContextLink >> renameTargetTo: aString [ 17 | | source newName interval pageName | 18 | 19 | source := self origin string. 20 | newName := aString. 21 | pageName := node pageName. 22 | interval := pageName position + 1 23 | to: pageName position + pageName size - 2. 24 | self origin 25 | updateString: 26 | (source first: interval first - 1) , newName 27 | , (source copyFrom: interval last + 1 to: source size) 28 | ] 29 | 30 | { #category : #accessing } 31 | LzUseContextLink >> targetPageTitle [ 32 | 33 | ^ self targetReference pageTitle 34 | ] 35 | 36 | { #category : #accessing } 37 | LzUseContextLink >> targetPageTitle: aString [ 38 | self assert: [ aString notNil ]. 39 | self assert: [ targetReference isNil ]. 40 | 41 | targetReference := LeLinkPageTextualTitleReference 42 | forPageTitle: aString. 43 | targetReference explicitLink: self 44 | ] 45 | 46 | { #category : #'api - accepting' } 47 | LzUseContextLink >> targetUID [ 48 | 49 | ^ self targetPageTitle 50 | ] 51 | -------------------------------------------------------------------------------- /Leibniz2/LzVarDeclarationAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzVarDeclarationAttribute, 3 | #superclass : #LzSyntaxAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #rendering } 8 | LzVarDeclarationAttribute >> visualAttributesForColor: aColor [ 9 | ^ { BlTextForegroundAttribute new 10 | paint: aColor quiteWhiter quiteWhiter } 11 | ] 12 | -------------------------------------------------------------------------------- /Leibniz2/LzVarDeclarationBuilder.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzVarDeclarationBuilder, 3 | #superclass : #LzParseTreeNodeVisitor, 4 | #instVars : [ 5 | 'vars' 6 | ], 7 | #category : #'Leibniz2-SmaCCParser' 8 | } 9 | 10 | { #category : #adding } 11 | LzVarDeclarationBuilder >> addVar: aVar sort: aSortTerm derived: aBoolean [ 12 | | newVar | 13 | newVar := LzVarDeclaration new 14 | name: (LzVarName for: aVar); 15 | sort: aSortTerm. 16 | aBoolean ifTrue: [ newVar beDerived ]. 17 | vars at: aVar 18 | ifPresent: [ :v | self assert: v sort equals: newVar sort ] 19 | ifAbsentPut: newVar 20 | ] 21 | 22 | { #category : #initializing } 23 | LzVarDeclarationBuilder >> initialize [ 24 | vars := OrderedDictionary new 25 | ] 26 | 27 | { #category : #accessing } 28 | LzVarDeclarationBuilder >> vars [ 29 | | grouped | 30 | grouped := vars keys groupedBy: [ :each | each endsWith: '__' ]. 31 | ^ ((grouped at: true ifAbsent: #()), (grouped at: false ifAbsent: #())) 32 | collect: [ :each | vars at: each ] 33 | ] 34 | 35 | { #category : #visiting } 36 | LzVarDeclarationBuilder >> visitVar: aVar [ 37 | self acceptNode: aVar sort. 38 | self 39 | addVar: aVar varName value 40 | sort:(LzDeclarationBuilder new acceptNode: aVar sort) 41 | derived: false 42 | ] 43 | 44 | { #category : #visiting } 45 | LzVarDeclarationBuilder >> visitVarTermWithSort: aVarTerm [ 46 | self acceptNode: aVarTerm sort. 47 | self 48 | addVar: aVarTerm varName value 49 | sort:(LzDeclarationBuilder new acceptNode: aVarTerm sort) 50 | derived: true 51 | ] 52 | -------------------------------------------------------------------------------- /Leibniz2/LzVarName.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzVarName, 3 | #superclass : #LzOpName, 4 | #category : #'Leibniz2-Declarations' 5 | } 6 | 7 | { #category : #'instance creation' } 8 | LzVarName class >> for: aStringOrSymbol [ 9 | ^ self new internalSymbol: aStringOrSymbol 10 | ] 11 | 12 | { #category : #converting } 13 | LzVarName >> addAsRopedTextTo: aRopedText [ 14 | | text | 15 | text := internalSymbol asRopedText 16 | attribute: LzVarNameAttribute new. 17 | text 18 | attribute: LzDoNotRenderAttribute new 19 | from: text size to: text size. 20 | aRopedText append: text 21 | ] 22 | 23 | { #category : #converting } 24 | LzVarName >> addForArgs: anArrayOfTerms asRopedTextTo: aRopedText [ 25 | self assert: anArrayOfTerms isEmpty. 26 | self addAsRopedTextTo: aRopedText 27 | ] 28 | 29 | { #category : #modifying } 30 | LzVarName >> addPrefix: aSymbol [ 31 | ^ LzVarName for: aSymbol, internalSymbol 32 | ] 33 | 34 | { #category : #modifying } 35 | LzVarName >> addScope: aSymbol [ 36 | ^ LzScopedVarName for: internalSymbol scope: aSymbol 37 | ] 38 | 39 | { #category : #printing } 40 | LzVarName >> printAsLeibnizSyntaxOn: aStream [ 41 | aStream nextPutAll: internalSymbol 42 | ] 43 | 44 | { #category : #printing } 45 | LzVarName >> printForArgs: anENodeArray on: aStream parents: aNodeSet [ 46 | self printForArgs: anENodeArray on: aStream 47 | ] 48 | 49 | { #category : #printing } 50 | LzVarName >> printForArity: anArity on: aStream [ 51 | self assert: anArity isEmpty. 52 | self printAsLeibnizSyntaxOn: aStream 53 | ] 54 | 55 | { #category : #accessing } 56 | LzVarName >> tag [ 57 | ^ nil 58 | ] 59 | -------------------------------------------------------------------------------- /Leibniz2/LzVarNameAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzVarNameAttribute, 3 | #superclass : #LzIdentifierAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | 7 | { #category : #rendering } 8 | LzVarNameAttribute >> visualAttributesForColor: aColor [ 9 | ^ { BlTextDecorationAttribute new 10 | underline 11 | color: aColor quiteWhiter quiteWhiter } 12 | ] 13 | -------------------------------------------------------------------------------- /Leibniz2/LzVarNameScopeAttribute.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzVarNameScopeAttribute, 3 | #superclass : #LzIdentifierAttribute, 4 | #category : #'Leibniz2-Rendering' 5 | } 6 | -------------------------------------------------------------------------------- /Leibniz2/LzVarNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzVarNode, 3 | #superclass : #LzParseTreeNode, 4 | #instVars : [ 5 | 'varName', 6 | 'colon', 7 | 'sort' 8 | ], 9 | #category : #'Leibniz2-SmaCCParser' 10 | } 11 | 12 | { #category : #generated } 13 | LzVarNode >> acceptVisitor: aParseTreeVisitor [ 14 | ^ aParseTreeVisitor visitVar: self 15 | ] 16 | 17 | { #category : #generated } 18 | LzVarNode >> colon [ 19 | ^ colon 20 | ] 21 | 22 | { #category : #generated } 23 | LzVarNode >> colon: aSmaCCToken [ 24 | colon := aSmaCCToken 25 | ] 26 | 27 | { #category : #generated } 28 | LzVarNode >> nodeVariables [ 29 | ^ #(#sort) 30 | ] 31 | 32 | { #category : #generated } 33 | LzVarNode >> sort [ 34 | ^ sort 35 | ] 36 | 37 | { #category : #generated } 38 | LzVarNode >> sort: aLzParseTreeNode [ 39 | self sort notNil ifTrue: [ self sort parent: nil ]. 40 | sort := aLzParseTreeNode. 41 | self sort notNil ifTrue: [ self sort parent: self ] 42 | ] 43 | 44 | { #category : #generated } 45 | LzVarNode >> tokenVariables [ 46 | ^ #(#varName #colon) 47 | ] 48 | 49 | { #category : #generated } 50 | LzVarNode >> varName [ 51 | ^ varName 52 | ] 53 | 54 | { #category : #generated } 55 | LzVarNode >> varName: aSmaCCToken [ 56 | varName := aSmaCCToken 57 | ] 58 | -------------------------------------------------------------------------------- /Leibniz2/LzVarTermDeclaration.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzVarTermDeclaration, 3 | #superclass : #LzTermDeclaration, 4 | #instVars : [ 5 | 'name', 6 | 'sort' 7 | ], 8 | #category : #'Leibniz2-Declarations' 9 | } 10 | 11 | { #category : #converting } 12 | LzVarTermDeclaration >> addAsRopedTextTo: aRopedText [ 13 | name addAsRopedTextTo: aRopedText. 14 | self includesVarDeclaration ifTrue: [ 15 | self 16 | do: [ :t | 17 | t append: ':' asRopedText. 18 | self 19 | do: [ :tt | self sort addAsRopedTextTo: tt ] 20 | to: t 21 | withAttribute: LzSortAttribute new ] 22 | to: aRopedText 23 | withAttribute: LzVarDeclarationAttribute new ] 24 | ] 25 | 26 | { #category : #constructing } 27 | LzVarTermDeclaration >> buildFor: aSignature variables: aDictionary [ 28 | ^ aSignature varTerm: self name variables: aDictionary 29 | ] 30 | 31 | { #category : #testing } 32 | LzVarTermDeclaration >> includesVarDeclaration [ 33 | ^ sort isNotNil 34 | ] 35 | 36 | { #category : #accessing } 37 | LzVarTermDeclaration >> name [ 38 | ^ name 39 | ] 40 | 41 | { #category : #accessing } 42 | LzVarTermDeclaration >> name: aVarName [ 43 | name := aVarName 44 | ] 45 | 46 | { #category : #printing } 47 | LzVarTermDeclaration >> printAsLeibnizSyntaxOn: aStream [ 48 | aStream nextPutAll: name asSymbol. 49 | self includesVarDeclaration ifTrue: [ 50 | aStream nextPut: $:. 51 | self sort printAsLeibnizSyntaxOn: aStream ] 52 | ] 53 | 54 | { #category : #accessing } 55 | LzVarTermDeclaration >> sort [ 56 | ^ sort 57 | ] 58 | 59 | { #category : #accessing } 60 | LzVarTermDeclaration >> sort: aTermDeclaration [ 61 | sort := aTermDeclaration 62 | ] 63 | -------------------------------------------------------------------------------- /Leibniz2/LzVarTermNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzVarTermNode, 3 | #superclass : #LzTermNode, 4 | #instVars : [ 5 | 'varName' 6 | ], 7 | #category : #'Leibniz2-SmaCCParser' 8 | } 9 | 10 | { #category : #generated } 11 | LzVarTermNode >> acceptVisitor: aParseTreeVisitor [ 12 | ^ aParseTreeVisitor visitVarTerm: self 13 | ] 14 | 15 | { #category : #generated } 16 | LzVarTermNode >> tokenVariables [ 17 | ^ #(#varName) 18 | ] 19 | 20 | { #category : #generated } 21 | LzVarTermNode >> varName [ 22 | ^ varName 23 | ] 24 | 25 | { #category : #generated } 26 | LzVarTermNode >> varName: aSmaCCToken [ 27 | varName := aSmaCCToken 28 | ] 29 | -------------------------------------------------------------------------------- /Leibniz2/LzVarTermWithSortNode.class.st: -------------------------------------------------------------------------------- 1 | Class { 2 | #name : #LzVarTermWithSortNode, 3 | #superclass : #LzVarTermNode, 4 | #instVars : [ 5 | 'colon', 6 | 'sort' 7 | ], 8 | #category : #'Leibniz2-SmaCCParser' 9 | } 10 | 11 | { #category : #generated } 12 | LzVarTermWithSortNode >> acceptVisitor: aParseTreeVisitor [ 13 | ^ aParseTreeVisitor visitVarTermWithSort: self 14 | ] 15 | 16 | { #category : #generated } 17 | LzVarTermWithSortNode >> colon [ 18 | ^ colon 19 | ] 20 | 21 | { #category : #generated } 22 | LzVarTermWithSortNode >> colon: aSmaCCToken [ 23 | colon := aSmaCCToken 24 | ] 25 | 26 | { #category : #generated } 27 | LzVarTermWithSortNode >> nodeVariables [ 28 | ^ #(#sort) 29 | ] 30 | 31 | { #category : #generated } 32 | LzVarTermWithSortNode >> sort [ 33 | ^ sort 34 | ] 35 | 36 | { #category : #generated } 37 | LzVarTermWithSortNode >> sort: aLzParseTreeNode [ 38 | self sort notNil ifTrue: [ self sort parent: nil ]. 39 | sort := aLzParseTreeNode. 40 | self sort notNil ifTrue: [ self sort parent: self ] 41 | ] 42 | 43 | { #category : #generated } 44 | LzVarTermWithSortNode >> tokenVariables [ 45 | ^ #(#colon #varName) 46 | ] 47 | -------------------------------------------------------------------------------- /Leibniz2/Number.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Number } 2 | 3 | { #category : #'*Leibniz2' } 4 | Number >> asLeibnizSyntax [ 5 | ^ self printString asRopedText 6 | ] 7 | -------------------------------------------------------------------------------- /Leibniz2/Object.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Object } 2 | 3 | { #category : #'*Leibniz2' } 4 | Object >> isEqualTo: anObject cache: anIdentitySet [ 5 | ^ self = anObject 6 | ] 7 | 8 | { #category : #'*Leibniz2' } 9 | Object >> isLzASTNode [ 10 | ^ false 11 | ] 12 | 13 | { #category : #'*Leibniz2' } 14 | Object >> lzAtomicTermValue [ 15 | LzRewriteFailure signal: 'not an atomic term: ', self asString 16 | ] 17 | -------------------------------------------------------------------------------- /Leibniz2/SequenceableCollection.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #SequenceableCollection } 2 | 3 | { #category : #'*Leibniz2' } 4 | SequenceableCollection >> cartesianProductDo: aBlock [ 5 | self cartesianProductWith: #() do: aBlock 6 | ] 7 | 8 | { #category : #'*Leibniz2' } 9 | SequenceableCollection >> cartesianProductWith: anArray do: aBlock [ 10 | self 11 | ifEmpty: [ aBlock cull: anArray ] 12 | ifNotEmpty: [ self first do: [ :each | 13 | self allButFirst 14 | cartesianProductWith: (anArray, { each }) 15 | do: aBlock ] ] 16 | ] 17 | -------------------------------------------------------------------------------- /Leibniz2/TLeAnnotationParseNodeVisitor.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #TLeAnnotationParseNodeVisitor } 2 | 3 | { #category : #'*Leibniz2' } 4 | TLeAnnotationParseNodeVisitor >> visitTopLevelAsset: aLzTopLevelAssetNode [ 5 | ] 6 | 7 | { #category : #'*Leibniz2' } 8 | TLeAnnotationParseNodeVisitor >> visitTopLevelEqualityAxiom: aLzTopLevelEqualityAxiomNode [ 9 | ] 10 | 11 | { #category : #'*Leibniz2' } 12 | TLeAnnotationParseNodeVisitor >> visitTopLevelFunctionRule: aLzTopLevelFunctionRuleNode [ 13 | ] 14 | 15 | { #category : #'*Leibniz2' } 16 | TLeAnnotationParseNodeVisitor >> visitTopLevelOp: aLzTopLevelOpNode [ 17 | ] 18 | 19 | { #category : #'*Leibniz2' } 20 | TLeAnnotationParseNodeVisitor >> visitTopLevelRewriteRule: aLzTopLevelRewriteRuleNode [ 21 | ] 22 | 23 | { #category : #'*Leibniz2' } 24 | TLeAnnotationParseNodeVisitor >> visitTopLevelSort: aLzTopLevelSortNode [ 25 | ] 26 | 27 | { #category : #'*Leibniz2' } 28 | TLeAnnotationParseNodeVisitor >> visitTopLevelSpecialTerms: aLzTopLevelSpecialTermsNode [ 29 | ] 30 | 31 | { #category : #'*Leibniz2' } 32 | TLeAnnotationParseNodeVisitor >> visitTopLevelSubsort: aLzTopLevelSubsortNode [ 33 | ] 34 | 35 | { #category : #'*Leibniz2' } 36 | TLeAnnotationParseNodeVisitor >> visitTopLevelTerm: aLzTopLevelTermNode [ 37 | ] 38 | 39 | { #category : #'*Leibniz2' } 40 | TLeAnnotationParseNodeVisitor >> visitTopLevelUseContext: aLzTopLevelUseContextNode [ 41 | ] 42 | -------------------------------------------------------------------------------- /Leibniz2/package.st: -------------------------------------------------------------------------------- 1 | Package { #name : #Leibniz2 } 2 | -------------------------------------------------------------------------------- /RecurrenceEquations/Array2D.extension.st: -------------------------------------------------------------------------------- 1 | Extension { #name : #Array2D } 2 | 3 | { #category : #'*RecurrenceEquations' } 4 | Array2D >> grownByRows: length [ 5 | ^ self class 6 | rows: (self numberOfRows + length) 7 | columns: self numberOfColumns 8 | contents: (contents grownBy: length * self numberOfColumns) 9 | ] 10 | -------------------------------------------------------------------------------- /RecurrenceEquations/package.st: -------------------------------------------------------------------------------- 1 | Package { #name : #RecurrenceEquations } 2 | -------------------------------------------------------------------------------- /codemeta.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "https://doi.org/10.5063/schema/codemeta-2.0", 3 | "type": "SoftwareSourceCode", 4 | "applicationCategory": "Computational science", 5 | "author": [ 6 | { 7 | "id": "https://orcid.org/0000-0003-0330-9428", 8 | "type": "Person", 9 | "affiliation": { 10 | "type": "Organization", 11 | "name": "CNRS, France" 12 | }, 13 | "email": "konrad.hinsen@cnrs.fr", 14 | "familyName": "Hinsen", 15 | "givenName": "Konrad" 16 | } 17 | ], 18 | "codeRepository": "https://github.com/khinsen/leibniz-pharo.git", 19 | "dateCreated": "2018-11-17", 20 | "description": "A Digital Scientific Notation for physics, chemistry, and disciplines using similar computational approaches.", 21 | "keywords": "digital scientific notation", 22 | "license": "https://spdx.org/licenses/MIT", 23 | "name": "Leibniz 2", 24 | "operatingSystem": [ 25 | "Linux", 26 | "Windows", 27 | "macOS" 28 | ], 29 | "programmingLanguage": "Pharo", 30 | "softwareRequirements": "https://gtoolkit.com/", 31 | "developmentStatus": "active", 32 | "issueTracker": "https://github.com/khinsen/leibniz-pharo/issues" 33 | } 34 | -------------------------------------------------------------------------------- /documentation/6h5h7fu4a4vix5gl5p57s0s16.lepiter: -------------------------------------------------------------------------------- 1 | { 2 | "__schema" : "4.1", 3 | "__type" : "page", 4 | "children" : { 5 | "__type" : "snippets", 6 | "items" : [ ] 7 | }, 8 | "createEmail" : { 9 | "__type" : "email", 10 | "emailString" : "" 11 | }, 12 | "createTime" : { 13 | "__type" : "time", 14 | "time" : { 15 | "__type" : "dateAndTime", 16 | "dateAndTimeString" : "2023-12-27T11:15:57.783079+01:00" 17 | } 18 | }, 19 | "editEmail" : { 20 | "__type" : "email", 21 | "emailString" : "" 22 | }, 23 | "editTime" : { 24 | "__type" : "time", 25 | "time" : { 26 | "__type" : "dateAndTime", 27 | "dateAndTimeString" : "2023-12-27T11:15:57.783079+01:00" 28 | } 29 | }, 30 | "pageType" : { 31 | "__type" : "namedPage", 32 | "title" : "Scratchpad" 33 | }, 34 | "uid" : { 35 | "__type" : "uuid", 36 | "uuid" : "ea35f1d1-dcc9-0d00-b3b8-9d12091f656d" 37 | } 38 | } -------------------------------------------------------------------------------- /documentation/eeuhoubq1enqrc33ndtqotx3h.lepiter: -------------------------------------------------------------------------------- 1 | { 2 | "__schema" : "4.1", 3 | "__type" : "page", 4 | "children" : { 5 | "__type" : "snippets", 6 | "items" : [ ] 7 | }, 8 | "createEmail" : { 9 | "__type" : "email", 10 | "emailString" : "" 11 | }, 12 | "createTime" : { 13 | "__type" : "time", 14 | "time" : { 15 | "__type" : "dateAndTime", 16 | "dateAndTimeString" : "2022-06-16T18:52:35.000603+02:00" 17 | } 18 | }, 19 | "editEmail" : { 20 | "__type" : "email", 21 | "emailString" : "" 22 | }, 23 | "editTime" : { 24 | "__type" : "time", 25 | "time" : { 26 | "__type" : "dateAndTime", 27 | "dateAndTimeString" : "2022-06-16T18:52:35.000603+02:00" 28 | } 29 | }, 30 | "pageType" : { 31 | "__type" : "namedPage", 32 | "title" : "Rewriting" 33 | }, 34 | "uid" : { 35 | "__type" : "uuid", 36 | "uuid" : "cd1c9233-f59d-0d00-bc75-5c33026a71f3" 37 | } 38 | } -------------------------------------------------------------------------------- /documentation/lepiter.properties: -------------------------------------------------------------------------------- 1 | { 2 | "uuid" : "4a1320da-1086-0d00-bfcf-ce7f0fd45cfb", 3 | "tableOfContents" : "748hz1dcrnn7zrb9ld8qymj97", 4 | "schema" : "4.1", 5 | "databaseName" : "Leibniz documentation" 6 | } -------------------------------------------------------------------------------- /html/assets/fonts/JuliaMono-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khinsen/leibniz-pharo/6e04b5c45ac09b676fc0dfe1c725e6f843c4f364/html/assets/fonts/JuliaMono-Bold.woff2 -------------------------------------------------------------------------------- /html/assets/fonts/JuliaMono-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khinsen/leibniz-pharo/6e04b5c45ac09b676fc0dfe1c725e6f843c4f364/html/assets/fonts/JuliaMono-BoldItalic.woff2 -------------------------------------------------------------------------------- /html/assets/fonts/JuliaMono-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khinsen/leibniz-pharo/6e04b5c45ac09b676fc0dfe1c725e6f843c4f364/html/assets/fonts/JuliaMono-Regular.woff2 -------------------------------------------------------------------------------- /html/assets/fonts/JuliaMono-RegularItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khinsen/leibniz-pharo/6e04b5c45ac09b676fc0dfe1c725e6f843c4f364/html/assets/fonts/JuliaMono-RegularItalic.woff2 -------------------------------------------------------------------------------- /html/page-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {title} 7 | 8 | 9 | 10 | 13 |
14 |

{title}

15 | {content} 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /html/single-page-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {title} 7 | 8 | 9 | 10 |
11 |

{title}

12 | {content} 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /leibniz-installation-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khinsen/leibniz-pharo/6e04b5c45ac09b676fc0dfe1c725e6f843c4f364/leibniz-installation-1.png -------------------------------------------------------------------------------- /leibniz-installation-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khinsen/leibniz-pharo/6e04b5c45ac09b676fc0dfe1c725e6f843c4f364/leibniz-installation-2.png -------------------------------------------------------------------------------- /leibniz-installation-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khinsen/leibniz-pharo/6e04b5c45ac09b676fc0dfe1c725e6f843c4f364/leibniz-installation-3.png -------------------------------------------------------------------------------- /leibniz-installation-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khinsen/leibniz-pharo/6e04b5c45ac09b676fc0dfe1c725e6f843c4f364/leibniz-installation-4.png -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khinsen/leibniz-pharo/6e04b5c45ac09b676fc0dfe1c725e6f843c4f364/screenshot.png --------------------------------------------------------------------------------