rascal - Using a map type in Abstract Syntax -
i looking abstract part of parse tree map. want concrete this:
syntax rectype = record: "{" {(ident "=" num) ";"}* "}" where let's ident , num , str , int, respectively.
to abstracted like:
public data rectype = record(map[str, int] rec); is is possible? getting constructor errors this.
thanks!
you have 2 questions:
- why doesn't definition work?
the names production in grammar have start lower case character, avoid ambiguities in writing reject rules. (similarly, names symbols have start upper case character). - how translate parse tree ast?
haveimplodefunction can use translate parse tree ast. ast has closely model grammar. if i'm correct, won't translate key-value pairs map. have manually write transformation desired ast. (it's not hard, check out this recipe example)
Comments
Post a Comment