Mauro
Mauro

Reputation: 31

CallFailed error on parse

I am a intern trying to write my first Syntax using Rascal.
While programming i ran into an error that my tutor, Riemer van Rozen, had never seen before. At the moment i am still trying to see if the problem is my code or a Rascal bug but i felt like i should report the error here.

The syntax used to parse normally and even after putting the code back the way it was before I added new stuff it still gives the same error.

My Syntax file

module Syntax

lexical Natural = [0-9]+ !>> [0-9] ;
lexical ID = [a-zA-Z][a-z0-9A-Z]* !>> [a-z0-9A-Z];
lexical String = "\"" ![\"]* "\"";
lexical Sym = [a-zA-Z.!@#$%^&*];
lexical Mp = Sym*;

layout WhiteSpace = [\t-\n \r]* ;

start syntax CreatorData
    = title: "title " ID title
    | author: "author " ID author
    | homepage: "homepage " ID homepage;

Parser

module Parser

import Syntax;
import AST;
import ParseTree;

public CreatorData load(str txt) = parse(#CreatorData, txt);

The Error

The Error

I hope someone can tell me where i am breaking my program or that i pointed out an unknown Rascal bug.

Upvotes: 2

Views: 252

Answers (1)

Davy Landman
Davy Landman

Reputation: 15438

Call failed means that the call of parse failed, since the arguments you supplied, did not match any of the possible overloads of parse.

For your code, it looks like you also have an ADT called CreatorData. This is overlapping with the CreatorData syntax definition. There is a pattern documented in the tutor how to work around this challenge.

Not sure about your case, but often you can skip the ADT form, and just work on the concrete trees, but that might be something to explore in the future.

Upvotes: 1

Related Questions