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

How can find what is included in the @containment annotation?

How can find what is included in the @containment annotation? I can not find that in the documentation online, that refers only to grammar-spec and nothing more? I'm talking about trying to obtain information/facts from the M3 model.. As an…
dod101
  • 11
  • 2
0
votes
1 answer

rascal freezes when I am trying to debug a program

occassionally, and without a specific pattern, I run into a situation where the rascal interpreter does not proceed with a debugging session. In the progress window, I get the message: Reconnecting importers of affected modules: running command.…
apil.tamang
  • 2,545
  • 7
  • 29
  • 40
0
votes
0 answers

Different results running same code from rascal-eclipse and rascal-shell

When I run the following code in Rascal I get different results. module t01 import IO; import lang::java::m3::AST; public void main() { Declaration d; println("Hello."); } If I run it from Rascal Eclipse I get this result: rascal>import…
chentz
  • 11
  • 1
0
votes
2 answers

Pattern matching AST nodes in Rascal

I have the following AST definition: data Exp = app(Exp fun, Exp body) | var(str name) | nat(int nat) | func(list[str] formal, Exp body) | cond(Exp cond, Exp then, list[tuple[Exp,Exp]] elifs, Exp otherwise) | let(list[str]…
josh
  • 1,544
  • 2
  • 16
  • 27
0
votes
1 answer

Rascal: get-annotation not supported on value, when clearly, there's a corresponding @lab annotation

Here's the output from the console, Debug print.. exprNode( assign( var(name(name("alpha")))[ @at=|file:///Users/apil/Dropbox/Scripts/Class_Based_Analysis/SimpleClass_CopyObject.php|(56,6,<9,0>,<9,0>), @scope="scope"("","","",""), …
apil.tamang
  • 2,545
  • 7
  • 29
  • 40
0
votes
1 answer

Why are redundant parenthesis not allowed in syntax definitions?

This syntax module is syntactically valid: module mod1 syntax Empty = ; And so is this one, which should be an equivalent grammar to the previous one: module mod2 syntax Empty = ( ) ; (The resulting parser accepts only empty…
Guildenstern
  • 2,179
  • 1
  • 17
  • 39
0
votes
1 answer

Accessing downstream annotations of a node in Rascal

Simple question: in Rascal how does one access annotations of descendants of a node? GetTraversalContextNodes() returns upstream nodes -- "myContext[-1]" doesn't work. getChildren() returns a list of children, but the list is a list of values. …
Steve
  • 17
  • 2
0
votes
2 answers

How to select combo item?

Assume I have combo(["A","B","C","D"]) How can I select item B. Is there a property like selectIndex(2) or selectItem("B") ? I could not find such property.
robert
  • 1,921
  • 2
  • 17
  • 27
0
votes
1 answer

Incrementing offset of Location and clicking on location

I got a problem on clicking locations. The thing I do is creating a AST from a method with the function: getMethodASTEclipse(method, model=projectModel); where method is just an instance of methods(projectModel); When I visit that tree and want…
Karl-John Chow
  • 775
  • 2
  • 8
  • 26
0
votes
2 answers

Best way of Stacks in Rascal?

I am sure Rascal has built in support for Stack (e.g. for expression eval via stack push/pop), but I cannot find anything. So I now use this. However is there a nicer way? list stack = []; pop: value = stack[size(stack)-1]; stack = stack -…
robert
  • 1,921
  • 2
  • 17
  • 27
0
votes
2 answers

How can I see what the default value of a visit is?

Assume I have: visit(p) { case ... default: println("This should not happen. All elements should be catched. Check: "); }; How can I print out (in this case as x) what could not be matched? I…
robert
  • 1,921
  • 2
  • 17
  • 27
0
votes
1 answer

Length in bytes of a String

Is there a function in the Rascal Lib where I get the length in bytes of a String? A bit similar as the getFileLength() function in IO. I need it for setting an offset in a Location value.
0
votes
2 answers

Problems with layouting boxes in Rascal

I have big problems with layouting dynamic generated Figures with figures in figures. I expect the following: If I specifiy size() for a figure the figure will never get smaller. This is in the contract of size property. if I do pack it will…
robert
  • 1,921
  • 2
  • 17
  • 27
0
votes
1 answer

change properties of an element in a set and put it back in the set

Here's the problem, Suppose we have a datatype, and a set of the datatype: data Color=red(int n, str name)|black(int n, str name); set[Color] coloredBalls={red(1,"a"), red(2,"b")}; I would like to iterate through the elements of the set and change…
apil.tamang
  • 2,545
  • 7
  • 29
  • 40
0
votes
1 answer

deleting elements from a list and/or a set

I have a situation where I defined a couple of module-level instance variables using the 'private' scope identifier. I require to do this because these variables will be used in several functions within the module. Also, some of these variables are…
apil.tamang
  • 2,545
  • 7
  • 29
  • 40