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

Rascal createM3FromEclipseProject with huge Java project

I'm completely new to rascal. I'm currently just trying some basic things on our project and a test project. On a test project the following works without a problem on the Rascal terminal: rascal>import lang::java::m3::Core; ok rascal>import…
Kevin Cruijssen
  • 9,153
  • 9
  • 61
  • 135
2
votes
1 answer

giving a name to a composite type in Rascal (a la typedef)

In Rascal, how do I introduce a name for a composite type (that's constructed from built-in basic types and type constructors like list and map)? E.g. I'd like to do something like typedef IntList = list[int]; typedef StrToIntList =…
Dennis
  • 171
  • 9
2
votes
1 answer

Save/load AST and M3 from/to file

Creating an AST, or a M3 can take some time depending on the size of the project you are trying to load. So is there a way to store the AST or M3 in a file? So next time you need it, you don't have to create it again since you can just load the…
Nicasso
  • 265
  • 1
  • 7
2
votes
1 answer

Convert logical to physical location

I have this logical location: |project://testProject/src/style.css| which I would like to convert to its related physical location. The location is first passed on to a Java file, where I try to convert it using the…
Nicasso
  • 265
  • 1
  • 7
2
votes
1 answer

Write even shorter visits

Is it possible to rewrite a visit like this to a single line by using a list comprehension or something similar? list[str] nodeNames = []; visit (ast) { case someNode(str name): { nodeNames += name; } };
Nicasso
  • 265
  • 1
  • 7
2
votes
1 answer

Custom Rascal location protocols for M3

The Java specific M3 has these pretty location protocols like java+method, java+enum, java+variable and many more. As far as I understand these pretty locations function as aliases for "real" locations like…
Nicasso
  • 265
  • 1
  • 7
2
votes
1 answer

Debug linked Java method

I have some issues with debugging Java code. I have a Rascal module from where I am calling a linked Java method. This Java method contains a couple of System.err.println statements like suggested here:…
Nicasso
  • 265
  • 1
  • 7
2
votes
1 answer

Parsing comment in Rascal

I have a very basic question about parsing a fragment that contains comment. First we import my favorite language, Pico: import lang::pico::\syntax::Main; Then we execute the following: parse(#Id,"a"); gives, as expected: Id: (Id)…
2
votes
1 answer

Print full path of location

I'm trying to print some stuff to a file from a Rascal program. So I build a location from the working dir using something like |cwd:///myFile|. However, I could not find the file, so I tried printing this path. But all I get is the same as what I…
2
votes
1 answer

M3 extraction modules for Java in Rascal Shell and VScode

Got some code that uses modules from lang, everything works fine within the Rascal console in Eclipse, but when I try to import it (import lang::java::jdt::m3::Core;) into the rascal-shell.jar it gives an error about a missing search…
Drime
  • 21
  • 2
2
votes
1 answer

Want "Menu" example--Pico demo fails

In looking for a working example of "Menu" for the DSL I am writing, I tried "Pico". But the following fails: rascal>import…
sailco12
  • 87
  • 5
2
votes
1 answer

Understanding the Rascal support for Java

Is it possible to parse Java files that are external to the eclipse environment? I have only realised operations related to obtaining an AST(s) from Eclipse file (or projects). Does the current version of Rascal support Java 8?
2
votes
1 answer

Removing ambiguities in grammar

I have a simple grammar I've constructed with a problem I'm not sure how to solve: start syntax Prog = prog: Type Id; syntax Dot = {Id "."}+ ; syntax Id = id: [A-Z_a-z] !>> [0-9A-Z_a-z] \ KW | Rv ; syntax Rv = rv: "$"…
josh
  • 1,544
  • 2
  • 16
  • 27
2
votes
1 answer

Syntax Highlighting when using special characters

I'm currently finishing up a mathematical DSL based on LaTeX code in Rascal. This means that I have a lot of special characters ({,},), for instance in the syntax shown below, the sum doesn't get highlighted unless I remove the \ and _{ from the…
rperz86
  • 135
  • 1
  • 5
2
votes
1 answer

Concrete Syntax Matching in Rascal

If I have: import demo::lang::Exp::Concrete::WithLayout::Syntax; if ((Exp)` + ` := (Exp)`5 + 6`) { println(e); } This prints 6. Is this a possible bug or a design decision, e.g. because of performance…