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
2
votes
1 answer

Is there a way in Rascal to generate the syntax definition of a grammar from its corresponding datatype?

To make the question a little more specific. I was wondering if I could generate Rascal parseable code from the built-in grammar datastructure, which in turn is parsed rascal code of course. I would like this since it is easier readable and also a…
2
votes
1 answer

Setting line attributes for loc type in Rascal?

The syntax for a location (loc) is defined (according to tutor.rascal.org) as: | Uri | ( O, L, , ) where Uri is an arbitrary Uniform Resource Identifier (URI). O and L are integer expressions, where O gives the offset to the…
Micrified
  • 3,338
  • 4
  • 33
  • 59
2
votes
1 answer

Using foreign language APIs in Rascal?

Is there a way to invoke a foreign language API in Rascal? In particular, I've been thinking about the Stanford Core NLP that has a Java API.
Alexander Serebrenik
  • 3,567
  • 2
  • 16
  • 32
2
votes
1 answer

Is there a limit to the size of a regex match in Rascal?

In trying to match all multiline comments in a Java source file I run into a StackOverflow() error. It happens when the matched comment is pretty large. I've managed to more or less pinpoint the limit to 2500 characters, but this might be specific…
Ruben Steins
  • 2,782
  • 4
  • 27
  • 48
2
votes
1 answer

Comparing AST Nodes

For calculating duplication, I am parsing a java project into the AST. But when trying to compare the AST nodes, Declaration attributes such as src are compared too, which leads to the comparison failing. This change was introduced < 1 year ago…
Mazzy
  • 1,901
  • 2
  • 16
  • 36
2
votes
2 answers

How to do a list comprehension to a relation?

In my code I have the following two methods: public void AllDivisors(int max) { lrel[int,list[int]] div = [ | int i <- [0 .. max], list[int] d <- GetDivisors(i)]; println("
"); } public list[int] GetDivisors(int n) { …
Ruben Steins
  • 2,782
  • 4
  • 27
  • 48
2
votes
1 answer

Locating method/variable declaration in Java with Rascal

I am looking for a library or tools which offer functionality to build up a data structure which I can use to find variable or method declarations that are used in a class in another scope. example code: class A { public void methodA() { …
Patrick
  • 33
  • 5
2
votes
1 answer

Representing a class table in Rascal

I would like to represent a kind of class table (CT) as a singleton in Rascal, so that some transformations might refer to the same CT. Since not all transformations need to refer to the CT (and I prefer not to change the signature of the existing…
2
votes
1 answer

Replacement + Side effect

While visiting a compilation unit--- and given a certain condition- I would like to apply a transformation (using the => operator) and count the number of times the same transformation was applied for a given compilation unit. I was able to perform…
2
votes
1 answer

Expression precedence and disambiguation

I'm currently working on making Rust-lang parsable with Rascal. The originally used syntax is made for Bison and so I'm translating it to be usable. The stumbling blocks that I have reached are the expressions. Rust has four types of expressions in…
Adrian Z.
  • 904
  • 1
  • 12
  • 29
2
votes
1 answer

Java2OFG cannot find hashmap put call

My Program object from Java2OFG does not contain any hashmap put calls, but can find hashmap remove and containsValue calls. p =…
Kasper
  • 53
  • 7
2
votes
1 answer

Java2OFG cannot find methods being called in eLib?

For example, in Library.java, there is a HashMap users = new HashMap() and users.put (new Integer(user.getCode()), user);. So I expect the put() method to be in the following set but it returns empty. rascal> m =…
pyAdmin
  • 321
  • 4
  • 14
2
votes
1 answer

FlowProgram vs. Program

I'm trying to use the FlowGraphsAndClassDiagrams skeleton as provided to TU Eindhoven. For the function buildGraph a FlowProgram should be given. I tried to run the following: m = createM3FromEclipseProject(|project://eLib|); FlowProgram p =…
RikH
  • 2,994
  • 1
  • 16
  • 15
2
votes
1 answer

Figure doesn't show correct string on event

In the following code I create 3 boxes with the text 1 to 3, in a fourth box I'd like to show the text of the box my mouse is hovering over. So i set an onMouseEnter FProperty for each of the boxes where I change the string of the fourth box and…
Jurgy
  • 2,128
  • 1
  • 20
  • 33
2
votes
1 answer

How to remove whitespace from a string in Rascal?

When you have a string in Rascal like this: "\n\tThis is a specification of a toy Transaction.\n\tVia a transaction money can be transfered between two accounts\n" Or This is a specification of a toy Transaction. Via a transaction…