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
81 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
0 answers
111 views

Navigating to a source location from within code

In a Rascal terminal a source location is clickable. This will result in navigating to the location and highlighting the code encompassed by the location. I was wondering how one would achieve ...
Y. Reijne's user avatar
2 votes
0 answers
175 views

CodeMirror is not updated source on change

I am creating a salix webapp and I am trying to use codeMirror as per the salix examples. I am unable to execute the codeMirror example in the salix.demo.basic, even though I can easily execute all ...
GeorgiaS's user avatar
2 votes
0 answers
61 views

Rascal : NullPointerException at createM3FromEclipseProject

The following code with Rascal will not work: module Exercise1 import IO; import IO; import lang::java::jdt::m3::Core; public void testing() { M3 model = createM3FromEclipseProject(|project://...
Andy's user avatar
  • 21
2 votes
1 answer
175 views

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 ...
Drime's user avatar
  • 21
2 votes
1 answer
141 views

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] \ ...
josh's user avatar
  • 1,554
2 votes
0 answers
128 views

Java AST to .java file Rascal

I am wondering if there are mechanics in place to translate from a Java AST back to a Java source file inside the lang::java::m3 library. thanks!
josh's user avatar
  • 1,554
1 vote
0 answers
22 views

Stackoverflow in RascalMPL

I was encountered an exception while testing pretty printer module in rascal: java.lang.StackOverflowErrorjava.lang.StackOverflowError java.lang.StackOverflowError ...
Pius Arhanbhunde's user avatar
1 vote
0 answers
42 views

Does M3 AST support Java 8 features?

When retrieving the ASTs from projects in Java 8 or above, lambda expressions lead to a null value in the AST. It also seems that there is no AST node for lambda expressions. Does this mean that the ...
steffan's user avatar
  • 11
1 vote
1 answer
33 views

Fail translation with typing error in RascalMPL

I am currently working with TypePal for static typing of a DSL. What is a good practice on how to wire up my code generation script, such that if the checker finds error it should fail to proceed to ...
Pius Arhanbhunde's user avatar
1 vote
1 answer
53 views

Automated generation of pretty-printer in Rascal

Can RascalMPL automatically generate pretty printer for a language? if not, what is the feasibility of this functionality within RascalMPL?
Pius Arhanbhunde's user avatar
1 vote
0 answers
50 views

Error Reporting when translating between ASTs

I'm doing some translations between two ADTs but when I use data types that don't exist in the current scope it doesn't throw any errors, any suggestions on how to fix this? EDIT: Context: Say I have ...
Wayne's user avatar
  • 99
1 vote
0 answers
71 views

Java compilation failed during syntax definition using rascalMPL due to code too large

I keep getting a "Java compilation failed due to code too large" error when I try to parse my grammar. I am trying to implement an sql grammar and have looked through my syntax definition ...
Jezry Iredia's user avatar
1 vote
1 answer
93 views

RascalMPL and Rust Lang Interoperation

I want to implement a CLI(command-line interface) in rust-lang to drive a rascal language project for reverse engineering and code generation, how do you advice I go about it? Links to projects, ...
Pius Arhanbhunde's user avatar
1 vote
1 answer
50 views

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.
Pius Arhanbhunde's user avatar
1 vote
1 answer
48 views

Parse error on pattern matching rexpMatch function

I am trying to pass a regex argument as string and use that string with rexpMatch(). However it looks like the rexpMatch does not support escape characters. Is there a workaround for rascal v0.18.2? ...
Bright's user avatar
  • 11
1 vote
1 answer
54 views

Errors when using parseCpp to parse C++ files

I am trying to use Clair and Rascal to analyze C++ files. I followed the instructions on the Github page of Clair to add Clair to an empty Rascal project. After importing the required modules ...
RH07's user avatar
  • 11
1 vote
1 answer
135 views

Lexical and Module Scoping in Rascal

How do I implement the lexical and module scoping in the rascal language workbench? I need to implement lexical and module scoping within a DSL, please materials/code repository on how that is done in ...
Pius Arhanbhunde's user avatar
1 vote
0 answers
46 views

Error Reading JSON with Rascal with multiple constructors

The following code: import lang::json::IO; data Field = field(map[str, str]); data Block = null() | block(str \type) | block(str \type, str id) | block(str \type, ...
Koen Van Wijk's user avatar
1 vote
1 answer
70 views

Using java in rascal

I have made a java function genImage(List<String lines) which is located in class vis. I am trying to import it into my rascal code, but it won't work. This is the last of my efforts to import it: @...
Samiir Yusuf's user avatar
1 vote
1 answer
61 views

Documentation: list of operators

Is there somewhere I can find a list of operators. If "+", "-", "/", "%", "==", "<=", "<",... and even "<-" are common to most languages, there are some like "::", "| (ADT)", "| (Set)" or "...
AlainD's user avatar
  • 6,266
1 vote
0 answers
111 views

How to make URI locations from AST to map on a file read

In ClaiR it is not (yet) possible to write changes made in the AST back to file. For this reason, I create a list lrel[int, int, str] changes = []; with startposition and endposition of the substring ...
Matty's user avatar
  • 134
1 vote
1 answer
457 views

How to use context free grammars?

Could someone help me with using context free grammars. Up until now I've used regular expressions to remove comments, block comments and empty lines from a string so that it can be used to count the ...
Bob's user avatar
  • 149
1 vote
0 answers
91 views

Java M3 declaration nodes with unknown source location

Whilst attempting to perform AST based type 2 clone detection, I encountered the following: class TestEnum { enum Level { LOW, MEDIUM, HIGH } } When visiting the AST ...
M.J. van Keulen's user avatar
1 vote
1 answer
61 views

Removing CST branch during visit

I have a syntax containing this expression: {Binding ","}+ At some points, I would like to remove Binding based on their value. Is there a simple way of doing this inside a visit expression?
Jérôme Fink's user avatar
1 vote
1 answer
135 views

Rascal: parsing string with multiple "_"s

I try to parse a string containing multiple "_"s, but I get a CallFailed exception. I have tried to create a small as possible example of the problem syntax. layout Layout = WhitespaceAndComment* !&...
Matty's user avatar
  • 134
1 vote
1 answer
171 views

unexplained IllegalArgument during invocation of `implode`

I tried to make a DSL in Rascal for a subset of the cmake language, but there is an IllegalArgument exception during the call to implode which is hard to debug. CMake.rsc: module CMake import util::...
Matty's user avatar
  • 134
1 vote
1 answer
222 views

Rascal Eclipse plugin installation error: "Rascal needs a Java Development Kit (JDK)"

I am trying to install Rascal, but I get an error while doing so. I followed the instructions at https://www.rascal-mpl.org/start/ installed the second latest Java 1.8 SDK version 191 installed the ...
dohdoc's user avatar
  • 11
1 vote
0 answers
178 views

How can I compile Rascal into a stand-alone command-line executable?

I am in need of creating compiled, stand-alone, command-line, terminal-I/O, old-style-Unix executables from Rascal source code. I do realize that the proper question might have to include "modulo ...
eh9's user avatar
  • 7,390
1 vote
1 answer
138 views

How can you import from outside a project in Rascal?

Is there a way to import rascal modules from other rascal projects in your eclipse work-space? If so, how?
Tom Warmoes's user avatar
1 vote
0 answers
66 views

Pretty print for Java

I am trying to change the content of a .java file I got the AST thanks to: ast = createAstFromFile(|project://foo/src/main/Main.java|,true); ast = doSomeChanges(ast); Then I want to serialize the ...
Fabien Coulon's user avatar
1 vote
1 answer
104 views

Outliner for java files

With the help of util::IDE library it is possible to create your own IDE features in Eclipse e.g. outliners or annotators. The documentation shows an example of how to do this for your own language. ...
Z3ph1r's user avatar
  • 31
1 vote
1 answer
161 views

Offset in method location

I have a location |project://SmallSQL/src/smallsql/database/SQLParser.java|(10257,10257,<305,60>,<371,5>). However, because the line final class SQLParser { appears to be on line 39, ...
Olaf Maathuis's user avatar
1 vote
1 answer
203 views

Rascal-MPL example for C90 code analysis

I played with some PICO and Java examples for static analysis in Rascal-MPL, but I found no examples for C (C90). I noticed there is a "lang::c90::\syntax::C", but I found no examples how to use it.
Rafael Diniz's user avatar
1 vote
1 answer
84 views

interactive zoom in rendered figure

After generating and displaying a large figure using vis::Figure and vis::Render, is there a way to interactively zoom out/in, in the Eclipse window showing the figure? I tried <Control>+<...
Dennis's user avatar
  • 171
1 vote
1 answer
179 views

Handling reserved keywords depends on the lexical definition

My question is about handling reserved keywords in Rascal syntax definitions. Take the following Rascal module, which has been derived from the on-line documentation: module Test // Taken from http://...
Steven Klusener's user avatar
1 vote
1 answer
103 views

Expected rel[loc,loc] (...), but got rel[loc,loc], what does rel[loc,loc](...) mean?

I just tested my code to build the dot diagram, when I tried to union two relations together and passed the the sumed up relation, following error is reported: Expected rel[loc,loc] (...), but got ...
Wulipapa's user avatar
  • 105
1 vote
2 answers
246 views

How to construct a location?

I have a simple question. Suppose I have a location loc l = |file:////Users/steven/tst.txt|; and I want to make it more detailled, by selecting line 5 - 10. How do I do that? Simply stating l....
Steven Klusener's user avatar
1 vote
0 answers
129 views

pack figure doesn't work with computeFigure

I seem to have a problem with the pack-figure and using computeFigure. Below is some code to reproduce the behaviour I have. public void main() { bool redraw = false; str boxWidthProp = ""; ...
Aipie's user avatar
  • 105
1 vote
0 answers
237 views

Pretty printing a Java Compilation Unit in Rascal

I have implemented a Rascal function that receives a CompilationUnit, performs some Java transformations, and then returns the resulting CompilationUnit (from lang::java::m3::AST). Is there any ...
Rodrigo Bonifacio's user avatar
1 vote
2 answers
62 views

Location undefined for certain cases?

Suppose we have a function that extracts the line numbers of the lines that contain at least one statement. We apply a visit over most cases of data Statement in lang::java::m3::AST: set[int] ...
Steven Klusener's user avatar
1 vote
0 answers
24 views

addMessageMarkers from util::ResourceMarkers is very slow

The method addMessageMarkers from util::ResourceMarkers is very slow; adding one message may take several seconds. Take the Java project HelloWorld with one Java file: public class HelloWorld { ...
Steven Klusener's user avatar
1 vote
2 answers
57 views

How to construct a consistent location?

A typical location is constructed as follows: |URI|(offset,length,<begin_line,begin_col>,<end_line,end_col>) There is a relation between offset and <begin_line,begin_col>, as ...
Steven Klusener's user avatar
1 vote
0 answers
96 views

Can't import Render module in Rascal

I am trying to import the Render module as described in: http://tutor.rascal-mpl.org/Recipes/Recipes.html#/Recipes/Visualization/ParseTree/ParseTree.html rascal>import ParseTree; ok rascal>...
josh's user avatar
  • 1,554
1 vote
1 answer
99 views

creating createM3FromEclipseProject in Rascal creates no data

I'm new to Rascal and have a very very basic question. I'm using in a little test project the follwing command : createM3FromEclipseProject(|project://example-project|); and uses the code to ...
dod101's user avatar
  • 11
1 vote
2 answers
293 views

Eclipse for RCP and RAP Developers: Juno Service Release 2

I am able to execute Rascal programs, but I am getting this trace of errors and warnings only by opening the perpective (I do not even know if the errors are related). There are one warning and two ...
user3322649's user avatar
1 vote
1 answer
91 views

Where do I find out which anonymous classes implement an interface in M3?

I am using Rascal to detect polymorphic types (with > 1 implementation) via the M3 model. In JHotDraw 6 (http://www.jhotdraw.org/) there is an interface org::jhotdraw::framework::ViewChangeListener ...
Oscar Nierstrasz's user avatar
1 vote
0 answers
221 views

Does Rascal Java method AST also contain super() Expression for calls to super with arguments?

When I look at Java method AST declaration in Rascal, I see under Expression \super() node. However in Java, you can also call super() with parameters. So, I expected to see something like : \super(...
caytekin's user avatar
  • 171
1 vote
0 answers
83 views

M3 enumerators don't have their own scheme?

While working with M3 models, we had a discussion on enumerators within the M3 model. While it is possible to get the enumerators contained in the M3 model by checking the @extends annotation for '...
Omar007's user avatar
  • 11
1 vote
3 answers
59 views

Rascal: resolve ambiguity with comment

Consider the following grammar: module Tst lexical Id = [a-z][a-z0-9]* !>> [a-z0-9]; layout Layout = WhitespaceAndComment* !>> [\ \t\n\r]; lexical WhitespaceAndComment = [\ \t\n\...
Steven Klusener's user avatar
0 votes
0 answers
19 views

Git actions with RascalMPL

How can I setup github actions in my rascal project, I saw something like that in the cwi-swat/python project, I wanted to know how to set that up? Any resource will be appreciated.
Pius Arhanbhunde's user avatar