Questions tagged [rascal]

Rascal is an experimental domain specific language for metaprogramming, such as static code analysis, program transformation and implementation of domain specific languages. It includes primitives from relational calculus and term rewriting. Its syntax and semantics are based on procedural (imperative) and functional programming.

Rascal is an experimental domain specific language (DSL) for arbitrary meta-programming, such as static code analysis, program transformation and implementation of domain specific languages. It includes primitives from relational calculus and term rewriting. Its syntax and semantics are based on procedural (imperative) and functional programming. Rascal is not limited to a particular object language, rather it has generic support for manipulating all languages and targeted libraries for specific languages.

Links to more information:

455 questions
0
votes
1 answer

Yield of a (sub)parse tree in Rascal

How can I obtain the yield of (sub)parse tree in Rascal, i.e., the text that is associated to a subtree? For ex., during a visit I encounter a Declaration (with Java/M3) and now I want to get the text of this declaration. I have tried "unparse", but…
0
votes
1 answer

Expressing a polymorphic behavior with Rascal, and Java-like recursion with Rascal

Say I have a data type defined as follows: data Constraint=type1(Lab al,Lab a2)| type2(Lab a1,TypeRoot tt)|.... where the general pattern is that the first argument of each constructor is of type 'Lab'. Is there then, an efficient/clear way of…
apil.tamang
  • 2,545
  • 7
  • 29
  • 40
0
votes
2 answers

How would I initialize an empty relation and add elements to it in Rascal?

As simple as it seems, how do I initialize an empty relation (of type say, [str,int]), then add new elements to it? An approximate Rascal code: rel[str,int] myReln={}; myReln.add(<"a",1>); Samples for remove/modify operations would also be…
apil.tamang
  • 2,545
  • 7
  • 29
  • 40
0
votes
2 answers

cannot traverse the nodes of an AST, while assigning each node an ID

This is more a simple personal attempt to understand what goes on inside Rascal. There must be better (if not already supported) solution. Here's the code: fileLoad =…
apil.tamang
  • 2,545
  • 7
  • 29
  • 40
0
votes
2 answers

Parsing CSV file with dynamic separator

I try to solve the following parsing problem, but I fail: I have a CSV file that with a certain command inside the file can change separators, and the current separator can be escaped with a slash. Look at this…
Jasper
  • 478
  • 6
  • 19
0
votes
1 answer

Can't launch Rascal files in Eclipse: 'no such java method: org.rascalmpl.library.Prelude.remove'

When trying to run any rascal file in eclipse (by right-clicking on file in Rascal Navigator and pressing Run as → Rascal Application), I get this error An internal error occurred during: "Launching Hello.rsc". No such Java…
Guildenstern
  • 2,179
  • 1
  • 17
  • 39
0
votes
1 answer

How does syntax coloring work

What is the right way of doing syntax coloring in a grammar? I believe it was like this: syntax MappingName = @category="Constant" mappingname: Id mapping; But it doesn't work for me. The file is just black text without parse errors (and it is…
Jasper
  • 478
  • 6
  • 19
0
votes
1 answer

Integrating a Rascal project with a Java Project

I developed a code generator in Rascal and I want to integrate it with a tool developed in Java. I tried to generate a jar file for the Rascal project with eclipse to put into the Java project, but it just puts the Rascal files of the project into…
0
votes
2 answers

Analyzing Java code across Eclipse projects

We want to use Rascal to find all unused public methods in a collection of Java projects in an Eclipse workspace. I have just learned how to create a model of a Java project in Eclipse using createM3FromEclipseProject and navigate that. But this…
0
votes
1 answer

How to express SDF2 permutation phrase syntax (<<..>>) in Rascal syntax specifications

I am attempting the specification of VS COBOL II using Rascal. There are many constructs in COBOL that have so called permutation phrases which are handled in SDF directly with the permutation phrase syntax <<..>>. I have not been able to find how…
0
votes
1 answer

margin characters in string with interpolation

Inside a string literal, the margin character (a single quote) indicates that the initial part of the line, before the margin character, should be ignored. Is there a complementary "right-margin" character, that indicates that everything after it on…
Dennis
  • 171
  • 9
0
votes
1 answer

Equal objects with different identity?

Is it possible in Rascal to create clones of an object with different identity so that they are equal but not identical?
day
  • 2,292
  • 1
  • 20
  • 23
0
votes
1 answer

Position of a node?

Rascal is rooted in term rewriting. Does it have built-in support for term/node position as commonly defined in term rewriting so that I can query for the position of a sub-term inside a term or the other way around?
day
  • 2,292
  • 1
  • 20
  • 23
0
votes
1 answer

Rascal/Eclipse integration error (Unable to load Rascal perspective in Eclipse Kepler)

I installed Eclipse and Rascal as explained on the Rascal download page (http://www.rascal-mpl.org/start/). However, when I open the Rascal perspective I get the following error in the Rascal Navigator: "Failed to create the part's…
Jeroen Peeters
  • 1,974
  • 1
  • 20
  • 24
0
votes
1 answer

Where can I get the Java analysis libraries for the Rascal REPL

I've developed a Rascal program using Eclipse, but I'd like to be able to run it in the REPL. When I try to import some required libraries, I get error like this one: |prompt:///|(0,33,<1,0>,<1,33>): Could not import module…
1 2 3
30
31