├── .gitattributes ├── CODEOWNERS ├── test └── org │ └── rascalmpl │ ├── benchmark │ ├── Fibonacci │ │ ├── fib.trm │ │ ├── Fibonacci2.asf │ │ ├── Fibonacci │ │ └── Fibonacci2.sdf │ ├── Factorial │ │ ├── fac2-10.trm │ │ ├── fac2-5.trm │ │ ├── fac2-8.trm │ │ ├── fac2-9.trm │ │ ├── fac1-5.trm │ │ ├── fac1-6.trm │ │ ├── fac1-7.trm │ │ ├── fac1-8.trm │ │ ├── fac1-10.trm │ │ ├── Factorial │ │ ├── Factorial2.asf │ │ ├── Factorial.py │ │ ├── Factorial.rb │ │ └── Factorial2.sdf │ ├── Reverse │ │ ├── Reverse │ │ ├── Reverse2.asf │ │ ├── Reverse2.sdf │ │ ├── Reverse.rb │ │ ├── rev1.trm │ │ ├── rev2.trm │ │ └── rev3.trm │ └── BenchmarkResults.xls │ ├── util │ └── maven │ │ ├── m2 │ │ └── repository │ │ │ ├── parent │ │ │ └── test │ │ │ │ └── 1.0 │ │ │ │ ├── test-1.0.jar │ │ │ │ └── test-1.0.pom │ │ │ ├── range │ │ │ ├── level1a │ │ │ │ ├── 1.0 │ │ │ │ │ ├── level1a-1.0.jar │ │ │ │ │ └── level1a-1.0.pom │ │ │ │ ├── 2.0 │ │ │ │ │ ├── level1a-2.0.jar │ │ │ │ │ └── level1a-2.0.pom │ │ │ │ └── maven-metadata.xml │ │ │ ├── level1b │ │ │ │ ├── 1.0 │ │ │ │ │ ├── level1b-1.0.jar │ │ │ │ │ └── level1b-1.0.pom │ │ │ │ └── 2.0 │ │ │ │ │ ├── level1b-2.0.jar │ │ │ │ │ └── level1b-2.0.pom │ │ │ ├── level1c │ │ │ │ ├── 1.0 │ │ │ │ │ ├── level1c-1.0.jar │ │ │ │ │ └── level1c-1.0.pom │ │ │ │ └── 2.0 │ │ │ │ │ ├── level1c-2.0.jar │ │ │ │ │ └── level1c-2.0.pom │ │ │ ├── level2 │ │ │ │ ├── 1.0 │ │ │ │ │ ├── level2-1.0.jar │ │ │ │ │ └── level2-1.0.pom │ │ │ │ ├── 1.5 │ │ │ │ │ ├── level2-1.5.jar │ │ │ │ │ └── level2-1.5.pom │ │ │ │ ├── 2.0 │ │ │ │ │ ├── level2-2.0.jar │ │ │ │ │ └── level2-2.0.pom │ │ │ │ └── maven-metadata.xml │ │ │ ├── level3 │ │ │ │ ├── 1.0 │ │ │ │ │ ├── level3-1.0.jar │ │ │ │ │ └── level3-1.0.pom │ │ │ │ ├── 2.0 │ │ │ │ │ ├── level3-2.0.jar │ │ │ │ │ └── level3-2.0.pom │ │ │ │ └── maven-metadata.xml │ │ │ └── level4 │ │ │ │ ├── 1.0 │ │ │ │ ├── level4-1.0.jar │ │ │ │ └── level4-1.0.pom │ │ │ │ ├── 2.0 │ │ │ │ ├── level4-2.0.jar │ │ │ │ └── level4-2.0.pom │ │ │ │ └── maven-metadata.xml │ │ │ ├── trans │ │ │ ├── level1 │ │ │ │ └── 1.0 │ │ │ │ │ ├── level1-1.0.jar │ │ │ │ │ └── level1-1.0.pom │ │ │ ├── level2 │ │ │ │ └── 1.0 │ │ │ │ │ ├── level2-1.0.jar │ │ │ │ │ └── level2-1.0.pom │ │ │ └── level3 │ │ │ │ └── 1.0 │ │ │ │ ├── level3-1.0.jar │ │ │ │ └── level3-1.0.pom │ │ │ └── breadth-first │ │ │ ├── level2 │ │ │ └── 1.0 │ │ │ │ ├── level2-1.0.jar │ │ │ │ └── level2-1.0.pom │ │ │ ├── level3 │ │ │ ├── 1.0 │ │ │ │ ├── level3-1.0.jar │ │ │ │ └── level3-1.0.pom │ │ │ └── 2.0 │ │ │ │ ├── level3-2.0.jar │ │ │ │ └── level3-2.0.pom │ │ │ ├── level1a │ │ │ └── 1.0 │ │ │ │ ├── level1a-1.0.jar │ │ │ │ └── level1a-1.0.pom │ │ │ └── level1b │ │ │ └── 1.0 │ │ │ ├── level1b-1.0.jar │ │ │ └── level1b-1.0.pom │ │ ├── poms │ │ ├── local-reference │ │ │ ├── lorem-ipsum.jar │ │ │ ├── pom-no-version.xml │ │ │ ├── pom-no-groupid.xml │ │ │ ├── pom-proxy.xml │ │ │ └── pom-transitive-exclusions.xml │ │ ├── rascal │ │ │ └── generate-expected-path-list.sh │ │ ├── remote-reference │ │ │ └── pom.xml │ │ └── range │ │ │ └── pom.xml │ │ ├── testhomedir │ │ └── .m2 │ │ │ └── settings.xml │ │ ├── proxyhomedir │ │ └── .m2 │ │ │ └── settings.xml │ │ └── mirrorhomedir │ │ └── .m2 │ │ └── settings.xml │ └── test │ ├── data │ └── fca │ │ ├── legacy.cxt │ │ ├── digits.cxt │ │ ├── gewaesser.cxt │ │ ├── liveinwater.cxt │ │ ├── tealady.cxt │ │ └── lattice.cxt │ ├── library │ ├── LibraryUtilRunner.java │ ├── LibraryLangPaths.java │ ├── LibraryJavaCompilerRunner.java │ └── RunRascalTestModules.java │ ├── util │ ├── LibraryUtilModules.java │ └── library │ │ └── RunRascalTestModules.java │ ├── basic │ └── RunRascalTestModules.java │ ├── types │ └── RunRascalTestModules.java │ ├── concrete │ └── RunRascalTestModules.java │ ├── AllSuiteParallel.java │ ├── parallel │ └── AllSuiteParallel.java │ ├── demo │ └── RunRascalTestModules.java │ ├── extend │ └── RunRascalTestModules.java │ ├── imports │ └── RunRascalTestModules.java │ ├── syntax │ └── RunRascalSyntaxTestModules.java │ ├── functionality │ └── RunRascalTestModules.java │ ├── TypecheckerSuite.java │ ├── ParserSyntaxDemoBenchmarkSuite.java │ └── AllSuite.java ├── src ├── org │ └── rascalmpl │ │ ├── library │ │ ├── lang │ │ │ ├── rascal │ │ │ │ ├── syntax │ │ │ │ │ ├── .gitattributes │ │ │ │ │ └── tests │ │ │ │ │ │ ├── PreBootstrap.rsc │ │ │ │ │ │ └── KnownIssues.rsc │ │ │ │ ├── tests │ │ │ │ │ ├── extends4 │ │ │ │ │ │ ├── A.rsc │ │ │ │ │ │ ├── B.rsc │ │ │ │ │ │ └── C.rsc │ │ │ │ │ ├── imports │ │ │ │ │ │ ├── M7.rsc │ │ │ │ │ │ ├── M9.rsc │ │ │ │ │ │ ├── Mbase.rsc │ │ │ │ │ │ ├── M1.rsc │ │ │ │ │ │ ├── M2.rsc │ │ │ │ │ │ ├── ModuleInitRange.rsc │ │ │ │ │ │ ├── IMP1.rsc │ │ │ │ │ │ ├── Imports6.rsc │ │ │ │ │ │ ├── M4.rsc │ │ │ │ │ │ ├── M5.rsc │ │ │ │ │ │ ├── IMP2.rsc │ │ │ │ │ │ ├── M6.rsc │ │ │ │ │ │ ├── Imports7.rsc │ │ │ │ │ │ ├── Imports2.rsc │ │ │ │ │ │ ├── Imports1.rsc │ │ │ │ │ │ ├── Imports4.rsc │ │ │ │ │ │ ├── C1.rsc │ │ │ │ │ │ ├── C2.rsc │ │ │ │ │ │ ├── Imports3.rsc │ │ │ │ │ │ ├── Imports8.rsc │ │ │ │ │ │ ├── Imports5.rsc │ │ │ │ │ │ └── CyclicImports1.rsc │ │ │ │ │ ├── concrete │ │ │ │ │ │ ├── recovery │ │ │ │ │ │ │ ├── bugs │ │ │ │ │ │ │ │ ├── InfiniteLoopInput.txt │ │ │ │ │ │ │ │ ├── ScratchNPE.rsc │ │ │ │ │ │ │ │ └── FCASlow.rsc │ │ │ │ │ │ │ └── stats │ │ │ │ │ │ │ │ ├── attach-remote.sh │ │ │ │ │ │ │ │ └── monitor-benchmark.sh │ │ │ │ │ │ ├── OtherSyntax.rsc │ │ │ │ │ │ ├── Field.rsc │ │ │ │ │ │ ├── ParseTreeEquality.rsc │ │ │ │ │ │ ├── FirstAmbiguity.rsc │ │ │ │ │ │ ├── Function.rsc │ │ │ │ │ │ ├── CaseInsensitiveMatching.rsc │ │ │ │ │ │ ├── AtColumnRequirement.rsc │ │ │ │ │ │ ├── Syntax6.rsc │ │ │ │ │ │ ├── Issue1913.rsc │ │ │ │ │ │ ├── FieldProjectionBug.rsc │ │ │ │ │ │ ├── IsDefined.rsc │ │ │ │ │ │ ├── Issue2147.rsc │ │ │ │ │ │ ├── Syntax3.rsc │ │ │ │ │ │ ├── Call.rsc │ │ │ │ │ │ └── PostParseFilter.rsc │ │ │ │ │ ├── extend_function1 │ │ │ │ │ │ ├── M1.rsc │ │ │ │ │ │ ├── M2.rsc │ │ │ │ │ │ └── M3.rsc │ │ │ │ │ ├── extends3 │ │ │ │ │ │ ├── A.rsc │ │ │ │ │ │ ├── B.rsc │ │ │ │ │ │ ├── C.rsc │ │ │ │ │ │ ├── D.rsc │ │ │ │ │ │ ├── E.rsc │ │ │ │ │ │ └── F.rsc │ │ │ │ │ ├── extends2 │ │ │ │ │ │ ├── COLLECTOR.rsc │ │ │ │ │ │ ├── CHECKER.rsc │ │ │ │ │ │ ├── TYPEPAL.rsc │ │ │ │ │ │ └── RUNCHECKER.rsc │ │ │ │ │ ├── functionality │ │ │ │ │ │ ├── KeywordParameterImport1 │ │ │ │ │ │ │ └── DiamondTop.rsc │ │ │ │ │ │ ├── CommonKeywordParameter4 │ │ │ │ │ │ │ ├── C.rsc │ │ │ │ │ │ │ ├── B.rsc │ │ │ │ │ │ │ └── A.rsc │ │ │ │ │ │ ├── CommonKeywordParameterImport1 │ │ │ │ │ │ │ ├── DiamondTop.rsc │ │ │ │ │ │ │ ├── DiamondLeft.rsc │ │ │ │ │ │ │ ├── DiamondRight.rsc │ │ │ │ │ │ │ └── DiamondBottom.rsc │ │ │ │ │ │ ├── CommonKeywordParameterImport3 │ │ │ │ │ │ │ ├── B.rsc │ │ │ │ │ │ │ ├── Tests.rsc │ │ │ │ │ │ │ ├── A.rsc │ │ │ │ │ │ │ └── D.rsc │ │ │ │ │ │ ├── KeywordParameterExtend1 │ │ │ │ │ │ │ ├── Extended.rsc │ │ │ │ │ │ │ └── Extending.rsc │ │ │ │ │ │ ├── KeywordParameterImport2 │ │ │ │ │ │ │ ├── Import1.rsc │ │ │ │ │ │ │ └── Import2.rsc │ │ │ │ │ │ ├── SimpleVisit.rsc │ │ │ │ │ │ ├── CallAux.rsc │ │ │ │ │ │ ├── CommonKeywordParameterImport2 │ │ │ │ │ │ │ └── DiamondTop.rsc │ │ │ │ │ │ └── Projection.rsc │ │ │ │ │ ├── library │ │ │ │ │ │ ├── util │ │ │ │ │ │ │ ├── UUIDTests.rsc │ │ │ │ │ │ │ └── PriorityQueueTests.rsc │ │ │ │ │ │ ├── analysis │ │ │ │ │ │ │ └── formalconcepts │ │ │ │ │ │ │ │ └── FCxt1.fca │ │ │ │ │ │ ├── Type.rsc │ │ │ │ │ │ └── lang │ │ │ │ │ │ │ ├── xml │ │ │ │ │ │ │ └── glossary.xml │ │ │ │ │ │ │ └── json │ │ │ │ │ │ │ └── glossary.json │ │ │ │ │ ├── basic │ │ │ │ │ │ ├── TestsForTests.rsc │ │ │ │ │ │ ├── DynamicDispatch.rsc │ │ │ │ │ │ ├── Intermix.rsc │ │ │ │ │ │ ├── CompilerIssues │ │ │ │ │ │ │ ├── TemplateInConditional.rsc │ │ │ │ │ │ │ ├── VariableInOr.rsc │ │ │ │ │ │ │ ├── ListMatchInIfCondition.rsc │ │ │ │ │ │ │ ├── QualifiedName.rsc │ │ │ │ │ │ │ ├── NoMatchInWhen.rsc │ │ │ │ │ │ │ └── TypedQualifiedName.rsc │ │ │ │ │ │ ├── FunctionAssignment.rsc │ │ │ │ │ │ └── Strings2.rsc │ │ │ │ │ ├── extends1 │ │ │ │ │ │ ├── Base.rsc │ │ │ │ │ │ ├── B3.rsc │ │ │ │ │ │ ├── Base1.rsc │ │ │ │ │ │ ├── BaseExtended.rsc │ │ │ │ │ │ ├── Extension1.rsc │ │ │ │ │ │ ├── TYPE.rsc │ │ │ │ │ │ ├── Extension2.rsc │ │ │ │ │ │ ├── PARENT.rsc │ │ │ │ │ │ ├── UseImportBase.rsc │ │ │ │ │ │ ├── Extension3.rsc │ │ │ │ │ │ ├── B1.rsc │ │ │ │ │ │ ├── UseExtendBase.rsc │ │ │ │ │ │ └── Base3.rsc │ │ │ │ │ └── tutor │ │ │ │ │ │ └── example.questions │ │ │ │ ├── meta │ │ │ │ │ └── ModuleInfoTests.rsc │ │ │ │ ├── doc │ │ │ │ │ ├── example.tex │ │ │ │ │ └── rascal.sty │ │ │ │ ├── grammar │ │ │ │ │ └── definition │ │ │ │ │ │ └── References.rsc │ │ │ │ ├── upgrade │ │ │ │ │ └── UpdateNestedListAndSetPatterns.rsc │ │ │ │ └── matching │ │ │ │ │ └── internal │ │ │ │ │ └── Fingerprint.java │ │ │ ├── csv │ │ │ │ ├── examples │ │ │ │ │ ├── ex1b.csv │ │ │ │ │ ├── ex1.csv │ │ │ │ │ └── ex1a.csv │ │ │ │ ├── syntax │ │ │ │ │ ├── Parse.rsc │ │ │ │ │ └── CSV.rsc │ │ │ │ └── ast │ │ │ │ │ ├── Implode.rsc │ │ │ │ │ └── CSV.rsc │ │ │ ├── std │ │ │ │ ├── tests │ │ │ │ │ ├── Comment.rsc │ │ │ │ │ ├── Whitespace.rsc │ │ │ │ │ ├── Layout.rsc │ │ │ │ │ └── Id.rsc │ │ │ │ ├── Comment.rsc │ │ │ │ ├── Id.rsc │ │ │ │ ├── ASCII.rsc │ │ │ │ ├── Whitespace.rsc │ │ │ │ └── Layout.rsc │ │ │ ├── xml │ │ │ │ └── examples │ │ │ │ │ └── note.xml │ │ │ ├── sdf2 │ │ │ │ └── filters │ │ │ │ │ ├── DetectCycles.rsc │ │ │ │ │ ├── FilterCycles.rsc │ │ │ │ │ ├── Reject.rsc │ │ │ │ │ ├── InjectionCount.rsc │ │ │ │ │ ├── GeneralInjectionCount.rsc │ │ │ │ │ ├── PreferAvoid.rsc │ │ │ │ │ └── CountPreferAvoid.rsc │ │ │ ├── c90 │ │ │ │ └── examples │ │ │ │ │ └── hello-world.c │ │ │ ├── pico │ │ │ │ └── examples │ │ │ │ │ ├── flip.pico │ │ │ │ │ └── fac.pico │ │ │ ├── json │ │ │ │ ├── examples │ │ │ │ │ ├── ex01.json │ │ │ │ │ └── ex02.json │ │ │ │ └── ast │ │ │ │ │ └── JSON.rsc │ │ │ ├── smtlib2 │ │ │ │ ├── command │ │ │ │ │ └── response │ │ │ │ │ │ ├── Parse.rsc │ │ │ │ │ │ ├── Implode.rsc │ │ │ │ │ │ └── Ast.rsc │ │ │ │ └── theory │ │ │ │ │ ├── core │ │ │ │ │ └── Ast.rsc │ │ │ │ │ └── ints │ │ │ │ │ └── Ast.rsc │ │ │ ├── sexp │ │ │ │ └── SExp.rsc │ │ │ └── dimacs │ │ │ │ └── syntax │ │ │ │ └── Dimacs.rsc │ │ ├── analysis │ │ │ ├── clustering │ │ │ │ └── TODO.txt │ │ │ ├── m3 │ │ │ │ └── FlowGraph.rsc │ │ │ └── statistics │ │ │ │ └── TODO.txt │ │ └── util │ │ │ ├── Memo.rsc │ │ │ ├── Random.rsc │ │ │ ├── Webserver.rsc │ │ │ └── SystemAPI.rsc │ │ ├── tutor │ │ └── lang │ │ │ └── rascal │ │ │ └── tutor │ │ │ ├── examples │ │ │ └── Test │ │ │ │ ├── Libraries │ │ │ │ ├── Boolean │ │ │ │ │ └── Boolean.remote │ │ │ │ └── Libraries.md │ │ │ │ ├── t1.png │ │ │ │ ├── CallAnalysis │ │ │ │ └── calls.png │ │ │ │ ├── Test.quest │ │ │ │ └── Vis │ │ │ │ ├── Example.rsc │ │ │ │ └── Vis.md │ │ │ └── questions │ │ │ └── ParseQuestions.rsc │ │ ├── tasks │ │ ├── IExpirationListener.java │ │ ├── RefFactPolicy.java │ │ ├── DepFactPolicy.java │ │ ├── INameFormatter.java │ │ ├── IIValueTask.java │ │ └── IFactFactory.java │ │ ├── util │ │ ├── Func.java │ │ └── VersionInfo.java │ │ ├── compiler │ │ └── lang │ │ │ └── rascalcore │ │ │ ├── compile │ │ │ └── Examples │ │ │ │ ├── JSONIOTst.rsc │ │ │ │ ├── ContentTst.rsc │ │ │ │ ├── FailMessageTst.rsc │ │ │ │ ├── IDEServicesTst.rsc │ │ │ │ ├── D.rsc │ │ │ │ ├── Tst.rpage │ │ │ │ └── ExceptionTst.rsc │ │ │ ├── CompilerPathConfig.rsc │ │ │ └── check │ │ │ └── tests │ │ │ └── download-test-jars.sh │ │ ├── shell │ │ ├── ShellRunner.java │ │ └── RascalPackage.java │ │ ├── types │ │ ├── IRascalTypeVisitor.java │ │ └── DefaultRascalTypeVisitor.java │ │ ├── uri │ │ ├── ILogicalSourceLocationResolver.java │ │ ├── resolvers.config │ │ ├── file │ │ │ ├── HomeURIResolver.java │ │ │ ├── TempURIResolver.java │ │ │ └── CWDURIResolver.java │ │ ├── remote │ │ │ └── HttpsURIResolver.java │ │ ├── BadURIException.java │ │ └── UnsupportedSchemeException.java │ │ ├── repl │ │ └── streams │ │ │ ├── NonClosingFilterWriter.java │ │ │ ├── ItalicErrorWriter.java │ │ │ └── RedErrorWriter.java │ │ ├── semantics │ │ └── dynamic │ │ │ └── Name.java │ │ ├── interpreter │ │ ├── result │ │ │ └── IRascalResult.java │ │ ├── utils │ │ │ └── IResourceLocationProvider.java │ │ ├── callbacks │ │ │ └── IConstructorDeclared.java │ │ ├── control_exceptions │ │ │ ├── MatchFailed.java │ │ │ ├── Filtered.java │ │ │ └── QuitException.java │ │ ├── env │ │ │ └── UnmodifiableModuleEnvironment.java │ │ ├── load │ │ │ └── IRascalSearchPathContributor.java │ │ ├── matching │ │ │ └── IVarPattern.java │ │ └── staticErrors │ │ │ ├── MissingReturn.java │ │ │ ├── RedeclaredField.java │ │ │ ├── MissingModifier.java │ │ │ ├── UnguardedInsert.java │ │ │ ├── UnguardedReturn.java │ │ │ ├── UnsupportedPattern.java │ │ │ ├── RedeclaredType.java │ │ │ ├── NonAbstractJavaFunction.java │ │ │ ├── PartiallyLabeledFields.java │ │ │ ├── MissingTag.java │ │ │ ├── NoKeywordParameters.java │ │ │ ├── IllegalQualifiedDeclaration.java │ │ │ ├── NonVoidTypeRequired.java │ │ │ └── NotEnumerable.java │ │ ├── ast │ │ └── IVisitable.java │ │ ├── test │ │ └── infrastructure │ │ │ ├── RascalJUnitTestPrefix.java │ │ │ ├── RecursiveTest.java │ │ │ ├── RecursiveJavaOnlyTest.java │ │ │ └── RecursiveRascalParallelTest.java │ │ ├── debug │ │ ├── IDebugHandler.java │ │ ├── IRascalSuspendTrigger.java │ │ ├── IRascalEventListener.java │ │ └── IRascalEventTrigger.java │ │ ├── parser │ │ ├── gtd │ │ │ └── result │ │ │ │ └── action │ │ │ │ └── VoidEnvironment.java │ │ └── Parser.java │ │ └── exceptions │ │ └── JavaMethodLink.java └── io │ └── usethesource │ └── vallang │ └── type │ └── types.config ├── META-INF └── RASCAL.MF ├── .codecov.yml ├── .git-blame-ignore-revs ├── .gitignore ├── .settings └── org.eclipse.core.resources.prefs ├── .github └── ISSUE_TEMPLATE │ └── feature_request.md └── FUNDING /.gitattributes: -------------------------------------------------------------------------------- 1 | *.dot diff=-astextplain 2 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | /.github/ @DavyLandman 2 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Fibonacci/fib.trm: -------------------------------------------------------------------------------- 1 | fib(10) -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/fac2-10.trm: -------------------------------------------------------------------------------- 1 | fac2(10) -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/fac2-5.trm: -------------------------------------------------------------------------------- 1 | fac2(5) -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/fac2-8.trm: -------------------------------------------------------------------------------- 1 | fac2(8) -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/fac2-9.trm: -------------------------------------------------------------------------------- 1 | fac2(9) -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/fac1-5.trm: -------------------------------------------------------------------------------- 1 | fac1(s(s(s(s(s(z)))))) -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/parent/test/1.0/test-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/fac1-6.trm: -------------------------------------------------------------------------------- 1 | fac1(s(s(s(s(s(s(z))))))) -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/fac1-7.trm: -------------------------------------------------------------------------------- 1 | fac1(s(s(s(s(s(s(s(z)))))))) -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1a/1.0/level1a-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1a/2.0/level1a-2.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1b/1.0/level1b-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1b/2.0/level1b-2.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1c/1.0/level1c-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1c/2.0/level1c-2.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level2/1.0/level2-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level2/1.5/level2-1.5.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level2/2.0/level2-2.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level3/1.0/level3-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level3/2.0/level3-2.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level4/1.0/level4-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level4/2.0/level4-2.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/trans/level1/1.0/level1-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/trans/level2/1.0/level2-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/trans/level3/1.0/level3-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/fac1-8.trm: -------------------------------------------------------------------------------- 1 | fac1(s(s(s(s(s(s(s(s(z))))))))) -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level2/1.0/level2-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level3/1.0/level3-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level3/2.0/level3-2.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level1a/1.0/level1a-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level1b/1.0/level1b-1.0.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/syntax/.gitattributes: -------------------------------------------------------------------------------- 1 | RascalParser.java merge=ours 2 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/fac1-10.trm: -------------------------------------------------------------------------------- 1 | fac1(s(s(s(s(s(s(s(s(s(s(z))))))))))) 2 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tutor/lang/rascal/tutor/examples/Test/Libraries/Boolean/Boolean.remote: -------------------------------------------------------------------------------- 1 | |std:///Boolean.rsc| -------------------------------------------------------------------------------- /src/org/rascalmpl/tutor/lang/rascal/tutor/examples/Test/Libraries/Libraries.md: -------------------------------------------------------------------------------- 1 | ## Synopsis 2 | Library functions 3 | -------------------------------------------------------------------------------- /src/io/usethesource/vallang/type/types.config: -------------------------------------------------------------------------------- 1 | org.rascalmpl.types.NonTerminalType$Reifier 2 | org.rascalmpl.types.ReifiedType$Reifier 3 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends4/A.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends4::A 2 | 3 | private int glob = 42; 4 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Reverse/Reverse: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usethesource/rascal/HEAD/test/org/rascalmpl/benchmark/Reverse/Reverse -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Fibonacci/Fibonacci2.asf: -------------------------------------------------------------------------------- 1 | equations 2 | 3 | [1] fib(0) = 0 4 | [2] fib(1) = 1 5 | [3] fib(N) = fib(N - 1) + fib(N - 2) -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/M7.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::M7 2 | 3 | public data TYPE = natural() | string(); 4 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/BenchmarkResults.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usethesource/rascal/HEAD/test/org/rascalmpl/benchmark/BenchmarkResults.xls -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/Factorial: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usethesource/rascal/HEAD/test/org/rascalmpl/benchmark/Factorial/Factorial -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Fibonacci/Fibonacci: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usethesource/rascal/HEAD/test/org/rascalmpl/benchmark/Fibonacci/Fibonacci -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/csv/examples/ex1b.csv: -------------------------------------------------------------------------------- 1 | 1;Eagles;Hotel California;1977 2 | 3;Boudewijn de Groot;Avond;1997 3 | 2;Queen;Bohemian rhapsody;1975 4 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/bugs/InfiniteLoopInput.txt: -------------------------------------------------------------------------------- 1 | module M 2 | alias G = rel[loc, set[E 3 | data P = t() | f(); 4 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extend_function1/M1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extend_function1::M1 2 | 3 | default int f(int n) = n; 4 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends3/A.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends3::A 2 | 3 | layout L1 = " "+ !>> " "; 4 | syntax A = "a"; 5 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/analysis/clustering/TODO.txt: -------------------------------------------------------------------------------- 1 | Here we want different clustering algorithms that work on rel[&T from, &T to] and rel[from &T,&U edge,&T to] -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends3/B.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends3::B 2 | 3 | extend lang::rascal::tests::extends3::A; 4 | syntax B = A+; -------------------------------------------------------------------------------- /src/org/rascalmpl/tasks/IExpirationListener.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.tasks; 2 | 3 | public interface IExpirationListener { 4 | void expire(Object key); 5 | } 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/util/Func.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.util; 2 | 3 | public interface Func { 4 | R apply(T param) throws E; 5 | } 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends3/C.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends3::C 2 | 3 | import lang::rascal::tests::extends3::A; 4 | syntax C = "{" A "}"; -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends3/D.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends3::D 2 | 3 | extend lang::rascal::tests::extends3::B; 4 | syntax D = "[" A "]"; -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends3/E.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends3::E 2 | 3 | import lang::rascal::tests::extends3::B; 4 | syntax E = "\<" A "\>"; -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends4/B.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends4::B 2 | 3 | extend lang::rascal::tests::extends4::A; 4 | 5 | data X = glob(); 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/JSONIOTst.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascalcore::compile::Examples::JSONIOTst 2 | 3 | data RuntimeException(str cause=""); 4 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/csv/examples/ex1.csv: -------------------------------------------------------------------------------- 1 | position;artist;title;year 2 | 1;Eagles;Hotel California;1977 3 | 2;Queen;Bohemian rhapsody;1975 4 | 3;Boudewijn de Groot;Avond;1997 -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/M9.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::M9 2 | 3 | int f(1) = 1; 4 | int f(2) = 2; 5 | 6 | default int f(int n) = 10 * n; 7 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/Mbase.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::Mbase 2 | 3 | public int f(int n) { return 2 * n; } 4 | 5 | public int n = 2; 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tutor/lang/rascal/tutor/examples/Test/t1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usethesource/rascal/HEAD/src/org/rascalmpl/tutor/lang/rascal/tutor/examples/Test/t1.png -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends3/F.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends3::F 2 | 3 | import lang::rascal::tests::extends3::B; 4 | test bool match((B)`a a`) = true; -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/std/tests/Comment.rsc: -------------------------------------------------------------------------------- 1 | module lang::std::tests::Comment 2 | 3 | import lang::std::Comment; 4 | 5 | value comment1() = Comment _ := [Comment] "//xxxx"; 6 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/poms/local-reference/lorem-ipsum.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usethesource/rascal/HEAD/test/org/rascalmpl/util/maven/poms/local-reference/lorem-ipsum.jar -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/csv/examples/ex1a.csv: -------------------------------------------------------------------------------- 1 | position,artist,title,year 2 | 1,Eagles,Hotel California,1977 3 | 3,Boudewijn de Groot,Avond,1997 4 | 2,Queen,Bohemian rhapsody,1975 5 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/stats/attach-remote.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Attach to a remote screen 3 | host=$1 4 | id=$2 5 | ssh -t root@$host screen -x $id 6 | 7 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends2/COLLECTOR.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends2::COLLECTOR 2 | 3 | default str collect(value _){ 4 | return "COLLECTOR"; 5 | } 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/ContentTst.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascalcore::compile::Examples::ContentTst 2 | 3 | import lang::rascalcore::compile::Examples::JSONIOTst; -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/KeywordParameterImport1/DiamondTop.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::KeywordParameterImport1::DiamondTop 2 | 3 | data X; 4 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/M1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::M1 2 | 3 | public int f(int n) {return 2 * n;} 4 | 5 | private int g(int n) { return 2 * n;} 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extend_function1/M2.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extend_function1::M2 2 | 3 | import lang::rascal::tests::extend_function1::M1; 4 | 5 | int f(2) = 20; 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameter4/C.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameter4::C 2 | 3 | data D = d1(int n) | d2(str s); 4 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/std/tests/Whitespace.rsc: -------------------------------------------------------------------------------- 1 | module lang::std::tests::Whitespace 2 | 3 | import lang::std::Whitespace; 4 | 5 | test bool whitespace1() = Whitespace _ := [Whitespace] " "; 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/library/util/UUIDTests.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::library::util::UUIDTests 2 | 3 | import util::UUID; 4 | 5 | test bool uniqueness() = uuid() != uuid(); 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/shell/ShellRunner.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.shell; 2 | 3 | import java.io.IOException; 4 | 5 | public interface ShellRunner { 6 | void run(String[] args) throws IOException; 7 | } 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/OtherSyntax.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::OtherSyntax 2 | 3 | syntax Remote = "remote"; 4 | 5 | type[Remote] getRemoteGrammar() = #Remote; 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tutor/lang/rascal/tutor/examples/Test/CallAnalysis/calls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usethesource/rascal/HEAD/src/org/rascalmpl/tutor/lang/rascal/tutor/examples/Test/CallAnalysis/calls.png -------------------------------------------------------------------------------- /META-INF/RASCAL.MF: -------------------------------------------------------------------------------- 1 | Project-Name: rascal 2 | Source: src/org/rascalmpl/library,src/org/rascalmpl/compiler,src/org/rascalmpl/library,src/org/rascalmpl/tutor,test/org/rascalmpl/benchmark,test/org/rascalmpl/test/data 3 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameterImport1/DiamondTop.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameterImport1::DiamondTop 2 | 3 | data X = x(); 4 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/M2.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::M2 2 | 3 | public int n = 3; 4 | 5 | /* unused on purpose; to test visibility constraints */ 6 | private int m = 3; 7 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/ModuleInitRange.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::ModuleInitRange 2 | 3 | list[int] ints = [0 .. 10]; 4 | 5 | test bool rangeInit() = ints == [0 .. 10]; 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/IMP1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::IMP1 2 | 3 | 4 | public str dup_imp1(str s) = s + s + "_imp1"; 5 | 6 | value main_imp1(list[value] _) = dup_imp1("IMP1;"); 7 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/library/analysis/formalconcepts/FCxt1.fca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usethesource/rascal/HEAD/src/org/rascalmpl/library/lang/rascal/tests/library/analysis/formalconcepts/FCxt1.fca -------------------------------------------------------------------------------- /src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/FailMessageTst.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascalcore::compile::Examples::FailMessageTst 2 | 3 | import lang::rascalcore::compile::Examples::IDEServicesTst; 4 | 5 | data FailMessage; -------------------------------------------------------------------------------- /src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/IDEServicesTst.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascalcore::compile::Examples::IDEServicesTst 2 | 3 | extend lang::rascalcore::compile::Examples::ContentTst; 4 | //extend Message; -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends2/CHECKER.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends2::CHECKER 2 | 3 | extend lang::rascal::tests::extends2::TYPEPAL; 4 | 5 | str collect(int _){ 6 | return "CHECKER"; 7 | } 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/csv/syntax/Parse.rsc: -------------------------------------------------------------------------------- 1 | module lang::csv::\syntax::Parse 2 | 3 | import lang::csv::\syntax::CSV; 4 | import ParseTree; 5 | 6 | public lang::csv::\syntax::CSV::Table parseCSV(loc l) = parse(#Table, l); 7 | -------------------------------------------------------------------------------- /src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/D.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascalcore::compile::Examples::D 2 | 3 | import lang::rascalcore::compile::Examples::A; 4 | import lang::rascalcore::compile::Examples::B; 5 | // Foooooooooooooo -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/Imports6.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::Imports6 2 | 3 | import lang::rascal::tests::imports::M6; 4 | 5 | test bool Test61() = f() == 3; 6 | 7 | test bool Test62() = g() == 3; 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Tst.rpage: -------------------------------------------------------------------------------- 1 | 1 + 2; ⇨ int: 3 2 | 3 | // xxxx 4 | 5 | x + 2; 6 | ⚠ Undeclared variable: x 7 | ⚠ Advice: |http://tutor.rascal-mpl.org/Errors/Static/UndeclaredVariable/UndeclaredVariable.html| 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameterImport3/B.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameterImport3::B 2 | 3 | data X = x2(); 4 | 5 | test bool B_x2_y1() = !(x2() has y || x2() has z); 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/xml/examples/note.xml: -------------------------------------------------------------------------------- 1 | 2 | Jurgen 3 | Tijs 4 | Paul 5 | 2012-04-01 6 | Reminder 7 | Don't forget to run the Rascal tests! 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/TestsForTests.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::TestsForTests 2 | 3 | import Exception; 4 | 5 | @expected{IO} 6 | test bool testExpected() { 7 | throw IO("this should be expected"); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/Field.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::Field 2 | 3 | syntax C = "{" !<< B* bs; 4 | syntax B = "b"; 5 | 6 | test bool stripLabels() { 7 | C ex2 = [C] "bbb"; 8 | return B _ <- ex2.bs; 9 | } 10 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/M4.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::M4 2 | 3 | import lang::rascal::tests::imports::Mbase; 4 | 5 | public int m = n; 6 | 7 | public int f() { return n; } 8 | 9 | public int g() { return m; } 10 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Reverse/Reverse2.asf: -------------------------------------------------------------------------------- 1 | equations 2 | 3 | [r10] rev1() = 4 | [r11] rev1(X, L) = rev1(L), X 5 | 6 | [r20] rev2() = 7 | [r21] rev2(L, X) = X, rev2(L) 8 | 9 | [r30] rev3() = 10 | [r31] rev3(X, L, Y) = Y, rev3(L), Y -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/M5.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::M5 2 | 3 | import lang::rascal::tests::imports::Mbase; 4 | 5 | public int g(int n) {return 3 * n;} 6 | 7 | public int h(int n) {return f(n);} 8 | 9 | public int m = 3; 10 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 0 3 | status: 4 | project: 5 | default: 6 | # basic 7 | target: auto 8 | threshold: 1% # we accept a bit fluctuation, as we run random tests 9 | base: auto 10 | paths: 11 | - "src" 12 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tutor/lang/rascal/tutor/examples/Test/Test.quest: -------------------------------------------------------------------------------- 1 | [tvQuestion("Test","1",valueOfExpr(),details(" Fill in the missing function name!\n",["import List;"],"","","","(\) == \",false,true,[<"L",list(arb(0,[int(-20,20),str()]),0,5)>],[<"H","reverse(\) ">],void(),"reverse"))] -------------------------------------------------------------------------------- /src/org/rascalmpl/util/VersionInfo.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.util; 2 | 3 | public class VersionInfo { 4 | public static final String RASCAL_VERSION = "0.0.0"; 5 | public static final String RASCAL_RUNTIME_VERSION = "0.0.0"; 6 | public static final String RASCAL_COMPILER_VERSION = "0.0.0"; 7 | } 8 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Fibonacci/Fibonacci2.sdf: -------------------------------------------------------------------------------- 1 | module Fibonacci2 2 | 3 | imports basic/Whitespace basic/Integers 4 | 5 | exports 6 | context-free start-symbols Integer 7 | context-free syntax 8 | fib(Integer) -> Integer 9 | 10 | variables 11 | "N" -> Integer 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/data/fca/legacy.cxt: -------------------------------------------------------------------------------- 1 | B 2 | 3 | 9 4 | 4 5 | 6 | Name 7 | Title 8 | Initial 9 | Prefix 10 | City 11 | Street 12 | Number 13 | Number-Ext 14 | Zipcd 15 | P1 16 | P2 17 | P3 18 | P4 19 | X... 20 | X... 21 | X... 22 | X... 23 | .X.X 24 | ..XX 25 | ...X 26 | ...X 27 | ...X 28 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/IMP2.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::IMP2 2 | 3 | import lang::rascal::tests::imports::IMP1; 4 | 5 | public str dup_imp2(str s) = s + s + "_imp2"; 6 | 7 | value main_imp2(list[value] _) = [ main_imp1([]), dup_imp1("IMP2"), dup_imp2("IMP2;") ]; 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/M6.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::M6 2 | 3 | import Set; 4 | 5 | public set[int] Procs = {1, 2, 3}; 6 | 7 | public int f() {int nProcs = Set::size(Procs); return nProcs;} 8 | 9 | public int g() {int nProcs = size(Procs); return nProcs;} 10 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/std/tests/Layout.rsc: -------------------------------------------------------------------------------- 1 | module lang::std::tests::Layout 2 | 3 | import lang::std::Layout; 4 | 5 | test bool whitespaceOrComment1() = WhitespaceOrComment _ := [WhitespaceOrComment] " "; 6 | 7 | test bool whitespaceOrComment2() = WhitespaceOrComment _ := [WhitespaceOrComment] "//xxx"; 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/csv/ast/Implode.rsc: -------------------------------------------------------------------------------- 1 | module lang::csv::ast::Implode 2 | 3 | import lang::csv::\syntax::CSV; 4 | import lang::csv::ast::CSV; 5 | import ParseTree; 6 | 7 | public lang::csv::ast::CSV::Table implodeCSV(lang::csv::\syntax::CSV::Table tbl) 8 | = implode(#lang::csv::ast::CSV::Table, tbl); 9 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameterImport1/DiamondLeft.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameterImport1::DiamondLeft 2 | 3 | import lang::rascal::tests::functionality::CommonKeywordParameterImport1::DiamondTop; 4 | 5 | data X(int left = 0); 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/KeywordParameterExtend1/Extended.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::KeywordParameterExtend1::Extended 2 | 3 | private int xGlobal = 42; 4 | 5 | data DefInfo(int x = xGlobal); 6 | 7 | data DefInfo 8 | = noDefInfo() 9 | ; 10 | 11 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/KeywordParameterImport2/Import1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::KeywordParameterImport2::Import1 2 | 3 | data L(int a = 1, int b = 2 * a) = l(int c = 2 * b); 4 | 5 | data L(int d = -1) = m(); 6 | 7 | L createL1() = l(); 8 | L createM1() = l(); 9 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameterImport1/DiamondRight.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameterImport1::DiamondRight 2 | 3 | import lang::rascal::tests::functionality::CommonKeywordParameterImport1::DiamondTop; 4 | 5 | data X(int right = 0); 6 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/KeywordParameterImport2/Import2.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::KeywordParameterImport2::Import2 2 | 3 | data L(str e = "e", str f = e + e) = n(str g = f + f); 4 | 5 | data L(str h = "") = p(); 6 | 7 | L createN2() = n(); 8 | L createP2() = p(); 9 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tutor/lang/rascal/tutor/examples/Test/Vis/Example.rsc: -------------------------------------------------------------------------------- 1 | @synopsis{Just a module} 2 | module Vis::Example 3 | 4 | syntax VIS = "vis"; 5 | 6 | @synopsis{main is marvelous} 7 | @description{ 8 | ```rascal-shell 9 | import IO; 10 | println("hai") 11 | ``` 12 | } 13 | int main() { 14 | return 0; 15 | } -------------------------------------------------------------------------------- /test/org/rascalmpl/test/data/fca/digits.cxt: -------------------------------------------------------------------------------- 1 | B 2 | 3 | 10 4 | 7 5 | 6 | 0 7 | 1 8 | 2 9 | 3 10 | 4 11 | 5 12 | 6 13 | 7 14 | 8 15 | 9 16 | a 17 | b 18 | c 19 | d 20 | e 21 | f 22 | g 23 | X.XXXXX 24 | .....XX 25 | XXX.XX. 26 | XXX..XX 27 | .X.X.XX 28 | XXXX..X 29 | .XXXX.X 30 | X....XX 31 | XXXXXXX 32 | XX.X.XX 33 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/Base.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::Base 2 | 3 | syntax S = "a"; 4 | 5 | syntax Sstar = S*; 6 | 7 | alias INTEGER = int; 8 | 9 | data D = d1(); 10 | 11 | int ident(int n) = n; 12 | 13 | str f(0) = "zero"; 14 | 15 | default str f(value v) = "value"; 16 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends4/C.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends4::C 2 | 3 | import lang::rascal::tests::extends4::B; 4 | import IO; 5 | 6 | // issue 2513 7 | test bool privateExtendedGlobalShouldNotHidePublicConstructor() { 8 | println(glob); 9 | return X _ := glob(); 10 | } 11 | -------------------------------------------------------------------------------- /src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/ExceptionTst.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascalcore::compile::Examples::ExceptionTst 2 | 3 | extend lang::rascalcore::compile::Examples::FailMessageTst; 4 | 5 | data RuntimeException 6 | = TypePalUsage(str reason) // TypePal used incorrectly 7 | ; -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/ParseTreeEquality.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::ParseTreeEquality 2 | 3 | import ParseTree; 4 | 5 | bool testCycleEquality() { 6 | Tree cycle1 = cycle(sort("X"), 3); 7 | Tree cycle2 = cycle(sort("X"), 3); 8 | 9 | return cycle1 == cycle2; 10 | } 11 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/Imports7.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::Imports7 2 | 3 | import lang::rascal::tests::imports::M7; 4 | 5 | test bool Test71() = natural() == natural(); 6 | 7 | test bool Test72() = string() == string(); 8 | 9 | test bool Test73() = natural() != string(); 10 | 11 | -------------------------------------------------------------------------------- /src/org/rascalmpl/types/IRascalTypeVisitor.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.types; 2 | 3 | import io.usethesource.vallang.type.ITypeVisitor; 4 | 5 | public interface IRascalTypeVisitor extends ITypeVisitor { 6 | T visitReified(RascalType type) throws E; 7 | T visitNonTerminal(RascalType type) throws E; 8 | } 9 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends2/TYPEPAL.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends2::TYPEPAL 2 | 3 | extend lang::rascal::tests::extends2::COLLECTOR; 4 | 5 | str doCollect(int x){ 6 | return collect(x); 7 | } 8 | 9 | str indirectDoCollect(int x , str(int) my_collect){ 10 | return my_collect(x); 11 | } 12 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameter4/B.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameter4::B 2 | 3 | extend lang::rascal::tests::functionality::CommonKeywordParameter4::C; 4 | 5 | data D(int nn = -3, D m = d1(nn)); 6 | 7 | data D(int mm = -4, D p = d2("b",nn=mm).m); 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/std/tests/Id.rsc: -------------------------------------------------------------------------------- 1 | module lang::std::tests::Id 2 | 3 | import lang::std::Id; 4 | import Exception; 5 | 6 | test bool id1() = Id _ := [Id] "a"; 7 | test bool id2() = Id _ := [Id] "A"; 8 | test bool id3() = Id _ := [Id] "aA1"; 9 | 10 | @expected{ParseError} 11 | test bool id4() = Id _ := [Id] "1aA"; 12 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/data/fca/gewaesser.cxt: -------------------------------------------------------------------------------- 1 | B 2 | 3 | 8 4 | 6 5 | 6 | Fluss 7 | Bach 8 | Kanal 9 | Graben 10 | See 11 | Tuempel 12 | Teich 13 | Becken 14 | fliessend 15 | stehend 16 | natuerlich 17 | kuenstlich 18 | gross 19 | klein 20 | X.X.X. 21 | X.X..X 22 | X..XX. 23 | X..X.X 24 | .XX.X. 25 | .XX..X 26 | .X.XX. 27 | .X.X.X 28 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/FirstAmbiguity.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::FirstAmbiguity 2 | 3 | syntax P = E; 4 | syntax E = "e" | E "+" E; 5 | 6 | import ParseTree; 7 | 8 | @issue{1868} 9 | test bool firstAmbDoesNotThrowStaticErrors() { 10 | return amb({E _,E _}) := firstAmbiguity(#P, "e+e+e"); 11 | } -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/Imports2.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::Imports2 2 | 3 | import lang::rascal::tests::imports::M2; 4 | 5 | test bool Test21() = lang::rascal::tests::imports::M2::n == 3; 6 | 7 | test bool Test22() = n == 3; 8 | 9 | test bool Test23() { 10 | int n = 4; 11 | return n == 4; 12 | } 13 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/sdf2/filters/DetectCycles.rsc: -------------------------------------------------------------------------------- 1 | module lang::sdf2::filters::DetectCycles 2 | 3 | import ParseTree; 4 | 5 | &T<:Tree cycleDetectionFilter(amb(set[&T<:Tree] alts)) { 6 | if (/t:cycle(_,_) <- alts) { 7 | throw "Cycle detected at "; 8 | } 9 | else { 10 | fail cycleDetectionFilter; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/sdf2/filters/FilterCycles.rsc: -------------------------------------------------------------------------------- 1 | module lang::sdf2::filters::FilterCycles 2 | 3 | import ParseTree; 4 | 5 | &T<:Tree cycleFilter(amb(set[&T<:Tree] alts)) { 6 | new = { a | a <- alts, /cycle(_,_) !:= a}; 7 | 8 | if (new == alts) { 9 | fail cycleFilter; 10 | } 11 | else { 12 | return amb(new); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/testhomedir/.m2/settings.xml: -------------------------------------------------------------------------------- 1 | 4 | ${TEST_SYSTEM_PROP} 5 | -------------------------------------------------------------------------------- /src/org/rascalmpl/uri/ILogicalSourceLocationResolver.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.uri; 2 | 3 | import java.io.IOException; 4 | 5 | import io.usethesource.vallang.ISourceLocation; 6 | 7 | public interface ILogicalSourceLocationResolver { 8 | ISourceLocation resolve(ISourceLocation input) throws IOException; 9 | String scheme(); 10 | String authority(); 11 | } 12 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/DynamicDispatch.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::DynamicDispatch 2 | 3 | data D = d(); 4 | 5 | bool foo(d()) { 6 | return true;; 7 | } 8 | 9 | default bool foo(value n) { 10 | return false; 11 | } 12 | 13 | test bool dispatchOnRuntimeType() { 14 | value x = d(); 15 | return foo(x) == true; 16 | } 17 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/SimpleVisit.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::SimpleVisit 2 | 3 | data B = and(B lhs, B rhs) | t(); 4 | 5 | test bool visitTest() { 6 | visit(and(t(),t())) { 7 | case t(): return true; 8 | }; 9 | 10 | return false; 11 | } 12 | 13 | test bool matchTest() = /t() := and(t(),t()); 14 | -------------------------------------------------------------------------------- /src/org/rascalmpl/compiler/lang/rascalcore/CompilerPathConfig.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascalcore::CompilerPathConfig 2 | 3 | extend util::PathConfig; 4 | 5 | data PathConfig( 6 | loc generatedSources = |unknown:///|, 7 | loc generatedTestSources = |unknown:///|, 8 | loc generatedResources = |unknown:///|, 9 | loc generatedTestResources = |unknown:///| 10 | ); -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/Intermix.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::Intermix 2 | 3 | test bool simpler() { 4 | l = [1,1,1]; 5 | while ([*pre,a,b,*pst] := l, !(a == 0 || b == 0)) { 6 | l = [*pre,a,0,b,*pst]; 7 | } 8 | return l == [1,0,1,0,1]; 9 | } 10 | 11 | test bool iterOnly() = [ a,0 | [*_,a,_,*_] := [1,2,3]] == [1,0,2,0]; 12 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/stats/monitor-benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Attach to a remote screen 3 | set -e 4 | if [ "$#" -lt 1 ]; then 5 | echo "This script shows remote benchmark logs" 6 | echo "Usage: $0 " 7 | exit 1 8 | fi 9 | 10 | host=$1 11 | shift 12 | 13 | ssh -t root@$host /tmp/benchmark.sh -L $@ 14 | 15 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameterImport3/Tests.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameterImport3::Tests 2 | 3 | import lang::rascal::tests::functionality::CommonKeywordParameterImport3::D; 4 | 5 | // https://github.com/cwi-swat/rascal/issues/933 6 | test bool keywordParametersLost933() = normal() && extended(); 7 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/Imports1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::Imports1 2 | 3 | import lang::rascal::tests::imports::M1; 4 | 5 | test bool Test11() = lang::rascal::tests::imports::M1::f(3) == 6; 6 | 7 | test bool Test12() = f(3) == 6; 8 | 9 | 10 | test bool Test13() { 11 | int f(int n) {return 3 * n;} 12 | return f(3) == 9; 13 | } 14 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/Imports4.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::Imports4 2 | 3 | import lang::rascal::tests::imports::M4; 4 | 5 | test bool Test41() = lang::rascal::tests::imports::M4::m == 2; 6 | 7 | test bool Test42() = lang::rascal::tests::imports::M4::f() == 2; 8 | 9 | test bool Test43() = lang::rascal::tests::imports::M4::g() == 2; 10 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/B3.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::B3 2 | 3 | import lang::rascal::tests::extends1::B1; 4 | import lang::rascal::tests::extends1::B2; 5 | 6 | int add3(int n) = n + 3; 7 | 8 | // Defined in B[1-3] 9 | 10 | test bool b3tadd1() = add1(5) == 6; 11 | test bool b3tadd2() = add2(5) == 7; 12 | test bool b3tadd3() = add3(5) == 8; 13 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/Base1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::Base1 2 | 3 | data A = a() | b(); 4 | 5 | str default_message = "default use"; 6 | 7 | default str EXTENDED_FUNCTION(value _) = default_message; 8 | 9 | str apply_EXTENDED_FUNCTION_a() = EXTENDED_FUNCTION(a()); 10 | 11 | str apply_EXTENDED_FUNCTION_b() = EXTENDED_FUNCTION(b()); 12 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/BaseExtended.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::BaseExtended 2 | 3 | extend lang::rascal::tests::extends1::Base; 4 | 5 | syntax S = "z"; 6 | 7 | alias STRING = str; 8 | 9 | alias LIST_INTEGER = list[INTEGER]; 10 | 11 | data D = d2(); 12 | 13 | data E = e(); 14 | 15 | str ident(str s) = s; 16 | 17 | str f(1) = "one"; 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/c90/examples/hello-world.c: -------------------------------------------------------------------------------- 1 | 2 | int print(const char *text); 3 | 4 | void printHello(char *name) { 5 | print("Hello "); 6 | print(name); 7 | print("!"); 8 | } 9 | 10 | int main(int argc, char *argv[]) { 11 | char *name; 12 | if (argc > 1) { 13 | name = argv[1]; 14 | } else { 15 | name = "World"; 16 | } 17 | 18 | printHello(name); 19 | } 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/CompilerIssues/TemplateInConditional.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::CompilerIssues::TemplateInConditional 2 | 3 | data D = d1(int nfield) | d2(str sfield); 4 | 5 | @ignoreCompiler{x.nfield if moved before loop when x may not satisfy x is d1} 6 | test bool templateInConditional() 7 | = {x is d1 ? "" : "x" | x <- [d2("abc")]} == {"x"}; -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/Factorial2.asf: -------------------------------------------------------------------------------- 1 | equations 2 | 3 | [a0] add(N, z) = N 4 | [a1] add(z, N) = N 5 | [a2] add(s(N), M) = s(add(N, M)) 6 | 7 | [m0] mul(N, z) = z 8 | [m1] mul(z, N) = z 9 | [m2] mul(s(N), M) = add(M, mul(N, M)) 10 | 11 | [f10] fac1(s(z)) = s(z) 12 | [f11] fac1(s(N)) = mul(s(N), fac1(N)) 13 | 14 | [f20] fac2(0) = 1 15 | [default-f21] fac2(I) = I * fac2(I - 1) -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameterImport3/A.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameterImport3::A 2 | 3 | data X(int y = 0) = x1(); 4 | 5 | test bool Ax1_y1() = x1() has y; 6 | test bool Ax1_y2() = !x1().y?; 7 | test bool Ax1_y3() = x1().y == 0; 8 | test bool Ax1_y4() = x1(y=10).y?; 9 | test bool Ax1_y5() = x1(y=10).y == 10; 10 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/library/LibraryUtilRunner.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.library; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 5 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 6 | 7 | @RunWith(RascalJUnitTestRunner.class) 8 | @RascalJUnitTestPrefix("util") 9 | public class LibraryUtilRunner { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/util/LibraryUtilModules.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.util; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 5 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 6 | 7 | @RunWith(RascalJUnitTestRunner.class) 8 | @RascalJUnitTestPrefix("util") 9 | public class LibraryUtilModules { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/CompilerIssues/VariableInOr.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::CompilerIssues::VariableInOr 2 | 3 | data D = d1(int n) | label(D d); 4 | 5 | @ignoreCompiler{Generates erroneous Java code} 6 | int f(D d) = e.n 7 | when label(D e) := d || e := d; 8 | 9 | @ignoreCompiler{Generates erroneous Java code} 10 | test bool testF() = f(label(d1(10))) == 10; -------------------------------------------------------------------------------- /test/org/rascalmpl/test/library/LibraryLangPaths.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.library; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 5 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 6 | 7 | @RunWith(RascalJUnitTestRunner.class) 8 | @RascalJUnitTestPrefix("lang::paths") 9 | public class LibraryLangPaths { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/poms/rascal/generate-expected-path-list.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | CLASSFILE=`mktemp` 3 | mvn dependency:build-classpath -DincludeScope=compile -Dmdep.outputFile=$CLASSFILE 4 | REPO=`mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout` 5 | PREFIX=$((${#REPO} + 2)) 6 | tr ';' '\n' < $CLASSFILE | cut -c ${PREFIX}- | tr '\\' '/' | sort > expected-path-list.txt 7 | rm $CLASSFILE 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/pico/examples/flip.pico: -------------------------------------------------------------------------------- 1 | begin 2 | declare 3 | a : natural, 4 | b : natural; 5 | a := 0; 6 | b := 1; 7 | if a then 8 | % comment 1 % 9 | b := a; 10 | z := z 11 | else 12 | % comment 2 % 13 | a := b; 14 | if b then 15 | z := a 16 | else 17 | z := b 18 | fi; 19 | z := z 20 | fi 21 | end -------------------------------------------------------------------------------- /test/org/rascalmpl/test/basic/RunRascalTestModules.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.basic; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 5 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 6 | 7 | @RunWith(RascalJUnitTestRunner.class) 8 | @RascalJUnitTestPrefix("lang::rascal::tests::basic") 9 | public class RunRascalTestModules { } 10 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/types/RunRascalTestModules.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.types; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 5 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 6 | 7 | @RunWith(RascalJUnitTestRunner.class) 8 | @RascalJUnitTestPrefix("lang::rascal::tests::types") 9 | public class RunRascalTestModules { } 10 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1a/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | org.apache.maven.plugins 3 | maven-jar-plugin 4 | 5 | 2.0 6 | 2.0 7 | 8 | 1.0 9 | 2.0 10 | 11 | 20240701154439 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level3/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | org.apache.maven.plugins 3 | maven-jar-plugin 4 | 5 | 2.0 6 | 2.0 7 | 8 | 1.0 9 | 2.0 10 | 11 | 20240701154439 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level4/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | org.apache.maven.plugins 3 | maven-jar-plugin 4 | 5 | 2.0 6 | 2.0 7 | 8 | 1.0 9 | 2.0 10 | 11 | 20240701154439 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CallAux.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CallAux 2 | 3 | data C = c(int i); 4 | 5 | bool() x = bool() { return false; } ; 6 | 7 | public void changeX(bool() newX) { x = newX; } 8 | 9 | public bool getX() = x(); 10 | 11 | C c(int i) { 12 | if (i == 0 || i mod 5 != 0) 13 | fail c; 14 | else 15 | return c(i / 5); 16 | } 17 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/concrete/RunRascalTestModules.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.concrete; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 5 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 6 | 7 | @RunWith(RascalJUnitTestRunner.class) 8 | @RascalJUnitTestPrefix("lang::rascal::tests::concrete") 9 | public class RunRascalTestModules { } 10 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/json/examples/ex01.json: -------------------------------------------------------------------------------- 1 | { 2 | "Image": { 3 | "Width": 800, 4 | "Height": 600, 5 | "Title": "View from 15th Floor", 6 | "Thumbnail": { 7 | "Url": "http://www.example.com/image/481989943", 8 | "Height": 125, 9 | "Width": "100" 10 | }, 11 | "IDs": [116, 943, 234, 38793] 12 | } 13 | } -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/CompilerIssues/ListMatchInIfCondition.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::CompilerIssues::ListMatchInIfCondition 2 | 3 | int f(list[int] ds){ 4 | if([int xxx]:= ds, xxx > 0){ 5 | return 1; 6 | } else { 7 | return 2; 8 | } 9 | } 10 | 11 | test bool ListMatchInIfCondition1() = f([1]) == 1; 12 | 13 | test bool ListMatchInIfCondition2() = f([-1]) == 2; -------------------------------------------------------------------------------- /src/org/rascalmpl/tutor/lang/rascal/tutor/questions/ParseQuestions.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tutor::questions::ParseQuestions 2 | 3 | import lang::rascal::tutor::questions::Questions; 4 | import ParseTree; 5 | 6 | public Questions parse(str src, loc l) = parse(#start[Questions], src, l).top; 7 | public Questions parse(str src) = parse(#start[Questions], src).top; 8 | public Questions parse(loc l) = parse(#start[Questions], l).top; 9 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/library/LibraryJavaCompilerRunner.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.library; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 5 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 6 | 7 | @RunWith(RascalJUnitTestRunner.class) 8 | @RascalJUnitTestPrefix("lang::java") 9 | public class LibraryJavaCompilerRunner { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/library/RunRascalTestModules.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.library; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 5 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 6 | 7 | @RunWith(RascalJUnitTestRunner.class) 8 | @RascalJUnitTestPrefix("lang::rascal::tests::library") 9 | public class RunRascalTestModules { } 10 | 11 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extend_function1/M3.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extend_function1::M3 2 | 3 | import lang::rascal::tests::extend_function1::M2; 4 | 5 | import Exception; 6 | 7 | int f(3) = 30; 8 | 9 | test bool t1() { 10 | try { 11 | f(1); 12 | return false; 13 | } catch CallFailed(_): return true; 14 | } 15 | test bool t2() = f(2) == 20; 16 | test bool t3() = f(3) == 30; 17 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameter4/A.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameter4::A 2 | 3 | import lang::rascal::tests::functionality::CommonKeywordParameter4::B; 4 | 5 | test bool testA1() = d2("a").m == d1(-3); 6 | //test bool testA2() = d2("a", nn=4).m == d1(4); 7 | //test bool testA3() = d2("a").p == d1(-4); 8 | //test bool testA4() = d2("a",mm=5).p == d1(5); 9 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/Factorial.py: -------------------------------------------------------------------------------- 1 | # Program to find the factorial of a number 2 | 3 | 4 | from time import clock; 5 | 6 | def fact(n): 7 | if n == 0: 8 | return 1 9 | else: 10 | return n * fact(n-1) 11 | 12 | 13 | def measure(): 14 | start = clock(); 15 | for i in range(1,10000): 16 | fact(500); 17 | print "10000 x fac(500) used %f seconds\n" % (clock() - start) 18 | 19 | measure(); 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameterImport2/DiamondTop.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameterImport2::DiamondTop 2 | 3 | data X = x(); 4 | 5 | test bool Top_x_has_no_left() = !(x() has left); 6 | test bool Top_x_has_no_leftsq() = !(x() has leftsq); 7 | test bool Top_x_has_no_right() = !(x() has right); 8 | test bool Top_x_has_no_rightsq() = !(x() has rightsq); 9 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/C1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::C1 2 | 3 | import lang::rascal::tests::imports::C2; 4 | 5 | data D = d(int n); 6 | 7 | alias C1Alias = int; 8 | 9 | bool isDint(d(int _)) = true; 10 | default bool isDint(D _) = false; 11 | 12 | C1Alias C1func(C2Alias i) = i; 13 | 14 | public int C1function() { return 1; } 15 | 16 | int C1testFunction(int () f = C2function) = f(); 17 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/C2.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::C2 2 | 3 | import lang::rascal::tests::imports::C1; 4 | 5 | data D = d(str s); 6 | 7 | alias C2Alias = int; 8 | 9 | bool isDstr(d(str _)) = true; 10 | default bool isDstr(D _) = false; 11 | 12 | C2Alias C2func(C1Alias i) = i; 13 | 14 | public int C2function() { return 2; } 15 | 16 | int C2testFunction(int () f = C1function) = f(); 17 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/util/library/RunRascalTestModules.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.util.library; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 5 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 6 | 7 | @RunWith(RascalJUnitTestRunner.class) 8 | @RascalJUnitTestPrefix("lang::rascal::tests::library") 9 | public class RunRascalTestModules { } 10 | 11 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/CompilerIssues/QualifiedName.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::CompilerIssues::QualifiedName 2 | 3 | data G = g(int n) | g1(); 4 | 5 | @ignore{Defeats the compiler's strategy in lang::rascalcore::compile::Rascal2muRascal::RascalPattern for qualified name pattern} 6 | test bool nestedfunctionInTrueBranch(){ 7 | int f(int x) = 2 * x; 8 | return [ g(n) := g1() ? f(n) : -1 ] == [ -1 ]; 9 | } -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/FunctionAssignment.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::FunctionAssignment 2 | 3 | import String; 4 | 5 | public int i = 0; 6 | 7 | test bool triggerAssignmentBug() { 8 | str(str) stealTheFunction = toUpperCase; 9 | 10 | // by now the interpreter would fail with an exception: 11 | // Undeclared variable: toUpperCase 12 | return toUpperCase("abc") == "ABC"; 13 | } 14 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/Factorial.rb: -------------------------------------------------------------------------------- 1 | # Program to find the factorial of a number 2 | # Save this as fact.rb 3 | 4 | def fact(n) 5 | if n == 0 6 | 1 7 | else 8 | n * fact(n-1) 9 | end 10 | end 11 | 12 | 13 | def measure() 14 | start = Time.now.sec; 15 | for i in 1..10000 16 | fact(500); 17 | end 18 | puts "10000 x fac(500) used %f seconds " % (Time.now.sec - start); 19 | end 20 | 21 | measure(); 22 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level2/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | org.apache.maven.plugins 3 | maven-jar-plugin 4 | 5 | 2.0 6 | 2.0 7 | 8 | 1.0 9 | 1.5 10 | 2.0 11 | 12 | 20240701154439 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/trans/level3/1.0/level3-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | trans 7 | level3 8 | 1.0 9 | 10 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Reverse/Reverse2.sdf: -------------------------------------------------------------------------------- 1 | module Reverse2 2 | 3 | imports basic/Whitespace basic/Integers 4 | 5 | exports 6 | context-free syntax 7 | rev1( {Integer ","}* ) -> {Integer ","}* 8 | rev2( {Integer ","}* ) -> {Integer ","}* 9 | rev3( {Integer ","}* ) -> {Integer ","}* 10 | context-free start-symbols 11 | {Integer ","}* 12 | variables 13 | [XY] -> Integer 14 | [L] -> {Integer ","}* 15 | 16 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/data/fca/liveinwater.cxt: -------------------------------------------------------------------------------- 1 | B 2 | 3 | 8 4 | 9 5 | 6 | fish leech 7 | bream 8 | frog 9 | dog 10 | water weeds 11 | reed 12 | bean 13 | corn 14 | needs water to live 15 | lives in water 16 | lives on land 17 | needs chlorophyll 18 | dicotyledon 19 | monocotyledon 20 | can move 21 | has limbs 22 | breast feeds 23 | XX....X.. 24 | XX....XX. 25 | XXX...XX. 26 | X.X...XXX 27 | XX.X.X... 28 | XXXX.X... 29 | X.XXX.... 30 | X.XX.X... 31 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/poms/local-reference/pom-no-version.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.rascalmpl 7 | test-project 8 | 9 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/poms/local-reference/pom-no-groupid.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | test-project 7 | 0.1.0-SNAPSHOT 8 | 9 | -------------------------------------------------------------------------------- /src/org/rascalmpl/repl/streams/NonClosingFilterWriter.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.repl.streams; 2 | 3 | import java.io.FilterWriter; 4 | import java.io.IOException; 5 | import java.io.Writer; 6 | 7 | 8 | abstract class NonClosingFilterWriter extends FilterWriter { 9 | 10 | protected NonClosingFilterWriter(Writer out) { 11 | super(out); 12 | } 13 | 14 | @Override 15 | public void close() throws IOException { 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/Function.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::Function 2 | 3 | layout L = [\ ]*; 4 | syntax A = "a"; 5 | syntax As = {A ","}+; 6 | syntax G = "g" As; 7 | 8 | int useExtraFormalInConcreteListPattern(int n, (G) `g <{A ","}+ as>`){ 9 | int g() { x = as; return n; } 10 | return g(); 11 | } 12 | 13 | test bool useExtraFormalInConcreteListPattern1() = useExtraFormalInConcreteListPattern(42, [G] "g a,a,a") == 42; -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends2/RUNCHECKER.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends2::RUNCHECKER 2 | 3 | extend lang::rascal::tests::extends2::CHECKER; 4 | 5 | str main(){ 6 | return doCollect(1); 7 | } 8 | 9 | test bool collect1() 10 | = collect(1) == "CHECKER"; 11 | 12 | test bool doCollect1() 13 | = doCollect(1) == "CHECKER"; 14 | 15 | test bool indirectDoCollect1() 16 | = indirectDoCollect(1, collect) == "CHECKER"; 17 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/sdf2/filters/Reject.rsc: -------------------------------------------------------------------------------- 1 | module lang::sdf2::filters::Reject 2 | 3 | import ParseTree; 4 | 5 | @synopsis{Import his module if you want SDF2 style reject filtering enabled for your grammar. Use @reject to 6 | label one alternative and the whole non-terminal will be filtered if it matches.} 7 | &T <: Tree rejectFilter(amb(set[&T <: Tree] alts)) { 8 | if (appl(prod(_,_,{*_,\tag("reject"())}),_) <- alts) 9 | filter; 10 | fail; 11 | } 12 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/util/Memo.rsc: -------------------------------------------------------------------------------- 1 | module util::Memo 2 | 3 | data MemoExpireConfiguration 4 | = expireAfter( // expires entries when times has passed since last access 5 | // define only one of these limits 6 | int seconds = -1, 7 | int minutes = -1, 8 | int hours = -1 9 | ) 10 | | maximumSize(int entries) // expires entries when the cache get's fuller than a certain size 11 | ; 12 | 13 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/Imports3.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::Imports3 2 | 3 | import lang::rascal::tests::imports::Mbase; 4 | 5 | test bool Test31() = lang::rascal::tests::imports::Mbase::n == 2; 6 | 7 | test bool Test32() = n == 2; 8 | 9 | test bool Test33() = lang::rascal::tests::imports::Mbase::f(3) == 6; 10 | 11 | test bool Test34() = f(3) == 6; 12 | 13 | test bool Test35() { 14 | int n = 3; 15 | return n == 3; 16 | } 17 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/CaseInsensitiveMatching.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::CaseInsensitiveMatching 2 | 3 | lexical CI = 'if' 'fi'; 4 | 5 | test bool matchAnyway1() = (CI) `IFFI` := (CI) `iffi`; 6 | test bool matchAnyway2() = (CI) `IffI` := (CI) `iFFi`; 7 | test bool matchAnyway3() = (CI) `iffi` := (CI) `IFFI`; 8 | test bool matchAnyway4() = (CI) `IFFI` := (CI) `IFFI`; 9 | test bool matchAnyway5() = (CI) `iffi` := (CI) `iffi`; 10 | 11 | -------------------------------------------------------------------------------- /src/org/rascalmpl/repl/streams/ItalicErrorWriter.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.repl.streams; 2 | 3 | import java.io.Writer; 4 | 5 | import org.jline.jansi.Ansi; 6 | import org.jline.jansi.Ansi.Attribute; 7 | 8 | 9 | public class ItalicErrorWriter extends WrappedFilterWriter { 10 | public ItalicErrorWriter(Writer out) { 11 | super(out, Ansi.ansi().a(Attribute.ITALIC).toString().toCharArray(), Ansi.ansi().a(Attribute.ITALIC_OFF).toString().toCharArray()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/Imports8.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::Imports8 2 | 3 | import lang::rascal::tests::imports::IMP1; 4 | import lang::rascal::tests::imports::IMP2; 5 | 6 | test bool import1() = main_imp1([]) == "IMP1;IMP1;_imp1"; 7 | test bool import2() = main_imp2([]) == ["IMP1;IMP1;_imp1","IMP2IMP2_imp1","IMP2;IMP2;_imp2"]; 8 | test bool import3() = dup_imp1("IMP3") == "IMP3IMP3_imp1"; 9 | test bool import4() = dup_imp2("IMP3") == "IMP3IMP3_imp2"; 10 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level2/1.5/level2-1.5.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level2 8 | 1.5 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level3/1.0/level3-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level3 8 | 1.0 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level4/1.0/level4-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level3 8 | 1.0 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level4/2.0/level4-2.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level3 8 | 2.0 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/org/rascalmpl/repl/streams/RedErrorWriter.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.repl.streams; 2 | 3 | import java.io.Writer; 4 | 5 | import org.jline.jansi.Ansi; 6 | import org.jline.jansi.Ansi.Attribute; 7 | import org.jline.jansi.Ansi.Color; 8 | 9 | 10 | public class RedErrorWriter extends WrappedFilterWriter { 11 | public RedErrorWriter(Writer out) { 12 | super(out, Ansi.ansi().fg(Color.RED).toString().toCharArray(), Ansi.ansi().a(Attribute.RESET).toString().toCharArray()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level3/2.0/level3-2.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level3 8 | 2.0 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level3/1.0/level3-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | breadth-first 7 | level3 8 | 1.0 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameterImport1/DiamondBottom.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameterImport1::DiamondBottom 2 | 3 | import lang::rascal::tests::functionality::CommonKeywordParameterImport1::DiamondLeft; 4 | import lang::rascal::tests::functionality::CommonKeywordParameterImport1::DiamondRight; 5 | import lang::rascal::tests::functionality::CommonKeywordParameterImport1::DiamondTop; 6 | 7 | test bool diamondTest() = x().left == x().right; 8 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/std/Comment.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} 9 | module lang::std::Comment 10 | 11 | lexical Comment = @lineComment @category="comment" "//" ![\n]* $; 12 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level3/2.0/level3-2.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | breadth-first 7 | level3 8 | 2.0 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Reverse/Reverse.rb: -------------------------------------------------------------------------------- 1 | # Program to reverse alist 2 | 3 | def rev(lst) 4 | if lst.empty? 5 | [] 6 | else 7 | rev(lst[1..lst.length]).concat([lst.first]); 8 | end 9 | end 10 | 11 | def measure 12 | a = Array.new(1000); 13 | 14 | for i in 1..1000 15 | a[i] = i; 16 | end 17 | 18 | start = Time.now.sec; 19 | for i in 1..10000 20 | rev(a); 21 | end 22 | puts "10000 x rev list of 1000 elements used %f seconds " % (Time.now.sec - start); 23 | end 24 | 25 | measure(); -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/CompilerIssues/NoMatchInWhen.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::CompilerIssues::NoMatchInWhen 2 | 3 | data AType = aparameter(str name, AType bound) 4 | | a() 5 | ; 6 | bool asubtype(AType x, x) = true; 7 | 8 | bool asubtype(aparameter(str pname1, AType bound1), AType r) = 9 | true 10 | when aparameter(pname1,_) !:= r ; 11 | 12 | @ignoreCompiler{Control flow for !:= is not handled properly} 13 | test bool aparam1() = asubtype(aparameter("A", a()), a()); 14 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/std/Id.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} 9 | module lang::std::Id 10 | 11 | lexical Id = [a-z A-Z 0-9 _] !<< [a-z A-Z][a-z A-Z 0-9 _]* !>> [a-z A-Z 0-9 _] 12 | ; 13 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/AllSuiteParallel.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RecursiveJavaOnlyTest; 5 | import org.rascalmpl.test.infrastructure.RecursiveTest; 6 | import org.rascalmpl.test.infrastructure.RecursiveTestSuite; 7 | 8 | @RunWith(RecursiveTestSuite.class) 9 | @RecursiveTest({"parallel"}) 10 | @RecursiveJavaOnlyTest({"basic", "concrete", "functionality", "library", "parser", "recovery", "demo", "benchmark"}) 11 | public class AllSuiteParallel { 12 | } 13 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/library/Type.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::library::Type 2 | 3 | import Type; 4 | 5 | data D = a(bool b) | a(str s1, str s2) | a(int n, str color = "blue") | a(str s, int sz = 10); 6 | 7 | test bool tstMake1() = make(#D, "a", [true]) == a(true); 8 | 9 | test bool tstMake2() = make(#D, "a", ["x", "y"]) == a("x", "y"); 10 | 11 | test bool tstMake3() = make(#D, "a", [3], ("color" : "red")) == a(3, color="red"); 12 | 13 | test bool tstMake4() = make(#D, "a", ["x"], ("sz" : 20)) == a("x", sz = 20); 14 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # List of commits that shouldn't be included in `git blame`. 2 | # Github and other tools already support it if it's this exact filename 3 | # But you have to teach your own git about this by running this command (in this repo) 4 | # git config blame.ignoreRevsFile .git-blame-ignore-revs 5 | 6 | # indent fix for JSON 7 | 31b1031ade5d84f9c60e30d17da3b55e78d291fb 8 | 9 | # fixing tabs & spaces mixed 10 | 0d048e15683740b5c944be5333ec0680df825e47 11 | 23ec4b622bbe503ef013be5a458e45ae6fd89b97 12 | 200b0352084be9435c64aa60c550edd24a59131b 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # eclipse stuff 2 | .project 3 | .metadata 4 | .settings 5 | .classpath 6 | bin/** 7 | tmp/** 8 | tmp/**/* 9 | **/*.rvm 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .loadpath 16 | 17 | # maven stuff 18 | target/ 19 | bin/ 20 | bootstrap/ 21 | pom.xml.releaseBackup 22 | release.properties 23 | pom.xml.versionsBackup 24 | rascal-DEPENDENCIES.txt 25 | 26 | .DS_Store 27 | /.apt_generated/ 28 | 29 | dependency-reduced-pom.xml 30 | .ipynb_checkpoints 31 | __pycache__ 32 | .vscode/settings.json 33 | 34 | *.iml 35 | .idea/ 36 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/Extension1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::Extension1 2 | 3 | // Extension of a function str(value) with str(A) 4 | 5 | extend lang::rascal::tests::extends1::Base1; 6 | 7 | str non_default_message = "*** NON-default use ***"; 8 | 9 | str EXTENDED_FUNCTION(a()) = non_default_message; 10 | 11 | test bool apply1() = apply_EXTENDED_FUNCTION_a() == non_default_message; 12 | 13 | test bool apply2() = apply_EXTENDED_FUNCTION_b() == default_message; 14 | 15 | str main() = apply_EXTENDED_FUNCTION_a(); 16 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/analysis/m3/FlowGraph.rsc: -------------------------------------------------------------------------------- 1 | module analysis::m3::FlowGraph 2 | 3 | extend analysis::m3::Core; 4 | 5 | data M3( 6 | rel[loc decl, BasicBlocks blocks] basicBlocks = {}, 7 | rel[loc decl, FlowGraph graph] dataFlow = {}, 8 | rel[loc decl, FlowGraph graph] controlFlow = {} 9 | ); 10 | 11 | alias BasicBlocks = rel[loc whole, list[loc] parts]; 12 | alias FlowGraph = rel[loc from, set[EdgeProperty] properties, loc to]; 13 | 14 | 15 | data EdgeProperty 16 | = trueCondition() 17 | | falseCondition() 18 | ; 19 | 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/pico/examples/fac.pico: -------------------------------------------------------------------------------- 1 | begin declare input : natural, 2 | output : natural, 3 | repnr : natural, 4 | rep : natural, 5 | s1 : string, 6 | s2 : string; 7 | input := 14; 8 | output := 1; 9 | while input - 1 do 10 | rep := output; 11 | repnr := input; 12 | while repnr - 1 do 13 | output := output + rep; 14 | repnr := repnr - 1 15 | od; 16 | input := input - 1 17 | od 18 | end -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/KeywordParameterExtend1/Extending.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::KeywordParameterExtend1::Extending 2 | 3 | import lang::rascal::tests::functionality::KeywordParameterExtend1::Extended; 4 | 5 | data Vis = publicVis(); 6 | 7 | data DefInfo(Vis vis = publicVis()); 8 | 9 | // issue 2497 10 | test bool extendedCommonKeyParamNotOverwritten() 11 | = noDefInfo().x == 42; 12 | 13 | // issue 2497 14 | test bool extendingCommonKeyParamNotOverwritten() 15 | = noDefInfo().vis == publicVis(); 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Factorial/Factorial2.sdf: -------------------------------------------------------------------------------- 1 | module Factorial2 2 | 3 | imports basic/Whitespace basic/Integers 4 | 5 | exports 6 | sorts NUM 7 | 8 | context-free syntax 9 | "z" -> NUM 10 | s(NUM) -> NUM 11 | 12 | context-free syntax 13 | add(NUM,NUM) -> NUM 14 | mul(NUM,NUM) -> NUM 15 | 16 | fac1(NUM) -> NUM 17 | fac2(Integer) -> Integer 18 | 19 | context-free start-symbols 20 | NUM Integer 21 | variables 22 | [NM] [0-9]* -> NUM 23 | "I" [0-9]* -> Integer 24 | 25 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/TYPE.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::TYPE 2 | 3 | // A <: B 4 | 5 | data SYM = A() | B() | Z(); 6 | 7 | public bool comparable(SYM s, SYM t) = subtype(s,t) || subtype(t,s); 8 | 9 | bool subtype(A(), B()) = true; 10 | 11 | default bool subtype(SYM s, SYM t) = false; 12 | 13 | test bool TPcomparable1() = comparable(A(), B()); 14 | test bool TPcomparable2() = comparable(B(), A()); 15 | 16 | @ignoreInterpreter{This failing test seems to be an error in the interpreter} 17 | test bool TPsubtype1() = !subtype(Z(), A()); 18 | 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/Imports5.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::Imports5 2 | 3 | import lang::rascal::tests::imports::M5; 4 | 5 | import lang::rascal::tests::imports::Mbase; 6 | 7 | test bool Test51() = lang::rascal::tests::imports::Mbase::n == 2; 8 | 9 | test bool Test52() = lang::rascal::tests::imports::Mbase::f(3) == 6; 10 | 11 | test bool Test53() = lang::rascal::tests::imports::M5::m == 3; 12 | 13 | test bool Test54() = lang::rascal::tests::imports::M5::g(3) == 9; 14 | 15 | test bool Test55() = lang::rascal::tests::imports::M5::h(3) == 6; 16 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/sdf2/filters/InjectionCount.rsc: -------------------------------------------------------------------------------- 1 | module lang::sdf2::filters::InjectionCount 2 | 3 | import ParseTree; 4 | 5 | private default int count(Tree _) = 0; 6 | private int count(appl(prod(Symbol _,[Symbol _],set[Attr] _), [Tree arg])) = 1 + count(arg); 7 | 8 | &T <: Tree injectionCountFilter(amb(set[&T <: Tree] alts)) { 9 | as = [*alts]; 10 | counts = [count(a) | a <- as]; 11 | new = {as[i] | i <- index(as), counts[i] == min(counts)}; 12 | 13 | if (new == alts) { 14 | fail injectionCountFilter; 15 | } 16 | else { 17 | return amb(new); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/semantics/dynamic/Name.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.semantics.dynamic; 2 | 3 | import io.usethesource.vallang.IConstructor; 4 | import io.usethesource.vallang.ISourceLocation; 5 | 6 | public abstract class Name extends org.rascalmpl.ast.Name { 7 | 8 | public Name(ISourceLocation src, IConstructor node) { 9 | super(src, node); 10 | } 11 | 12 | public static class Lexical extends org.rascalmpl.ast.Name.Lexical { 13 | public Lexical(ISourceLocation src, IConstructor node, String string) { 14 | super(src, node, string.replace('\\', ' ').replaceAll(" ","")); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/Strings2.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::Strings2 2 | 3 | import String; 4 | import List; 5 | import util::Math; 6 | import util::Reflective; 7 | 8 | test bool tstWrap(str S1 , str S2) { 9 | S1 = trim(S1); 10 | S2 = trim(S2); 11 | if(contains(S1, "\n") || contains(S2, "\n") || contains(S1, " ") || contains(S2, " ")) return true; 12 | if (S1 == "" && S2 == "") return true; 13 | S = S1 + " " + S2 + " " + S1 + " " + S2; 14 | n = max(size(S1), size(S2)) + 2; 15 | return trim(S) == trim(replaceAll(wrap(S, n), getLineSeparator(), " ")); 16 | } 17 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/AtColumnRequirement.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::AtColumnRequirement 2 | 3 | import ParseTree; 4 | import Exception; 5 | 6 | lexical C = C C C | "a"@2 | "b"; 7 | 8 | bool testParse(str input, bool shouldParse) { 9 | try { 10 | parse(#C, input); 11 | } catch ParseError(_): { 12 | return !shouldParse; 13 | } 14 | 15 | return shouldParse; 16 | } 17 | 18 | test bool testA() = testParse("a", false); 19 | 20 | test bool testBab() = testParse("bab", false); 21 | 22 | test bool testBba() = testParse("bba", true); 23 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/Extension2.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::Extension2 2 | 3 | // Extension of a function str(int, Tree) with str(int, A) 4 | 5 | extend lang::rascal::tests::extends1::Base2; 6 | 7 | syntax A = [ab]; 8 | 9 | str non_default_message = "*** NON-default use ***"; 10 | 11 | str EXTENDED_FUNCTION(int n, a: (A) `a`) = non_default_message; 12 | 13 | str main() = apply_EXTENDED_FUNCTION_a(); 14 | 15 | test bool apply1() = apply_EXTENDED_FUNCTION_a() == non_default_message; 16 | test bool apply2() = apply_EXTENDED_FUNCTION_b() == default_message; 17 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/PARENT.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::PARENT 2 | 3 | import lang::rascal::tests::extends1::PARSETREE; 4 | import lang::rascal::tests::extends1::TYPE; 5 | 6 | test bool dontShareANameResolutionCache1() = 7 | lang::rascal::tests::extends1::TYPE::comparable(A(),B()) && 8 | lang::rascal::tests::extends1::PARSETREE::comparable(A(),C()); 9 | 10 | 11 | test bool dontShareANameResolutionCache2() = 12 | lang::rascal::tests::extends1::PARSETREE::comparable(A(),C()) && 13 | lang::rascal::tests::extends1::TYPE::comparable(A(),B()); 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/library/util/PriorityQueueTests.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::library::util::PriorityQueueTests 2 | 3 | import List; 4 | import util::PriorityQueue; 5 | 6 | test bool prioTest() { 7 | 8 | Q = mkPriorityQueue(); 9 | 10 | elms = [10, 8, 50, 30, 1]; 11 | for(int i <- elms) 12 | Q = insertElement(Q, i, i); 13 | 14 | 15 | list[int] sorted = []; 16 | while(size(sorted) < size(elms)){ 17 | = extractMinimum(Q); 18 | sorted = sorted + [minimum]; 19 | } 20 | 21 | return true; 22 | } 23 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/imports/CyclicImports1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::imports::CyclicImports1 2 | 3 | import lang::rascal::tests::imports::C1; 4 | import lang::rascal::tests::imports::C2; 5 | 6 | test bool Cycle1() = isDint(d(13)) == true; 7 | test bool Cycle2() = isDint(d("abc")) == false; 8 | 9 | test bool Cycle3() = isDstr(d("abc")) == true; 10 | test bool Cycle4() = isDstr(d(13)) == false; 11 | 12 | test bool Cycle5() = C2func(1) == 1; 13 | test bool Cycle6() = C1func(2) == 2; 14 | 15 | test bool Cycle7() = C1testFunction() == 2; 16 | test bool Cycle8() = C2testFunction() == 1; 17 | 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/csv/ast/CSV.rsc: -------------------------------------------------------------------------------- 1 | module lang::csv::ast::CSV 2 | 3 | import String; 4 | 5 | data Table(loc src=|unknown:///|) = table(list[Record] records); 6 | 7 | data Record(loc src=|unknown:///|) = record(list[Field] fields); 8 | 9 | data Field(loc src=|unknown:///|) 10 | = unquoted(str text) 11 | | quoted(str text); 12 | 13 | public Table unquote(Table tbl) { 14 | str unescape(str s) = replaceAll(replaceAll(replaceAll(s, "\\n", "\n"), "\\t", "\t"), "\"\"", "\""); 15 | 16 | return visit (tbl) { 17 | case quoted(txt) => unquoted(unescape(substring(txt, 1, size(txt) - 1))) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax6.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::Syntax6 2 | 3 | import ParseTree; 4 | 5 | syntax Exp = left Exp "+" Exp | LitA | LitB | AZ; 6 | syntax LitA = "a"; 7 | syntax LitB = "b"; 8 | lexical AZ = [a-z]; 9 | 10 | test bool expIsAmbiguous() = /amb(_) := parse(#Exp, "a+a", allowAmbiguity=true); 11 | 12 | test bool visitAndDeepMatchGoThroughAmb() { 13 | t = parse(#Exp, "a+a", allowAmbiguity=true); 14 | 15 | u = visit(t) { 16 | case (Exp) `` => (Exp) `` when LitB b := [LitB] "b" 17 | } 18 | 19 | return t != u && /LitB _ := u; 20 | } 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/UseImportBase.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::UseImportBase 2 | 3 | import lang::rascal::tests::extends1::Base; 4 | 5 | test bool base1() { S s = [S] "a"; return s == [S] "a";} 6 | 7 | test bool base2() { Sstar s = [Sstar] "aaa"; return s == [Sstar] "aaa";} 8 | 9 | test bool base3() { INTEGER n = 13; return n == 13;} 10 | 11 | test bool base4() { D x = d1(); return x == d1();} 12 | 13 | test bool base5() { return ident(13) == 13; } 14 | 15 | test bool base6() { return f(0) == "zero"; } 16 | 17 | test bool base7() { return f(9) == "value"; } 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/Issue1913.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::Issue1913 2 | 3 | extend lang::std::Layout; 4 | import IO; 5 | 6 | syntax As = "begin" A* as "end"; 7 | 8 | syntax A = "a" | "b"; 9 | 10 | test bool issue1913() { 11 | A* bs = (As)`begin b a b end`.as; 12 | 13 | As prog = (As)`begin b a a end`; 14 | 15 | prog = visit (prog) { 16 | case (As)`begin b end` 17 | => (As)`begin end` 18 | } 19 | 20 | println(prog); 21 | // don't loose a space 22 | return "" == "begin b a b a a end"; 23 | } -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/result/IRascalResult.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.interpreter.result; 2 | 3 | import io.usethesource.vallang.IValue; 4 | import io.usethesource.vallang.type.Type; 5 | 6 | public interface IRascalResult { 7 | Type getStaticType(); 8 | 9 | default Type getDynamicType() { 10 | return getValue().getType(); 11 | } 12 | 13 | default Type getStaticUnaliasedType() { 14 | Type result = getStaticType(); 15 | 16 | while (result.isAliased()) { 17 | result = result.getAliased(); 18 | } 19 | 20 | return result; 21 | } 22 | 23 | IValue getValue(); 24 | } 25 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/proxyhomedir/.m2/settings.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | testproxy 8 | true 9 | http 10 | 127.0.0.1 11 | 8888 12 | www.google.com|*.example.com 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/meta/ModuleInfoTests.rsc: -------------------------------------------------------------------------------- 1 | @bootstrapParser 2 | module lang::rascal::meta::ModuleInfoTests 3 | 4 | import lang::rascal::\syntax::Rascal; 5 | 6 | import lang::rascal::meta::ModuleInfo; 7 | 8 | test bool tstGetImports1() = getImports((Module) `module MMM`) == importsInfo({}, {}); 9 | test bool tstGetImports2() = getImports((Module) `module MMM import A;`) == importsInfo({"A"}, {}); 10 | test bool tstGetImports3() = getImports((Module) `module MMM import A;extend B;import C;`) == importsInfo({"A", "C"}, {"B"}); 11 | test bool tstGetImports4() = getImports((Module) `module MMM syntax A = "a";`) == importsInfo({}, {}); 12 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/trans/level1/1.0/level1-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | trans 7 | level1 8 | 1.0 9 | 10 | 11 | 12 | trans 13 | level2 14 | 1.0 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/trans/level2/1.0/level2-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | trans 7 | level2 8 | 1.0 9 | 10 | 11 | 12 | trans 13 | level3 14 | 1.0 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/csv/syntax/CSV.rsc: -------------------------------------------------------------------------------- 1 | module lang::csv::\syntax::CSV 2 | 3 | start syntax Table 4 | = table: {Record EOL}* 5 | ; 6 | 7 | syntax Record // todo: $ does match single \r 8 | = record: {Field ","}+ 9 | ; 10 | 11 | syntax Field 12 | = unquoted: UQStr 13 | | quoted: QStr 14 | ; 15 | 16 | lexical UQStr 17 | = ![\n\r\",] ![\n\r,]* !>> ![\n\r,] 18 | | /* empty */ 19 | ; 20 | 21 | lexical QStr 22 | = [\"] QChar* [\"] !>> ![,\n\r] 23 | ; 24 | 25 | lexical QChar 26 | = ![\"\n\r] 27 | | [\"][\"] 28 | ; 29 | 30 | lexical EOL 31 | = [\n] 32 | | [\r][\n] 33 | | [\r] !>> [\n] 34 | ; 35 | 36 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1b/2.0/level1b-2.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level1b 8 | 2.0 9 | 10 | 11 | 12 | range 13 | level2 14 | 2.0 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1c/2.0/level1c-2.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level1c 8 | 2.0 9 | 10 | 11 | 12 | range 13 | level2 14 | 2.0 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level2/1.0/level2-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level2 8 | 1.0 9 | 10 | 11 | 12 | range 13 | level4 14 | 2.0 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1a/1.0/level1a-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level1a 8 | 1.0 9 | 10 | 11 | 12 | range 13 | level2 14 | [1.0,2.0] 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1b/1.0/level1b-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level1b 8 | 1.0 9 | 10 | 11 | 12 | range 13 | level2 14 | [1.0,1.5] 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1c/1.0/level1c-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level1c 8 | 1.0 9 | 10 | 11 | 12 | range 13 | level3 14 | [0.0,1.0] 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level2/2.0/level2-2.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level2 8 | 2.0 9 | 10 | 11 | 12 | range 13 | level3 14 | [0.0,1.0] 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/std/ASCII.rsc: -------------------------------------------------------------------------------- 1 | 2 | @synopsis{Character classes commonly known in the ASCII set} 3 | @description{ 4 | 5 | } 6 | module lang::std::ASCII 7 | 8 | lexical Ascii = [\a00-\a7f]; 9 | 10 | lexical Alnum = [A-Z a-z 0-9]; 11 | 12 | lexical Alpha = [A-Z a-z]; 13 | 14 | lexical Upper = [A-Z]; 15 | 16 | lexical Lower = [a-z]; 17 | 18 | lexical Blank = [\ \t]; 19 | 20 | lexical Ctrl = [\a00-\a1f \a7f]; 21 | 22 | lexical Digit = [0-9]; 23 | 24 | lexical Graph = [~-!]; 25 | 26 | lexical HexNumber = [A-F a-f 0-9]; 27 | 28 | lexical Print = [\ ~-!]; 29 | 30 | lexical Punt = [!-/ :-@ \[-~]; 31 | 32 | lexical Space = [\t \n \a0B \a0C \r \ ]; 33 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/json/examples/ex02.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "precision": "zip", 4 | "Latitude": 37.7668, 5 | "Longitude": -122.3959, 6 | "Address": "", 7 | "City": "SAN FRANCISCO", 8 | "State": "CA", 9 | "Zip": "94107", 10 | "Country": "US" 11 | }, 12 | { 13 | "precision": "zip", 14 | "Latitude": 37.371991, 15 | "Longitude": -122.026020, 16 | "Address": "", 17 | "City": "SUNNYVALE", 18 | "State": "CA", 19 | "Zip": "94085", 20 | "Country": "US" 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Reverse/rev1.trm: -------------------------------------------------------------------------------- 1 | rev1( 2 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 3 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 4 | 41,42,43,44,45,46,47,48,49,50, 5 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 6 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 7 | 41,42,43,44,45,46,47,48,49,50, 8 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 9 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 10 | 41,42,43,44,45,46,47,48,49,50, 11 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 12 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 13 | 41,42,43,44,45,46,47,48,49,50 14 | ) 15 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Reverse/rev2.trm: -------------------------------------------------------------------------------- 1 | rev2( 2 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 3 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 4 | 41,42,43,44,45,46,47,48,49,50, 5 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 6 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 7 | 41,42,43,44,45,46,47,48,49,50, 8 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 9 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 10 | 41,42,43,44,45,46,47,48,49,50, 11 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 12 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 13 | 41,42,43,44,45,46,47,48,49,50 14 | ) 15 | -------------------------------------------------------------------------------- /test/org/rascalmpl/benchmark/Reverse/rev3.trm: -------------------------------------------------------------------------------- 1 | rev3( 2 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 3 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 4 | 41,42,43,44,45,46,47,48,49,50, 5 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 6 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 7 | 41,42,43,44,45,46,47,48,49,50, 8 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 9 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 10 | 41,42,43,44,45,46,47,48,49,50, 11 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 12 | 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 13 | 41,42,43,44,45,46,47,48,49,50 14 | ) 15 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level1a/1.0/level1a-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | breadth-first 7 | level1a 8 | 1.0 9 | 10 | 11 | 12 | breadth-first 13 | level2 14 | 1.0 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level1b/1.0/level1b-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | breadth-first 7 | level1b 8 | 1.0 9 | 10 | 11 | 12 | breadth-first 13 | level3 14 | 2.0 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/breadth-first/level2/1.0/level2-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | breadth-first 7 | level2 8 | 1.0 9 | 10 | 11 | 12 | breadth-first 13 | level3 14 | 1.0 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/compiler/lang/rascalcore/check/tests/download-test-jars.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | set -e -o pipefail 4 | 5 | function download() { 6 | mvn dependency:get -DgroupId="$1" -DartifactId="$2" -Dversion="$3" 7 | } 8 | 9 | # these should be synced with `TestConfigs.rsc` 10 | download "org.rascalmpl" "rascal" "0.41.0-RC15" 11 | download "org.rascalmpl" "typepal" "0.14.8" 12 | download "org.rascalmpl" "typepal" "0.14.1" 13 | download "org.rascalmpl" "drambiguity" "0.1.2" 14 | download "org.rascalmpl" "flybytes" "0.1.5" 15 | download "org.rascalmpl" "salix-core" "0.2.7" 16 | download "org.rascalmpl" "salix-contrib" "0.2.7" 17 | download "org.rascalmpl" "rascal-lsp" "2.21.2" -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/doc/example.tex: -------------------------------------------------------------------------------- 1 | \documentclass[]{article} 2 | 3 | \usepackage[T1]{fontenc} 4 | \usepackage{microtype} 5 | \usepackage{lmodern} 6 | 7 | \usepackage{rascal} 8 | \usepackage{listings} 9 | 10 | \begin{document} 11 | Right click on any rascal file, select experimental, Show as Latex. Then copy paste the generated latex into a rascal environment as follows. 12 | 13 | Example 1 14 | \begin{rascal} 15 | \CAT{Keyword}{module} NewModule 16 | 17 | \CAT{Comment}{@doc\{{}Example docs\}{}} 18 | \CAT{Keyword}{data} X = answer(\CAT{Keyword}{int} fortyTwo); 19 | 20 | \CAT{Keyword}{public} X getAnswer() = answer(42); 21 | \end{rascal} 22 | 23 | \end{document} 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/FieldProjectionBug.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::FieldProjectionBug 2 | 3 | import ParseTree; 4 | 5 | layout Layout = [\ \r\n]+ !>> [\ \r\n]; 6 | start syntax Expression = (Identifier i|BuiltIn b) function; 7 | lexical Identifier = [a-z A-Z 0-9]+ !>> [a-z A-Z 0-9] \ Keywords; 8 | lexical BuiltIn = "hoi"; 9 | keyword Keywords = "hoi"; 10 | 11 | 12 | test bool prodFieldProjectionOnAnAlternative() { 13 | Tree T = (Expression) `hoi`.function; 14 | return regular(alt(_)) := T.prod; 15 | } 16 | 17 | test bool labeledAlternativeProjection() { 18 | T = (Expression) `hoi`.function; 19 | return BuiltIn _ := T.b; 20 | } 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/syntax/tests/PreBootstrap.rsc: -------------------------------------------------------------------------------- 1 | @bootstrapParser 2 | module lang::rascal::\syntax::tests::PreBootstrap 3 | 4 | import lang::rascal::\syntax::Rascal; 5 | 6 | public test bool expr() = Expression _ := (Expression) `1`; 7 | public test bool lit() = (Sym) `` := (Sym) `'hello'`; 8 | public test bool nont() = (Sym) `` := (Sym) `X`; 9 | public test bool paramnont() = (Sym) `[<{Sym ","}+ _>]` := (Sym) `List[String,String]`; 10 | public test bool string() = (Sym) `` := (Sym) `"hello"`; 11 | public test bool match() = (Expression) `` := (Expression) `1`; 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/tutor/example.questions: -------------------------------------------------------------------------------- 1 | ## Simple questions 2 | Here is a question to answer. 3 | 4 | question Replace the text box by an expression and make the test true: 5 | expr setComprehension: [?{n-1} | int n <- !{list[int][1,5]}] 6 | end 7 | 8 | //Here are other questions 9 | 10 | question Replace the text box by a function name and make the test true: 11 | prep: 12 | import List; 13 | expr 14 | listFunction: ?{headTail}(!{list[int][1,5]}) 15 | end 16 | 17 | ## Tough questions 18 | question Replace the text box by a value and make the test true: 19 | expr 20 | setIn: ?{A:int} in %{ !{B:set[int]} + !{A} } 21 | end 22 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/IsDefined.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::IsDefined 2 | 3 | syntax As = "a"* as; 4 | 5 | syntax Bs = {"b" ","}* bs; 6 | 7 | // Concrete lists 8 | 9 | test bool isDefinedConcrete1() = (([As] "aaa")[0])?; 10 | 11 | test bool isDefinedConcrete2() = !(([As] "aaa")[5])?; 12 | 13 | test bool isDefinedConcrete3() = (([Bs] "b,b,b")[0])?; 14 | 15 | test bool isDefinedConcrete4() = !(([Bs] "b,b,b")[5])?; 16 | 17 | test bool hasConcrete1() = ([As] "aaa") has as; 18 | 19 | test bool hasConcrete2() = !(([As] "aaa") has bs); 20 | 21 | test bool hasConcrete3() = ([Bs] "b,b,b") has bs; 22 | 23 | test bool hasConcrete4() = !(([Bs] "b,b,b") has as); 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/sdf2/filters/GeneralInjectionCount.rsc: -------------------------------------------------------------------------------- 1 | module lang::sdf2::filters::GeneralInjectionCount 2 | 3 | import ParseTree; 4 | import List; 5 | 6 | private default bool injection(Tree _) = false; 7 | private bool injection(appl(prod(Symbol _,[Symbol _],set[Attr] _), [Tree _])) = true; 8 | 9 | &T <: Tree generalInjectionCountFilter(amb(set[&T <: Tree] alts)) { 10 | as = [*alts]; 11 | counts = [(0 | it + 1 | /Tree t := a, injection(t)) | a <- as]; 12 | minimum = min(counts); 13 | new = {as[i] | i <- index(as), counts[i] == minimum}; 14 | 15 | if (new == alts) { 16 | fail generalInjectionCountFilter; 17 | } 18 | else { 19 | return amb(new); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/org/rascalmpl/library=UTF-8 3 | encoding//src/org/rascalmpl/library/experiments/vis2/lib/MarkdownConverter.js=UTF-8 4 | encoding//src/org/rascalmpl/library/experiments/vis2/lib/nv.d3.css=UTF-8 5 | encoding//src/org/rascalmpl/library/experiments/vis2/lib/nv.d3.js=UTF-8 6 | encoding//src/org/rascalmpl/library/experiments/vis2/lib/reset.css=UTF-8 7 | encoding//src/org/rascalmpl/library/lang/rascal/tests/functionality/DataType.rsc=UTF-8 8 | encoding//test/org/rascalmpl/test/data=UTF-8 9 | encoding/=UTF-8 10 | encoding/src=UTF-8 11 | encoding/test=UTF-8 12 | org.eclipse.jdt.core.compiler.processAnnotations=enabled 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/Issue2147.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::Issue2147 2 | 3 | lexical C = "c"+; 4 | 5 | import ParseTree; 6 | 7 | test bool issue2147_deepMatch() { 8 | // these examples are expected 9 | assert [C] "c" !:= [C]"cc"; 10 | assert /[C] "c" !:= [C]"cc"; 11 | 12 | // now we upcast to `Tree` 13 | Tree c = [C]"c"; 14 | 15 | // now we get something unusual. This should not match... 16 | return /c !:= [C]"cc"; 17 | } 18 | 19 | test bool issue2147_visit() { 20 | // now we upcast to `Tree` 21 | Tree c = [C] "c"; 22 | 23 | visit ([C] "cc") { 24 | case c : return false; 25 | } 26 | 27 | return true; 28 | } -------------------------------------------------------------------------------- /src/org/rascalmpl/tasks/RefFactPolicy.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Anya Helene Bagge - anya@ii.uib.no (Univ. Bergen) 11 | *******************************************************************************/ 12 | package org.rascalmpl.tasks; 13 | 14 | public enum RefFactPolicy { 15 | DEFAULT, 16 | STRONG, 17 | SOFT; 18 | } 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/std/Whitespace.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} 9 | @contributor{Davy Landman - Davy.Landman@cwi.nl - CWI} 10 | module lang::std::Whitespace 11 | 12 | lexical Whitespace 13 | = @synopsis{All the white space chars defined in Unicode 6.0} 14 | [\u0009-\u000D \u0020 \u0085 \u00A0 \u1680 \u180E \u2000-\u200A \u2028 \u2029 \u202F \u205F \u3000] 15 | ; 16 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/smtlib2/command/response/Parse.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @contributor{Jouke Stoel - stoel@cwi.nl (CWI)} 9 | @synopsis{Synopsis: Parse the response that a SMT solver returns} 10 | 11 | module lang::smtlib2::command::response::Parse 12 | 13 | import lang::smtlib2::command::response::Syntax; 14 | 15 | import ParseTree; 16 | 17 | Response parseResponse(str response) = parse(#start[Response], response).top; 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/ast/IVisitable.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl 12 | *******************************************************************************/ 13 | package org.rascalmpl.ast; 14 | 15 | public interface IVisitable { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/json/ast/JSON.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @contributor{Mark Hills - Mark.Hills@cwi.nl (CWI)} 9 | @contributor{Tijs van der Storm - storm@cwi.nl (CWI)} 10 | module lang::json::ast::JSON 11 | 12 | data JSON 13 | = null() 14 | | object(map[str, JSON] properties) 15 | | array(list[JSON] values) 16 | | number(real n) 17 | | string(str s) 18 | | boolean(bool b) 19 | | ivalue(type[value] t, value v) 20 | ; 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax3.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::Syntax3 2 | 3 | import ParseTree; 4 | 5 | syntax Aas 6 | = nil: [a]* 7 | | a: [a][a]* 8 | | aas: [a][a][a]* 9 | ; 10 | 11 | &T <: Tree ambFilter(amb(set[&T <: Tree] alternatives)) { 12 | set[&T <: Tree] result = {a | &T <: Tree a <- alternatives, !(a is nil)}; 13 | 14 | if ({oneTree} := result) { 15 | return oneTree; 16 | } 17 | 18 | return ParseTree::amb(result); 19 | } 20 | 21 | test bool resolveableAmbIsGone() = amb(_) !:= parse(#Aas, "a", allowAmbiguity=true, filters={ambFilter}); 22 | 23 | test bool twoAmbsLeft() = amb({_,_}) := parse(#Aas, "aa", allowAmbiguity=true, filters={ambFilter}); 24 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/parallel/AllSuiteParallel.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.test.parallel; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.rascalmpl.test.infrastructure.RascalJUnitParallelRecursiveTestRunner; 5 | import org.rascalmpl.test.infrastructure.RecursiveRascalParallelTest; 6 | 7 | @RunWith(RascalJUnitParallelRecursiveTestRunner.class) 8 | @RecursiveRascalParallelTest({ 9 | "lang::rascal::tests::basic", 10 | "lang::rascal::tests::concrete", 11 | "lang::rascal::tests::extends", 12 | "lang::rascal::tests::demo", 13 | "lang::rascal::tests::functionality", 14 | "lang::rascal::tests::imports", 15 | "lang::rascal::tests::library" 16 | }) 17 | public class AllSuiteParallel { 18 | } 19 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/data/fca/tealady.cxt: -------------------------------------------------------------------------------- 1 | B 2 | 3 | 18 4 | 14 5 | 6 | Evelyn 7 | Laura 8 | Theresa 9 | Brenda 10 | Charlotte 11 | Frances 12 | Eleanor 13 | Pearl 14 | Ruth 15 | Verne 16 | Myra 17 | Katherine 18 | Syliva 19 | Nora 20 | Helen 21 | Dorothy 22 | Olivia 23 | Flora 24 | 1 25 | 2 26 | 3 27 | 4 28 | 5 29 | 6 30 | 7 31 | 8 32 | 9 33 | 10 34 | 11 35 | 12 36 | 13 37 | 14 38 | XXXXXX.XX..... 39 | XXX.XXXX...... 40 | .XXXXXXXX..... 41 | X.XXXXXX...... 42 | ..XXX.X....... 43 | ..X.XX.X...... 44 | ....XXXX...... 45 | .....X.XX..... 46 | ....X.XXX..... 47 | ......XXX..X.. 48 | .......XXX.X.. 49 | .......XXX.XXX 50 | ......XXXX.XXX 51 | .....XX.XXXXXX 52 | ......XX.XXX.. 53 | .......XX..... 54 | ........X.X... 55 | ........X.X... 56 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/grammar/definition/References.rsc: -------------------------------------------------------------------------------- 1 | @synopsis{This module implements the semantics of the ... and :cons notations in Rascal grammars. 2 | 3 | To give the proper semantics to priorities, this must be run before the priority relation 4 | is expanded.} 5 | module lang::rascal::grammar::definition::References 6 | 7 | extend Grammar; 8 | extend ParseTree; 9 | import lang::rascal::grammar::definition::Symbols; 10 | 11 | Grammar references(Grammar g) 12 | = visit (g) { 13 | case reference(Symbol s, str name) => p 14 | when ss := striprec(s) 15 | , ss in g.rules 16 | , /Production p:prod(label(name, t), _, _) := g.rules[ss] 17 | , ss == striprec(t) 18 | }; 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/utils/IResourceLocationProvider.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.interpreter.utils; 2 | 3 | import java.util.Set; 4 | 5 | import io.usethesource.vallang.ISourceLocation; 6 | 7 | /** 8 | * This is a injected configuration parameter of a Rascal run-time 9 | * environment like IRascalMonitor and IDEServices. The goal is 10 | * to find all the file names that have the given `fileName` in 11 | * the current run-time environment. For compiled Rascal this would 12 | * be ClassLoader.findResources, while for the interpreter it is 13 | * typically a search through all the roots of the source folders. 14 | */ 15 | public interface IResourceLocationProvider { 16 | Set findResources(String fileName); 17 | } 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tasks/DepFactPolicy.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Anya Helene Bagge - anya@ii.uib.no (Univ. Bergen) 11 | *******************************************************************************/ 12 | package org.rascalmpl.tasks; 13 | 14 | public enum DepFactPolicy { 15 | DEFAULT, 16 | FINE_GRAINED, 17 | COARSE_GRAINED, 18 | POLICY_VERSIONED; 19 | } 20 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/mirrorhomedir/.m2/settings.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | usethesource 8 | simulated 9 | simulated 10 | 11 | 12 | 13 | 14 | usethesource 15 | https://releases.usethesource.io/maven/ 16 | central 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/callbacks/IConstructorDeclared.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Mark Hills - Mark.Hills@cwi.nl (CWI) 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.callbacks; 13 | 14 | public interface IConstructorDeclared { 15 | public void handleConstructorDeclaredEvent(); 16 | } 17 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tasks/INameFormatter.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Anya Helene Bagge - anya@ii.uib.no (Univ. Bergen) 11 | *******************************************************************************/ 12 | package org.rascalmpl.tasks; 13 | 14 | import io.usethesource.vallang.IValue; 15 | 16 | public interface INameFormatter { 17 | String format(IValue name); 18 | } 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/test/infrastructure/RascalJUnitTestPrefix.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Jurgen Vinju 9 | */ 10 | 11 | package org.rascalmpl.test.infrastructure; 12 | 13 | import java.lang.annotation.Retention; 14 | import java.lang.annotation.RetentionPolicy; 15 | 16 | @Retention(RetentionPolicy.RUNTIME) 17 | public @interface RascalJUnitTestPrefix { 18 | public abstract String value(); 19 | } 20 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/parent/test/1.0/test-1.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | parent 7 | test 8 | 1.0 9 | 10 | 11 | 12 | 13 | org.rascalmpl 14 | rascal 15 | 0.40.17 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/poms/remote-reference/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.rascalmpl 7 | test-project 8 | 0.1.0-SNAPSHOT 9 | 10 | 11 | 12 | com.google.code.gson 13 | gson 14 | [2.9.1,3.0) 15 | compile 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/sdf2/filters/PreferAvoid.rsc: -------------------------------------------------------------------------------- 1 | module lang::sdf2::filters::PreferAvoid 2 | 3 | import ParseTree; 4 | import Set; 5 | 6 | @synopsis{Import his module if you want prefer/avoid filtering enabled for your grammar. Use @prefer and @avoid to 7 | label alternatives.} 8 | &T <:Tree preferAvoidFilter(amb(set[&T <:Tree] alternatives)) { 9 | prefers = { t | t:appl(prod(_,_,{\tag("prefer"()),*_}),_) <- alternatives}; 10 | 11 | if (prefers != {}, size(alternatives) != size(prefers)) { 12 | return amb(prefers); 13 | } 14 | 15 | avoids = { t | t:appl(prod(_,_,{\tag("avoid"()),*_}),_) <- alternatives}; 16 | 17 | if (avoids != {}, size(alternatives) != size(avoids)) { 18 | return amb(alternatives - avoids); 19 | } 20 | 21 | fail; 22 | } 23 | -------------------------------------------------------------------------------- /src/org/rascalmpl/uri/resolvers.config: -------------------------------------------------------------------------------- 1 | org.rascalmpl.uri.file.FileURIResolver 2 | org.rascalmpl.uri.file.TempURIResolver 3 | org.rascalmpl.uri.CompressedStreamResolver 4 | org.rascalmpl.uri.remote.HttpsURIResolver 5 | org.rascalmpl.uri.remote.HttpURIResolver 6 | org.rascalmpl.uri.StandardLibraryURIResolver 7 | org.rascalmpl.uri.classloaders.SystemClassloaderResolver 8 | org.rascalmpl.uri.jar.JarURIResolver 9 | org.rascalmpl.uri.zip.ZipURIResolver 10 | org.rascalmpl.uri.file.HomeURIResolver 11 | org.rascalmpl.uri.file.MavenRepositoryURIResolver 12 | org.rascalmpl.uri.file.CWDURIResolver 13 | org.rascalmpl.uri.file.CurrentWorkingDriveResolver 14 | org.rascalmpl.uri.file.UNCResolver 15 | org.rascalmpl.uri.file.SystemPathURIResolver 16 | org.rascalmpl.uri.libraries.MemoryResolver 17 | 18 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/data/fca/lattice.cxt: -------------------------------------------------------------------------------- 1 | B 2 | 3 | 14 4 | 16 5 | 6 | I 7 | II 8 | III 9 | IV 10 | 1 11 | 2 12 | 3 13 | 4 14 | 5 15 | 6 16 | 7 17 | 8 18 | 9 19 | 10 20 | Boolean lattice 21 | CDS lattice 22 | geometric lattice 23 | metric lattice 24 | atomistic 25 | Brouwerian 26 | complemented 27 | distributive 28 | dually semimodular 29 | graded 30 | modular 31 | relatively complemented 32 | sectionally complemented 33 | semimodular 34 | Stonean 35 | uniquely complemented 36 | XXXXXXXXXXXXXXXX 37 | .X..X.X.XX..X... 38 | ..X.X.X..X.XXX.. 39 | ...X....XXX..X.. 40 | ...X.X.XXXX..XX. 41 | .XXXX.X.XXXXXX.. 42 | ....X.X....XX... 43 | ..X.X.X..X.XXX.. 44 | ....X...XX...... 45 | ...X.X.XXXX..X.. 46 | ....X.X..X...... 47 | ......X..X...X.. 48 | .X..X.X.XX..X... 49 | .X..X.X.XX.XX... 50 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/smtlib2/command/response/Implode.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @synopsis{Synopsis: Converts the concreate SMT Solver Response syntax to AST} 9 | @contributor{Jouke Stoel - stoel@cwi.nl (CWI)} 10 | 11 | module lang::smtlib2::command::response::Implode 12 | 13 | import ParseTree; 14 | 15 | import lang::smtlib2::command::response::Parse; 16 | import lang::smtlib2::command::response::Ast; 17 | 18 | public Response toAst(str answer) = implode(#Response, parseResponse(answer)); 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/std/Layout.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} 9 | module lang::std::Layout 10 | 11 | extend lang::std::Whitespace; 12 | extend lang::std::Comment; 13 | 14 | layout Standard 15 | = WhitespaceOrComment* !>> [\u0009-\u000D \u0020 \u0085 \u00A0 \u1680 \u180E \u2000-\u200A \u2028 \u2029 \u202F \u205F \u3000] !>> "//"; 16 | 17 | lexical WhitespaceOrComment 18 | = whitespace: Whitespace 19 | | comment: Comment 20 | ; 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/util/Random.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2019 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @contributor{Davy Landman} 9 | @contributor{Jurgen J. Vinju} 10 | module util::Random 11 | 12 | @synopsis{Get a random value of a certain type} 13 | @javaClass{org.rascalmpl.library.Prelude} 14 | java &T randomValue(type[&T] ofType, int depth = 5, int width = 5); 15 | 16 | @synopsis{Get a random value of a certain type} 17 | @javaClass{org.rascalmpl.library.Prelude} 18 | java &T randomValue(type[&T] ofType, int seed, int depth = 5, int width = 5); 19 | 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tasks/IIValueTask.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Anya Helene Bagge - anya@ii.uib.no (Univ. Bergen) 11 | *******************************************************************************/ 12 | package org.rascalmpl.tasks; 13 | 14 | import io.usethesource.vallang.IValue; 15 | import io.usethesource.vallang.type.Type; 16 | 17 | public interface IIValueTask extends ITask { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/uri/file/HomeURIResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.uri.file; 13 | 14 | public class HomeURIResolver extends AliasedFileResolver { 15 | 16 | public HomeURIResolver() { 17 | super("home", System.getProperty("user.home")); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/control_exceptions/MatchFailed.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.control_exceptions; 13 | 14 | public class MatchFailed extends ControlException { 15 | private static final long serialVersionUID = -2730655862233487621L; 16 | } 17 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/sexp/SExp.rsc: -------------------------------------------------------------------------------- 1 | 2 | @synopsis{AST model for S-Expressions.} 3 | @contributor{Tijs van der Storm - storm@cwi.nl (CWI)} 4 | module lang::sexp::SExp 5 | 6 | import lang::sexp::\syntax::SExp; 7 | import ParseTree; 8 | 9 | data SExp 10 | = string(String \str) 11 | | \list(list[SExp] elts) 12 | ; 13 | 14 | data String 15 | = simple(SimpleString simpleStr) 16 | | display(str display, SimpleString simpleStr) 17 | ; 18 | 19 | data SimpleString 20 | = raw(Raw raw) 21 | | token(str \value) 22 | | base64(list[str] chars) 23 | | hex(list[str] digits) 24 | | quoted(str \value) 25 | ; 26 | 27 | data Raw 28 | = raw(int size, str bytes) 29 | ; 30 | 31 | public SExp parseSExp(str src, loc l) 32 | = implode(#SExp, parse(#lang::sexp::\syntax::SExp::SExp, src, l)); 33 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/demo/RunRascalTestModules.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Jurgen Vinju 9 | */ 10 | package org.rascalmpl.test.demo; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 14 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 15 | 16 | @RunWith(RascalJUnitTestRunner.class) 17 | @RascalJUnitTestPrefix("demo") 18 | public class RunRascalTestModules { } 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/types/DefaultRascalTypeVisitor.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.types; 2 | 3 | import io.usethesource.vallang.type.DefaultTypeVisitor; 4 | import io.usethesource.vallang.type.Type; 5 | 6 | public abstract class DefaultRascalTypeVisitor extends DefaultTypeVisitor implements IRascalTypeVisitor { 7 | 8 | public DefaultRascalTypeVisitor(T def) { 9 | super(def); 10 | } 11 | 12 | @Override 13 | public T visitExternal(Type type) throws E { 14 | assert type instanceof RascalType; 15 | return ((RascalType) type).accept(this); 16 | } 17 | 18 | @Override 19 | public T visitReified(RascalType type) throws E { 20 | return def; 21 | } 22 | 23 | @Override 24 | public T visitNonTerminal(RascalType type) throws E { 25 | return def; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/org/rascalmpl/uri/file/TempURIResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.uri.file; 13 | 14 | public class TempURIResolver extends AliasedFileResolver { 15 | 16 | public TempURIResolver() { 17 | super("tmp", System.getProperty("java.io.tmpdir")); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tasks/IFactFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Anya Helene Bagge - anya@ii.uib.no (Univ. Bergen) 11 | *******************************************************************************/ 12 | package org.rascalmpl.tasks; 13 | 14 | 15 | public interface IFactFactory { 16 | public IFact fact(Class cls, Object key, String keyName, IExpirationListener lis, DepFactPolicy depPolicy, RefFactPolicy refPolicy); 17 | } 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/CommonKeywordParameterImport3/D.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::CommonKeywordParameterImport3::D 2 | 3 | import lang::rascal::tests::functionality::CommonKeywordParameterImport3::A; 4 | import lang::rascal::tests::functionality::CommonKeywordParameterImport3::C; 5 | 6 | test bool Dx1_y1() = x1() has y; 7 | test bool Dx1_y2() = !x1().y?; 8 | test bool Dx1_y3() = x1().y == 0; 9 | test bool Dx1_y4() = x1(y=10).y?; 10 | test bool Dx1_y5() = x1(y=10).y == 10; 11 | 12 | test bool Dx1_z1() = x1() has z; 13 | test bool Dx1_z2() = !x1().z?; 14 | test bool Dx1_z3() = x1().z == "abc"; 15 | test bool Dx1_z4() = x1(z="def").z?; 16 | test bool Dx1_z5() = x1(z="def").z == "def"; 17 | 18 | test bool normal() = normalX().y == 0; 19 | test bool extended() = extendedX().y == 0; 20 | -------------------------------------------------------------------------------- /src/org/rascalmpl/uri/remote/HttpsURIResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | * * Paul Klint - Paul.Klint@cwi.nl - CWI 12 | *******************************************************************************/ 13 | package org.rascalmpl.uri.remote; 14 | 15 | 16 | public class HttpsURIResolver extends HttpURIResolver { 17 | 18 | @Override 19 | public String scheme() { 20 | return "https"; 21 | } 22 | } -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/basic/CompilerIssues/TypedQualifiedName.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::basic::CompilerIssues::TypedQualifiedName 2 | 3 | 4 | data G = g(int n) | g1(); 5 | 6 | @ignoreCompiler{Defeats the strategy in lang::rascalcore::compile::Rascal2muRascal::RascalPattern fortyped qualified name pattern} 7 | test bool nestedfunctionInTrueBranch(){ 8 | int f(int x) = 2 * x; 9 | return [ g(int n) := g1() ? f(n) : -1 ] == [ -1 ]; 10 | } 11 | 12 | data D = d(int n) | d(); 13 | 14 | @ignoreCompiler{Defeats the strategy in lang::rascalcore::compile::Rascal2muRascal::RascalPattern for typed qualified name pattern} 15 | test bool nestedfunctionInTrueBranch2() { 16 | int f(int n) = n; 17 | for(((d(int t) := d()) ? f(t) : 4) == 4){ 18 | return true; 19 | } 20 | return false; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/m2/repository/range/level1a/2.0/level1a-2.0.pom: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | range 7 | level1a 8 | 2.0 9 | 10 | 11 | 12 | range 13 | level2 14 | 1.0 15 | 16 | 17 | 18 | range 19 | level4 20 | 1.0 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/env/UnmodifiableModuleEnvironment.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Anya Helene Bagge - (UiB) 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.env; 13 | 14 | public class UnmodifiableModuleEnvironment extends ModuleEnvironment { 15 | 16 | public UnmodifiableModuleEnvironment(String name, GlobalEnvironment heap) { 17 | super(name, heap); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/extend/RunRascalTestModules.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Jurgen Vinju 9 | */ 10 | package org.rascalmpl.test.extend; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 14 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 15 | 16 | @RunWith(RascalJUnitTestRunner.class) 17 | @RascalJUnitTestPrefix("lang::rascal::tests::extends") 18 | public class RunRascalTestModules { } 19 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/imports/RunRascalTestModules.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Jurgen Vinju 9 | */ 10 | package org.rascalmpl.test.imports; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 14 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 15 | 16 | @RunWith(RascalJUnitTestRunner.class) 17 | @RascalJUnitTestPrefix("lang::rascal::tests::imports") 18 | public class RunRascalTestModules { } 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/debug/IDebugHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * 10 | * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.debug; 13 | 14 | /** 15 | * Internal debugging support interface to be used within the interpreter. 16 | */ 17 | public interface IDebugHandler extends IDebugSupport, 18 | IRascalSuspendTriggerListener { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/Extension3.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::Extension3 2 | 3 | // Extension of a function str(Tree) with str(A) 4 | // Note: A concrete type at position 0. 5 | 6 | extend lang::rascal::tests::extends1::Base3; 7 | 8 | syntax A = [abc]; 9 | 10 | str non_default_message_a = "*** NON-default use a ***"; 11 | str non_default_message_c = "*** NON-default use c ***"; 12 | 13 | str EXTENDED_FUNCTION(a: (A) `a`) = non_default_message_a; 14 | str EXTENDED_FUNCTION(a: (A) `c`) = non_default_message_c; 15 | 16 | str main() = apply_EXTENDED_FUNCTION_a(); 17 | 18 | test bool apply1() = apply_EXTENDED_FUNCTION_a() == non_default_message_a; 19 | test bool apply2() = apply_EXTENDED_FUNCTION_b() == default_message; 20 | test bool apply3() = apply_EXTENDED_FUNCTION_c() == non_default_message_c; 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/tutor/lang/rascal/tutor/examples/Test/Vis/Vis.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Visuals Test 3 | --- 4 | 5 | ```rascal-shell 6 | import lang::html::IO; 7 | serve(p([text("This is"), b([text("bold")]), text("!")])) 8 | ``` 9 | 10 | ```rascal-commands,continue 11 | 12 | import IO; 13 | 14 | void exampleFunction() { 15 | 16 | println("HelloWorld!"); 17 | 18 | } 19 | ``` 20 | 21 | ```rascal-shell,continue 22 | exampleFunction(); 23 | ``` 24 | 25 | ```rascal-shell 26 | import lang::html::IO; 27 | HTMLElement table(rel[&T, &U] r) 28 | = table([ 29 | tr([ 30 | td([text("")]), 31 | td([text("")]) 32 | ]) 33 | | <- r 34 | ]); 35 | characters = {"Sneezy", "Sleepy", "Dopey", "Doc", "Happy", "Bashful", "Grumpy"}; 36 | serve(table(characters * characters)) 37 | ``` 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/control_exceptions/Filtered.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Arnold Lankamp - Arnold.Lankamp@cwi.nl 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.control_exceptions; 13 | 14 | public class Filtered extends ControlException{ 15 | private static final long serialVersionUID = -3162571811215782140L; 16 | 17 | public Filtered() { 18 | super(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/syntax/RunRascalSyntaxTestModules.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Jurgen Vinju 9 | */ 10 | package org.rascalmpl.test.syntax; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 14 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 15 | 16 | @RunWith(RascalJUnitTestRunner.class) 17 | @RascalJUnitTestPrefix("lang::rascal::syntax::tests") 18 | public class RunRascalSyntaxTestModules { } 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/control_exceptions/QuitException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | * * Arnold Lankamp - Arnold.Lankamp@cwi.nl 12 | *******************************************************************************/ 13 | package org.rascalmpl.interpreter.control_exceptions; 14 | 15 | public class QuitException extends ControlException { 16 | private static final long serialVersionUID = -6244185056015873062L; 17 | } 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/functionality/Projection.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::functionality::Projection 2 | /******************************************************************************* 3 | * Copyright (c) 2009-2015 CWI 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | * 9 | * Contributors: 10 | 11 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 12 | * * Bert Lisser - Bert.Lisser@cwi.nl - CWI 13 | *******************************************************************************/ 14 | 15 | // nonEmpty 16 | 17 | test bool nonEmpty1()={<1,2>}<0> == {1}; 18 | 19 | test bool nonEmpty2()={<1,2>}<1> == {2}; 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/functionality/RunRascalTestModules.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Jurgen Vinju 9 | */ 10 | package org.rascalmpl.test.functionality; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.rascalmpl.test.infrastructure.RascalJUnitTestPrefix; 14 | import org.rascalmpl.test.infrastructure.RascalJUnitTestRunner; 15 | 16 | @RunWith(RascalJUnitTestRunner.class) 17 | @RascalJUnitTestPrefix("lang::rascal::tests::functionality") 18 | public class RunRascalTestModules { } 19 | -------------------------------------------------------------------------------- /src/org/rascalmpl/test/infrastructure/RecursiveTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Davy Landman - Davy.Landman@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.test.infrastructure; 13 | 14 | import java.lang.annotation.Retention; 15 | import java.lang.annotation.RetentionPolicy; 16 | 17 | @Retention(RetentionPolicy.RUNTIME) 18 | public @interface RecursiveTest { 19 | public abstract String[] value(); 20 | } 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/bugs/ScratchNPE.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::recovery::bugs::ScratchNPE 2 | 3 | import ParseTree; 4 | import util::ParseErrorRecovery; 5 | import Exception; 6 | 7 | start syntax Ambiguous 8 | = "foo" 9 | | [f] [o] [o] 10 | ; 11 | 12 | 13 | void testFoo() { 14 | bool ambExceptionThrown = false; 15 | try { 16 | parse(#Ambiguous, "foo", allowRecovery=true, allowAmbiguity=false); 17 | } catch Ambiguity(l, nonterminal, sentence): { 18 | ambExceptionThrown = true; 19 | assert nonterminal == "Ambiguous"; 20 | assert sentence == "foo"; 21 | } 22 | 23 | assert ambExceptionThrown : "Ambiguity exception should have been thrown"; 24 | 25 | Tree t = parse(#Ambiguous, "foo", allowRecovery=true, allowAmbiguity=true); 26 | assert amb({_,_}) := t; 27 | } -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/library/lang/xml/glossary.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | example glossary 4 | S 5 | 6 | 7 | 8 | Standard Generalized Markup Language 9 | SGML 10 | ISO 8879:1986 11 | 12 | A meta-markup language, used to create markup 13 | languages such as DocBook. 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/util/Webserver.rsc: -------------------------------------------------------------------------------- 1 | 2 | module util::Webserver 3 | 4 | extend Content; 5 | 6 | @javaClass{org.rascalmpl.library.util.Webserver} 7 | java void serve(loc server, Response (Request) callback, bool asDaemon = true); 8 | 9 | @javaClass{org.rascalmpl.library.util.Webserver} 10 | java void shutdown(loc server); 11 | 12 | test bool testWebServer() { 13 | loc testLoc = |http://localhost:10001|; 14 | 15 | // simple get 16 | // Response testServer(get("/hello")) = response("hello world!"); 17 | Response testServer(p:post("/upload8", value (type[value] _) stuff)) = response("uploaded: "); 18 | 19 | try { 20 | serve(testLoc, testServer); 21 | return true; 22 | } 23 | catch value exception: 24 | throw exception; 25 | finally { 26 | shutdown(testLoc); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/org/rascalmpl/test/infrastructure/RecursiveJavaOnlyTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Davy Landman - Davy.Landman@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.test.infrastructure; 13 | 14 | import java.lang.annotation.Retention; 15 | import java.lang.annotation.RetentionPolicy; 16 | 17 | @Retention(RetentionPolicy.RUNTIME) 18 | public @interface RecursiveJavaOnlyTest { 19 | public abstract String[] value(); 20 | } 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/uri/BadURIException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | * * Arnold Lankamp - Arnold.Lankamp@cwi.nl 12 | *******************************************************************************/ 13 | package org.rascalmpl.uri; 14 | 15 | public class BadURIException extends RuntimeException{ 16 | private static final long serialVersionUID = 2091038871044656434L; 17 | 18 | public BadURIException(Exception ex){ 19 | super(ex); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/org/rascalmpl/debug/IRascalSuspendTrigger.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * 10 | * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.debug; 13 | 14 | public interface IRascalSuspendTrigger { 15 | 16 | public void addSuspendTriggerListener(IRascalSuspendTriggerListener listener); 17 | 18 | public void removeSuspendTriggerListener(IRascalSuspendTriggerListener listener); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/load/IRascalSearchPathContributor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.load; 13 | 14 | import java.util.List; 15 | 16 | import io.usethesource.vallang.ISourceLocation; 17 | 18 | public interface IRascalSearchPathContributor { 19 | void contributePaths(List path); 20 | String getName(); 21 | } 22 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/analysis/statistics/TODO.txt: -------------------------------------------------------------------------------- 1 | Various: 2 | + Gini 3 | 4 | Mike Godfrey: 5 | 6 | + median 7 | + ANOVA (analysis of variance), 8 | - multiple regression, 9 | - probability models, 10 | - methods for hypothesis testing. 11 | 12 | Plot distributions: 13 | + PDF 14 | + CDF 15 | + Histogram 16 | 17 | Compare distributions: 18 | + Chi^2 Test (X^2 Test) 19 | + T-Test 20 | - Wilcoxon Test 21 | - Kolmorogov Smirnov Test 22 | + Covariance 23 | 24 | Regressions: 25 | + Linear 26 | - Logistic 27 | 28 | He felt that the biggest weakness right now is the lack of distribution comparison and Logistic 29 | regression. 30 | 31 | He also suggested that you might want to consider the GSL (Gnu Scientific Library) for more functionality. 32 | 33 | Wietse: 34 | @PaulKlint it would be great to be able to inspect the distribution of a set of data with density histogram plot. 35 | 36 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/B1.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::B1 2 | 3 | import lang::rascal::tests::extends1::B2; 4 | import lang::rascal::tests::extends1::B3; 5 | 6 | import lang::rascal::tests::extends1::Base; 7 | 8 | int add1(int n) = n + 1; 9 | 10 | test bool b1base1() { S s = [S] "a"; return s == [S] "a";} 11 | 12 | test bool b1base2() { Sstar s = [Sstar] "aaa"; return s == [Sstar] "aaa";} 13 | 14 | test bool b1base3() { INTEGER n = 13; return n == 13;} 15 | 16 | test bool b1base4() { D x = d1(); return x == d1();} 17 | 18 | test bool b1base5() { return ident(13) == 13; } 19 | 20 | test bool b1base6() { return f(0) == "zero"; } 21 | 22 | test bool b1base7() { return f(9) == "value"; } 23 | 24 | // Defined in B[1-3] 25 | 26 | test bool b1tadd1() = add1(5) == 6; 27 | test bool b1tadd2() = add2(5) == 7; 28 | test bool b1tadd3() = add3(5) == 8; 29 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/upgrade/UpdateNestedListAndSetPatterns.rsc: -------------------------------------------------------------------------------- 1 | @bootstrapParser 2 | module lang::rascal::upgrade::UpdateNestedListAndSetPatterns 3 | 4 | import lang::rascal::\syntax::Rascal; 5 | import util::FileSystem; 6 | import ParseTree; 7 | import IO; 8 | import Message; 9 | 10 | list[Message] report(loc root) 11 | = [*report(parse(#start[Module], m)) | m <- find(root, "rsc")]; 12 | 13 | void update(loc root) { 14 | modules = [ f | /file(f) := crawl(root), f.extension == "rsc"]; 15 | for (m <- modules) { 16 | writeFile(m, ""); 17 | } 18 | } 19 | 20 | list[Message] report(Tree m) 21 | = [info("found postfix multivar", name@\loc) | /(Pattern) `*` := m]; 22 | 23 | Tree updateTree(Tree m) = 24 | visit(m) { 25 | case (Pattern) `*` => (Pattern) `*` 26 | }; 27 | -------------------------------------------------------------------------------- /src/org/rascalmpl/parser/gtd/result/action/VoidEnvironment.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2011-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Arnold Lankamp - Arnold.Lankamp@cwi.nl 11 | *******************************************************************************/ 12 | package org.rascalmpl.parser.gtd.result.action; 13 | 14 | /** 15 | * A dummy environment. 16 | */ 17 | public class VoidEnvironment { 18 | public final static VoidEnvironment ROOT_VOID_ENVIRONMENT = new VoidEnvironment(); 19 | 20 | private VoidEnvironment(){ 21 | super(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/poms/local-reference/pom-proxy.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.rascalmpl 7 | test-project 8 | 0.1.0-SNAPSHOT 9 | 10 | 11 | 12 | usethesource 13 | https://releases.usethesource.io/maven/ 14 | 15 | 16 | 17 | 18 | 19 | org.rascalmpl 20 | rascal 21 | 0.40.17 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/poms/local-reference/pom-transitive-exclusions.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | trans 7 | root 8 | 1.0 9 | 10 | 11 | 12 | trans 13 | level1 14 | 1.0 15 | 16 | 17 | trans 18 | level3 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/library/lang/json/glossary.json: -------------------------------------------------------------------------------- 1 | { 2 | "glossary": { 3 | "title": "example glossary", 4 | "line" : 2, 5 | "GlossDiv": { 6 | "line" : 5, 7 | "title": "S", 8 | "GlossList": { 9 | "line" : 8, 10 | "GlossEntry": { 11 | "line" : 10, 12 | "ID": "SGML", 13 | "SortAs": "SGML", 14 | "GlossTerm": "Standard Generalized Markup Language", 15 | "Acronym": "SGML", 16 | "Abbrev": "ISO 8879:1986", 17 | "GlossDef": { 18 | "line" : 17, 19 | "para": "A meta-markup language, used to create markup languages such as DocBook.", 20 | "GlossSeeAlso": ["GML", "XML"] 21 | }, 22 | "GlossSee": "markup" 23 | } 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/org/rascalmpl/library/util/SystemAPI.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} 9 | @contributor{Bert Lisser - Bert.Lisser@cwi.nl (CWI)} 10 | 11 | @synopsis{API to the System for example System Variables or System Commands.} 12 | module util::SystemAPI 13 | 14 | @javaClass{org.rascalmpl.library.util.SystemAPI} 15 | java str getSystemProperty(str property); 16 | 17 | @javaClass{org.rascalmpl.library.util.SystemAPI} 18 | java map[str,str] getSystemProperties(); 19 | 20 | @javaClass{org.rascalmpl.library.util.SystemAPI} 21 | java map[str,str] getSystemEnvironment(); 22 | -------------------------------------------------------------------------------- /src/org/rascalmpl/test/infrastructure/RecursiveRascalParallelTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2015 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Davy Landman - Davy.Landman@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.test.infrastructure; 13 | 14 | import java.lang.annotation.Retention; 15 | import java.lang.annotation.RetentionPolicy; 16 | 17 | @Retention(RetentionPolicy.RUNTIME) 18 | public @interface RecursiveRascalParallelTest { 19 | public abstract String[] value(); 20 | } 21 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/TypecheckerSuite.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Davy Landman - Davy.Landman@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.test; 13 | 14 | import org.junit.runner.RunWith; 15 | import org.rascalmpl.test.infrastructure.RecursiveTest; 16 | import org.rascalmpl.test.infrastructure.RecursiveTestSuite; 17 | 18 | @RunWith(RecursiveTestSuite.class) 19 | @RecursiveTest({"types"}) 20 | public class TypecheckerSuite { } 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/smtlib2/theory/core/Ast.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @synopsis{Synopsis: AST for the SMTLIBv2 Core theory (boolean logic)} 9 | @contributor{Jouke Stoel - stoel@cwi.nl (CWI)} 10 | 11 | module lang::smtlib2::theory::core::Ast 12 | 13 | data Sort = \bool(); 14 | 15 | data Expr 16 | = \not(Expr val) 17 | | implies(Expr lhs, Expr rhs) 18 | | and(Expr lhs, Expr rhs) 19 | | or(Expr lhs, Expr rhs) 20 | | xor(Expr lhs, Expr rhs) 21 | | eq(Expr lhs, Expr rhs) 22 | | distinct(Expr lhs, Expr rhs) 23 | | ite(Expr condition, Expr whenTrue, Expr whenFalse) 24 | ; 25 | 26 | data Literal = boolVal(bool b); 27 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/syntax/tests/KnownIssues.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @synopsis{This module documents known issues in Rascal that still need solving. 9 | Perhaps they are hard to solve, but one day the inversion of these tests will 10 | end up in SolvedIssues} 11 | @bootstrapParser 12 | module lang::rascal::\syntax::tests::KnownIssues 13 | 14 | import lang::rascal::\syntax::Rascal; 15 | import ParseTree; 16 | 17 | 18 | public bool isAmb(Tree t) = /amb(_) := t; 19 | 20 | public test bool literalAmb() = isAmb(parse(#Command,"\"a\"+ b;", allowAmbiguity=true)); 21 | 22 | public test bool basicAmb() = amb(_) := amb({}); 23 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/UseExtendBase.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::UseExtendBase 2 | 3 | extend lang::rascal::tests::extends1::Base; 4 | 5 | syntax S = "b"; 6 | 7 | test bool base1() { S s = [S] "a"; return s == [S] "a";} 8 | 9 | test bool base2() { Sstar s = [Sstar] "aaa"; return s == [Sstar] "aaa";} 10 | 11 | test bool base3() { INTEGER n = 13; return n == 13;} 12 | 13 | test bool base4() { D x = d1(); return x == d1();} 14 | 15 | test bool base5() { return ident(13) == 13; } 16 | 17 | test bool base6() { return f(0) == "zero"; } 18 | 19 | test bool base7() { return f(9) == "value"; } 20 | 21 | // Extensions 22 | 23 | test bool extend1() { S s = [S] "b"; return s == [S] "b";} 24 | 25 | test bool extend2() { Sstar s = [Sstar] "abab"; return s == [Sstar] "abab";} 26 | 27 | str f(2) = "two"; 28 | 29 | test bool extend3() { return f(2) == "two"; } 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/org/rascalmpl/exceptions/JavaMethodLink.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.exceptions; 13 | 14 | public class JavaMethodLink extends RuntimeException { 15 | private static final long serialVersionUID = 3867556518416718308L; 16 | 17 | public JavaMethodLink(String name, String message, Throwable cause) { 18 | super("Cannot link method " + name + " because: " + message, cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/org/rascalmpl/debug/IRascalEventListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * 10 | * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.debug; 13 | 14 | import java.util.EventListener; 15 | 16 | public interface IRascalEventListener extends EventListener { 17 | 18 | /** 19 | * Notification about a runtime-specific event. 20 | * 21 | * @param event the notification 22 | */ 23 | void handleRascalEvent(RascalEvent event); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/matching/IVarPattern.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Paul Klint - Paul.Klint@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.matching; 13 | 14 | import io.usethesource.vallang.type.Type; 15 | 16 | /** 17 | * Marker interface to identify all variable related patterns 18 | * 19 | */ 20 | public interface IVarPattern { 21 | public boolean isVarIntroducing(); 22 | 23 | public String name(); 24 | 25 | public Type getType(); 26 | } 27 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/Call.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::Call 2 | 3 | lexical ABC = "a" | "b" | "c"; 4 | 5 | syntax XYZ = "x" | "y" | "z"; 6 | 7 | //keyword KEY = "k" | "e"| | "y"; 8 | 9 | test bool dispatchTestLexical() { 10 | int f((ABC) `a`) = 1; 11 | int f((ABC) `b`) = 2; 12 | int f((ABC) `c`) = 3; 13 | 14 | return [f((ABC)`a`),f((ABC)`b`),f((ABC)`c`)] == [1,2,3]; 15 | } 16 | 17 | test bool dispatchTestSyntax() { 18 | int f((XYZ) `x`) = 1; 19 | int f((XYZ) `y`) = 2; 20 | int f((XYZ) `z`) = 3; 21 | 22 | return [f((XYZ)`x`),f((XYZ)`y`),f((XYZ)`z`)] == [1,2,3]; 23 | } 24 | 25 | //@ignoreCompiler{To be analyzed} 26 | //test bool dispatchTestKeyword() { 27 | // int f((KEY) `k`) = 1; 28 | // int f((KEY) `e`) = 2; 29 | // int f((KEY) `y`) = 3; 30 | // 31 | // return [f((KEY)`k`),f((KEY)`e`),f((KEY)`y`)] == [1,2,3]; 32 | //} 33 | -------------------------------------------------------------------------------- /src/org/rascalmpl/uri/UnsupportedSchemeException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.uri; 13 | 14 | import java.io.IOException; 15 | 16 | public class UnsupportedSchemeException extends IOException { 17 | private static final long serialVersionUID = -6623574531009224681L; 18 | 19 | public UnsupportedSchemeException(String scheme) { 20 | super("Unsupported scheme '" + scheme + "'"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/sdf2/filters/CountPreferAvoid.rsc: -------------------------------------------------------------------------------- 1 | module lang::sdf2::filters::CountPreferAvoid 2 | 3 | import ParseTree; 4 | import Set; 5 | import List; 6 | 7 | @synopsis{Import his module if you want prefer/avoid filtering with counting enabled for your grammar. Use @prefer and @avoid to 8 | label alternatives.} 9 | &T <:Tree countPreferAvoidFilter(amb(set[&T <:Tree] alternatives)) { 10 | alts = [*alternatives]; 11 | counts = [( 0 | it + 1 | /appl(prod(_,_,{\tag("prefer"()),*_}),_) := alt) | Tree alt <- alts]; 12 | 13 | new = [alts[i] | int i <- index(alts), counts[i] == max(counts)]; 14 | 15 | counts = [( 0 | it + 1 | /appl(prod(_,_,{\tag("avoid"()),*_}),_) := alt) | Tree alt <- new]; 16 | 17 | result = {new[i] | int i <- index(new), counts[i] == min(counts)}; 18 | 19 | if (result == alternatives) { 20 | fail countPreferAvoidFilter; 21 | } 22 | else { 23 | return amb(result); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/MissingReturn.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class MissingReturn extends StaticError { 17 | private static final long serialVersionUID = 6595223256368783269L; 18 | 19 | public MissingReturn(AbstractAST ast) { 20 | super("Missing return statement", ast); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/doc/rascal.sty: -------------------------------------------------------------------------------- 1 | \usepackage{xspace} 2 | \usepackage{xstring} 3 | \usepackage{xcolor} 4 | \usepackage[scaled=0.8]{beramono} 5 | \definecolor{Rkeyword}{RGB}{123,0,82} 6 | \definecolor{Rconstant}{RGB}{139,0,139} 7 | \definecolor{Rcomment}{RGB}{82, 141, 115} 8 | \definecolor{Rmetavariable}{RGB}{41, 95, 148} 9 | \definecolor{Rmetaskipped}{RGB}{82, 141, 115} 10 | \newenvironment{rascal}{ % 11 | \parindent=0pt 12 | \obeyspaces\obeylines 13 | \begingroup\lccode`~=`\^^M 14 | \lowercase{\endgroup\def~}{\par\leavevmode} % 15 | \ttfamily\vspace{0.8em}}{\vspace{.8em}} 16 | {\ignorespacesafterend} 17 | \newcommand{\CAT}[2]{% 18 | \IfStrEqCase{#1} { % 19 | {Keyword} {\textcolor{Rkeyword}{\textbf{#2}}} % 20 | {Comment} {\textcolor{Rcomment}{\textit{#2}}} % 21 | {MetaSkipped} {\textcolor{Rmetaskipped}{textit{#2}}} % 22 | {Constant} {\textcolor{Rconstant}{#2}} % 23 | {MetaVariable} {\textcolor{Rmetavariable}{\textit{#2}}}}[#2]% 24 | } 25 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/RedeclaredField.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class RedeclaredField extends StaticError { 17 | private static final long serialVersionUID = -8731371039162112981L; 18 | 19 | public RedeclaredField(String message, AbstractAST ast) { 20 | super(message, ast); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/matching/internal/Fingerprint.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.library.lang.rascal.matching.internal; 2 | 3 | import org.rascalmpl.values.parsetrees.ITree; 4 | 5 | import io.usethesource.vallang.IConstructor; 6 | import io.usethesource.vallang.IInteger; 7 | import io.usethesource.vallang.IValue; 8 | import io.usethesource.vallang.IValueFactory; 9 | 10 | public class Fingerprint { 11 | private final IValueFactory vf; 12 | 13 | public Fingerprint(IValueFactory vf) { 14 | this.vf = vf; 15 | } 16 | 17 | public IInteger internalFingerprint(IValue v) { 18 | return vf.integer(v.getMatchFingerprint()); 19 | } 20 | 21 | public IInteger internalConcreteFingerprint(IConstructor v) { 22 | return vf.integer(((ITree) v).getConcreteMatchFingerprint()); 23 | } 24 | 25 | public IInteger internalHashCode(IValue v) { 26 | return vf.integer(v.hashCode()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/extends1/Base3.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::extends1::Base3 2 | 3 | import ParseTree; 4 | 5 | str default_message = "default use"; 6 | 7 | default str EXTENDED_FUNCTION(Tree _) = default_message; 8 | 9 | str apply_EXTENDED_FUNCTION_a() = 10 | EXTENDED_FUNCTION( // Now follows the expanded version of (A) `a` 11 | appl( 12 | prod( 13 | sort("A"), 14 | [\char-class([range(97,99)])], 15 | {}), 16 | [char(97)])); 17 | 18 | str apply_EXTENDED_FUNCTION_b() = 19 | EXTENDED_FUNCTION( // Now follows the expanded version of (A) `b` 20 | appl( 21 | prod( 22 | sort("A"), 23 | [\char-class([range(97,99)])], 24 | {}), 25 | [char(98)])); 26 | 27 | str apply_EXTENDED_FUNCTION_c() = 28 | EXTENDED_FUNCTION( // Now follows the expanded version of (A) `c` 29 | appl( 30 | prod( 31 | sort("A"), 32 | [\char-class([range(97,99)])], 33 | {}), 34 | [char(99)])); 35 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/smtlib2/command/response/Ast.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @synopsis{Synopsis: Represents the AST of the SMT solver response} 9 | @contributor{Jouke Stoel - stoel@cwi.nl (CWI)} 10 | 11 | module lang::smtlib2::command::response::Ast 12 | 13 | data Response 14 | = response(CheckSat sat) 15 | | response(GetUnsatCore unsatCore) 16 | | response(GetValue model) 17 | | none() 18 | ; 19 | 20 | data CheckSat 21 | = sat() 22 | | unsat() 23 | | unknown() 24 | ; 25 | 26 | data GetUnsatCore = unsatCore(list[str] labels); 27 | 28 | data GetValue = foundValues(list[Model] models); 29 | data Model = model(Expr var, Expr val); 30 | 31 | data Expr; 32 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/smtlib2/theory/ints/Ast.rsc: -------------------------------------------------------------------------------- 1 | @license{ 2 | Copyright (c) 2009-2015 CWI 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | which accompanies this distribution, and is available at 6 | http://www.eclipse.org/legal/epl-v10.html 7 | } 8 | @synopsis{Synopsis: AST for the SMTLIBv2 Ints theory} 9 | @contributor{Jouke Stoel - stoel@cwi.nl (CWI)} 10 | 11 | module lang::smtlib2::theory::ints::Ast 12 | 13 | data Sort = \int(); 14 | 15 | data Expr 16 | = neg(Expr val) 17 | | sub(Expr lhs, Expr rhs) 18 | | add(Expr lhs, Expr rhs) 19 | | mul(Expr lhs, Expr rhs) 20 | | div(Expr lhs, Expr rhs) 21 | | \mod(Expr lhs, Expr rhs) 22 | | abs(Expr val) 23 | | lte(Expr lhs, Expr rhs) 24 | | lt (Expr lhs, Expr rhs) 25 | | gte(Expr lhs, Expr rhs) 26 | | gt (Expr lhs, Expr rhs) 27 | ; 28 | 29 | data Literal 30 | = intVal(int i) 31 | ; 32 | -------------------------------------------------------------------------------- /src/org/rascalmpl/debug/IRascalEventTrigger.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * 10 | * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.debug; 13 | 14 | /** 15 | * Interface to mark an class as an event trigger, where you can register for as 16 | * a listener. 17 | */ 18 | public interface IRascalEventTrigger { 19 | 20 | void addRascalEventListener(IRascalEventListener listener); 21 | void removeRascalEventListener(IRascalEventListener listener); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/dimacs/syntax/Dimacs.rsc: -------------------------------------------------------------------------------- 1 | @synopsis{Standard format for boolean formulas in conjunctive normal form.} 2 | @description{ 3 | This format is used by the yearly SAT competition, see https://www.satcompetition.org/ . 4 | } 5 | @examples{ 6 | This is a sample `.cnf` file: 7 | ```dimacs 8 | c A sample .cnf file. 9 | p cnf 3 2 10 | 1 -3 0 11 | 2 3 -1 0 12 | ``` 13 | } 14 | module lang::dimacs::\syntax::Dimacs 15 | 16 | layout L = [\t\ \r]*; 17 | 18 | lexical Comment = comment: "c" ![\n]* "\n"; 19 | lexical Prologue = prologue: "p" "cnf" Number variables Number clauses ![\n]* "\n"; 20 | 21 | lexical Number 22 | = positive: [0-9]+ !>> [0-9] 23 | | non-assoc negative: "-" Number number 24 | ; 25 | 26 | start syntax Dimacs 27 | = Prologue prologue {Line "\n"}+ lines "\n"; 28 | 29 | syntax Line 30 | = disjunct: Disjunct disjunct 31 | | comment: Comment comment 32 | ; 33 | 34 | syntax Disjunct = Number+ numbers; 35 | -------------------------------------------------------------------------------- /FUNDING: -------------------------------------------------------------------------------- 1 | ### Current funding 2 | 3 | * Centrum Wiskunde & Informatica, SWAT group (2009-...) 4 | * Swat.engineering BV (2017..) 5 | * GitHub donations (including anonymous donors) 6 | 7 | ### Past funding 8 | 9 | * Universiteit van Amsterdam, Vrije Universiteit en Hogeschool van Amsterdam "Master Software Engineering", for courses in Sofware Construction and Software Evolution (2009-2013) 10 | * EU FP7 OSSMETER Project Number **318736** (2012-2015) 11 | * EU H2020 CROSSMINER Project Number **REP-732223-2** (2016-2019) 12 | * NWO Big Software "MERITS" **NWO.628.008.002** (2016-2020) 13 | * NWO TOPGO "Domain-Specific Languages: A Big Future for Small Programs" **NWO.612.001.011** (2011-2016) 14 | * OU (Open Universiteit) support for courses in Software Quality Assurance (2012-2017) 15 | * SIA RAAK-PRO "EQuA: Early Quality Assurance for Software Production" (2011-2015) 16 | * SIA RAAK-MKB "Automated Game Design" (2014-2016) 17 | * SIA RAAK-MKB "Live Game Design" (2016-2019) 18 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/MissingModifier.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class MissingModifier extends StaticError { 17 | private static final long serialVersionUID = 8951799317606455150L; 18 | 19 | public MissingModifier(String name, AbstractAST onWhat) { 20 | super("Missing modifier: " + name, onWhat); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/UnguardedInsert.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class UnguardedInsert extends StaticError { 17 | private static final long serialVersionUID = -3024435867811407010L; 18 | 19 | public UnguardedInsert(AbstractAST ast) { 20 | super("Insert statement outside a visit statement", ast); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/UnguardedReturn.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class UnguardedReturn extends StaticError { 17 | private static final long serialVersionUID = -3024435867811407010L; 18 | 19 | public UnguardedReturn(AbstractAST ast) { 20 | super("Return statement outside of function scope", ast); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/bugs/FCASlow.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::recovery::bugs::FCASlow 2 | 3 | import lang::rascal::tests::concrete::recovery::RecoveryTestSupport; 4 | import lang::rascal::\syntax::Rascal; 5 | import ParseTree; 6 | import util::ParseErrorRecovery; 7 | import String; 8 | import IO; 9 | 10 | /** 11 | This tests the slowest error recovery in all tests < 10kb 12 | */ 13 | bool testFCA() { 14 | recoveryParser = parser(#start[Module], allowRecovery=true, allowAmbiguity=true, maxAmbDepth=1000); 15 | loc source = |std:///analysis/formalconcepts/FCA.rsc?deletedUntilEol=54:2242:2261|; 16 | str input = getTestInput(source); 17 | //println("input: "); 18 | Tree result = recoveryParser(input, source); 19 | println("total nodes: "); 20 | println("unique nodes: "); 21 | assert input == ""; 22 | 23 | return true; 24 | } 25 | -------------------------------------------------------------------------------- /src/org/rascalmpl/parser/Parser.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl 12 | * * Arnold Lankamp - Arnold.Lankamp@cwi.nl 13 | *******************************************************************************/ 14 | package org.rascalmpl.parser; 15 | 16 | 17 | public class Parser{ 18 | public static final String START_COMMAND = "start__Command"; 19 | public static final String START_COMMANDS = "start__Commands"; 20 | public static final String START_MODULE = "start__Module"; 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/ParserSyntaxDemoBenchmarkSuite.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Davy Landman - Davy.Landman@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.test; 13 | 14 | import org.junit.runner.RunWith; 15 | import org.rascalmpl.test.infrastructure.RecursiveTest; 16 | import org.rascalmpl.test.infrastructure.RecursiveTestSuite; 17 | 18 | @RunWith(RecursiveTestSuite.class) 19 | @RecursiveTest({"parser", "concrete", "syntax", "demo", "benchmark"}) 20 | public class ParserSyntaxDemoBenchmarkSuite { 21 | } 22 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/UnsupportedPattern.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class UnsupportedPattern extends StaticError { 17 | private static final long serialVersionUID = 3463736182521201443L; 18 | 19 | public UnsupportedPattern(String op, AbstractAST ast) { 20 | super(op + " is not allowed in patterns", ast); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/RedeclaredType.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class RedeclaredType extends StaticError { 17 | private static final long serialVersionUID = 4898431127235860576L; 18 | 19 | public RedeclaredType(String name, AbstractAST decl) { 20 | super("Illegal re-declaration of type: " + name, decl); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/NonAbstractJavaFunction.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.FunctionDeclaration; 15 | 16 | public class NonAbstractJavaFunction extends StaticError { 17 | private static final long serialVersionUID = -5754136192225457390L; 18 | 19 | public NonAbstractJavaFunction(FunctionDeclaration node) { 20 | super("Java function has a body", node); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/org/rascalmpl/library/lang/rascal/tests/concrete/PostParseFilter.rsc: -------------------------------------------------------------------------------- 1 | module lang::rascal::tests::concrete::PostParseFilter 2 | 3 | // copied from issue report #1210 4 | import Exception; 5 | import ParseTree; 6 | 7 | syntax X = a: A | b: B ; 8 | syntax A = "X" ; 9 | syntax B = "X" ; 10 | 11 | // Match a concrete pattern to have an X as return value. 12 | X amb({f:(X)``, *value _}) = f ; 13 | 14 | test bool t1() 15 | { 16 | try 17 | { 18 | // TODO: if allowAmbiguity=false one might expect this test to succeed as well, 19 | // but it doesn't because the rewrite rule is never executed before the exception 20 | // has been thrown already. See the discussion with issue #1210 21 | Tree t = parse( #X, "X", allowAmbiguity=true ) ; 22 | return true ; 23 | } 24 | catch Ambiguity( loc _, str _, str _ ): 25 | { 26 | Tree t = parse( #X, "X", allowAmbiguity=true ) ; 27 | assert /amb(_) !:= t : "Tree still contains an ambiguity node." ; 28 | return false ; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/PartiallyLabeledFields.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class PartiallyLabeledFields extends StaticError { 17 | private static final long serialVersionUID = 1156905929827375773L; 18 | 19 | public PartiallyLabeledFields(AbstractAST ast) { 20 | super("either all fields must be labeled, or none.", ast); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/uri/file/CWDURIResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | * * Paul Klint - Paul.Klint@cwi.nl - CWI 12 | * * Arnold Lankamp - Arnold.Lankamp@cwi.nl 13 | *******************************************************************************/ 14 | package org.rascalmpl.uri.file; 15 | 16 | /** 17 | * For reading and writing files relative to the current working directory. 18 | */ 19 | public class CWDURIResolver extends AliasedFileResolver { 20 | 21 | public CWDURIResolver() { 22 | super("cwd", System.getProperty("user.dir")); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /test/org/rascalmpl/test/AllSuite.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2012 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Davy Landman - Davy.Landman@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.test; 13 | 14 | import org.junit.runner.RunWith; 15 | import org.rascalmpl.test.infrastructure.RecursiveTest; 16 | import org.rascalmpl.test.infrastructure.RecursiveTestSuite; 17 | 18 | @RunWith(RecursiveTestSuite.class) 19 | @RecursiveTest({"basic", "concrete", "extend", "functionality", "imports", "library", "parser", "recovery", "syntax", "demo", "benchmark"}) 20 | public class AllSuite { 21 | } 22 | -------------------------------------------------------------------------------- /test/org/rascalmpl/util/maven/poms/range/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | 8 8 | 8 9 | 10 | 11 | 12 | range 13 | test 14 | 1.0 15 | 16 | 17 | 18 | range 19 | level1a 20 | 1.0 21 | 22 | 23 | range 24 | level1b 25 | 1.0 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/MissingTag.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | * * Paul Klint - Paul.Klint@cwi.nl - CWI 12 | *******************************************************************************/ 13 | package org.rascalmpl.interpreter.staticErrors; 14 | 15 | import org.rascalmpl.ast.AbstractAST; 16 | 17 | public class MissingTag extends StaticError { 18 | private static final long serialVersionUID = 8951799317606455150L; 19 | 20 | public MissingTag(String name, AbstractAST onWhat) { 21 | super("Missing tag: " + name, onWhat); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/NoKeywordParameters.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Paul Klint - Paul.Klint@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class NoKeywordParameters extends StaticError { 17 | public NoKeywordParameters(String name, AbstractAST ast) { 18 | super("function " + name + " cannot be called with keyword parameters", ast); 19 | } 20 | 21 | private static final long serialVersionUID = 7512965714991339935L; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/shell/RascalPackage.java: -------------------------------------------------------------------------------- 1 | package org.rascalmpl.shell; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.io.Writer; 6 | 7 | import org.rascalmpl.debug.IRascalMonitor; 8 | import org.rascalmpl.repl.streams.StreamUtil; 9 | 10 | public class RascalPackage extends AbstractCommandlineTool { 11 | public static void main(String[] args) throws IOException { 12 | RascalShell.setupJavaProcessForREPL(); 13 | 14 | var term = RascalShell.connectToTerminal(); 15 | var monitor = IRascalMonitor.buildConsoleMonitor(term); 16 | var err = (monitor instanceof Writer) ? StreamUtil.generateErrorStream(term, (Writer)monitor) : new PrintWriter(System.err, true); 17 | var out = (monitor instanceof PrintWriter) ? (PrintWriter) monitor : new PrintWriter(System.out, false); 18 | 19 | System.exit(main("lang::rascalcore::package::Packager", new String[] {"org/rascalmpl/compiler"}, args, term, monitor, err, out)); 20 | } 21 | } -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/IllegalQualifiedDeclaration.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | *******************************************************************************/ 12 | package org.rascalmpl.interpreter.staticErrors; 13 | 14 | import org.rascalmpl.ast.AbstractAST; 15 | 16 | public class IllegalQualifiedDeclaration extends StaticError { 17 | private static final long serialVersionUID = -2107466760568730273L; 18 | 19 | public IllegalQualifiedDeclaration(AbstractAST ast) { 20 | super("Declaration of qualified names is not allowed", ast); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/NonVoidTypeRequired.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | * * Paul Klint - Paul.Klint@cwi.nl - CWI 12 | *******************************************************************************/ 13 | package org.rascalmpl.interpreter.staticErrors; 14 | 15 | import org.rascalmpl.ast.AbstractAST; 16 | 17 | public class NonVoidTypeRequired extends StaticError { 18 | private static final long serialVersionUID = 6595223256368783269L; 19 | 20 | public NonVoidTypeRequired(AbstractAST ast) { 21 | super("Non-void type required", ast); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/org/rascalmpl/interpreter/staticErrors/NotEnumerable.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2011-2013 CWI 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | 10 | * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI 11 | * * Paul Klint - Paul.Klint@cwi.nl - CWI 12 | *******************************************************************************/ 13 | package org.rascalmpl.interpreter.staticErrors; 14 | 15 | import org.rascalmpl.ast.AbstractAST; 16 | 17 | public class NotEnumerable extends StaticError { 18 | public NotEnumerable(String type, AbstractAST ast) { 19 | super(type + " is not enumerable", ast); 20 | } 21 | 22 | private static final long serialVersionUID = 7512965714991339935L; 23 | 24 | } 25 | --------------------------------------------------------------------------------