I have the following Rascal module:
module foo
import IO;
import ParseTree;
extend lang::std::Layout;
lexical CHAR = [ab];
start syntax CharList = CHAR hd (',' CHAR)+ tl ';';
My question is how to get to the individual elements of the tl
part, after having parsed something. E.g.:
rascal>import foo;
ok
rascal>pt = parse(#start[CharList], "a, b;");
start[CharList]: `a, b;`
Tree: appl(...
rascal>pt.top.tl;
(',' CHAR)+: `, b`
Tree: appl(regular(...
Now how do I access the , b
element?
pt.top.tl[0] seems not to be the right way.
Thanks for any help.