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

Does Rascal solve the expression pr0blem?

Data and functions in Rascal can scatter in different source files, and when imported are merged accordingly. In other words, Rascal supports open data and open functions. So Rascal solves the expression problem? Is it designed so as to do?
day
  • 2,292
  • 1
  • 20
  • 23
2
votes
1 answer

Is there a `quote`-like facility a la Lisp in Rascal

I know Rascal is intended to be a meta-language for other languages. Do these languages include Rascal itself? Is there any meta-facilities like quote a la Lisp available or planned?
day
  • 2,292
  • 1
  • 20
  • 23
2
votes
1 answer

Does Rascal do tail-call optimization?

Does Rascal do tail-call optimization? In particular, if I write code using tail recursion instead of those built-in loop construct, do I expect efficiency penalty?
day
  • 2,292
  • 1
  • 20
  • 23
2
votes
1 answer

Java 1.5 grammar doesn't build

Anybody get the java 1.5 grammar working in Rascal? https://raw.github.com/cwi-swat/rascal/master/src/org/rascalmpl/library/lang/java/syntax/Java15.rsc I get: $ java -jar rascal-0.5.1.jar Java15.rsc Disambiguate.rsc Parse error in cwd:///Java15.rsc…
Terence Parr
  • 5,912
  • 26
  • 32
2
votes
1 answer

Extracting the line and column number from a loc

I guess the titles says it all. In my program I have a bunch of loc's and I would like to extract the line numbers / column numbers from them. Is there a way to do this?
Richard Bos
  • 774
  • 5
  • 18
2
votes
1 answer

How do I define a generic (polymorphic) function in Rascal?

I would like to define a generic function to extract keys from a map, something like this: public list[K] keys(map[K,V] aMap) { return [ key | key:val <- aMap ]; } Although no syntax error is given, this does not work. Is there a way to do it?
2
votes
1 answer

Unexpected result of listcomprehension when "or" occurs in the restriction

The following result appears to me as a strange result. rascal> [x|int x<-[0..3],x==2||x==2]; list[int]: [2,2] I expected this. rascal> [x|int x<-[0..3],(x==2||x==2)?true:false]; list[int]: [2]
1
vote
1 answer

Not rendering Salix's counter example

Using the example given in Salix's github, I've been unable to correctly render the counter app. I have used the code provided to create the view, update and init functions. Then I have created the app using the following function. SalixApp[Model]…
Hyper445
  • 21
  • 2
1
vote
1 answer

Adding Newline Character to Rascal Syntax Definition

How do I add a newline character as part of Rascal’s Syntax Definition. I tried this but it doesn’t seem work. syntax Entity = @Foldable entity: "entity" Id name "{" {Field “\n”}+ fields "}" ; syntax Field = field: Id name ":" Type t ;
1
vote
1 answer

Debugger for RascalMPL

I want to know if there are work being to include a debugger in RascalMPL, if so when should I expect it. It would greatly improve the efficiency of the development of languages with rascal, thanks.
1
vote
1 answer

How do I separate a list of sorts by a new line?

Is there a way to define a list of Sorts separated by a newline? I tried using the following syntax: syntax Entity = entity: "entity" EntityName entityName {Attribute "\n"}* attribs "end" ; but it…
Wayne
  • 65
  • 7
1
vote
1 answer

How do you enforce Layout Constraints when defining syntax for languages like Python or YAML in Rascal?

Considering the following snippet, how do I define layout(indentation and alignment) constraints to disambiguate the mappings to the ": " operator as in the YAML specification start syntax Empty = ; start syntax Document = Block+; syntax Block =…
Wayne
  • 65
  • 7
1
vote
1 answer

Setting up the translation in RascalMPL

How do I setup the translation(source-to-source transformation) for my Rascal project? A link to any repository that shows how it is done will also be highly appreciated. :-)
1
vote
1 answer

UndeclaredJavaMethod: Trouble linking Java method from Rascal

I am having trouble linking a Java method in Rascal. I have two files: Func.rsc: module Func import Type; import lang::flybytes::Compiler; //other stuff @javaClass{Func} java void lalala(); //other stuff Func.java: import…
bys1
  • 15
  • 2
1
vote
2 answers

Collapse data structure

I want to remove the inner keywords attributes and elements such that the attributes and elements are part of the json object itself. Is there a way in doing this in Rascal for a json file. { "attributes": { "name": "\"physics\"" }, …