rascal icon indicating copy to clipboard operation
rascal copied to clipboard

Parser Generator crashes on double symbol labels

Open rodinaarssen opened this issue 3 years ago • 0 comments

To Reproduce

rascal>lexical A = [a]+;
ok
rascal>start syntax S = A aa bb;
ok
rascal>parse(#start[S], "aaaa")
org.rascalmpl.exceptions.ImplementationError: Unexpected error in Rascal interpreter: parser generator: |std:///lang/rascal/grammar/ParserGenerator.rsc|:557,41: "unexpected symbol label(\"aa\",lex(\"A\",id=21),id=22) while generating parser code"      at sym2newitem(|std:///lang/rascal/grammar/ParserGenerator.rsc|(18459,7439,<454,0>,<559,1>))
        at generateNewItems(|std:///lang/rascal/grammar/ParserGenerator.rsc|(13681,44,<298,35>,<298,79>))
        at newGenerate(|std:///lang/rascal/grammar/ParserGenerator.rsc|(2771,21,<74,15>,<74,36>))
        at $parsergenerator$(|main://$parsergenerator$|)

(internal error)
        at $shell$(|main://$shell$|)

org.rascalmpl.exceptions.ImplementationError: Unexpected error in Rascal interpreter: parser generator: |std:///lang/rascal/grammar/ParserGenerator.rsc|:557,41: "unexpected symbol label(\"aa\",lex(\"A\",id=21),id=22) while generating parser code"      at sym2newitem(|std:///lang/rascal/grammar/ParserGenerator.rsc|(18459,7439,<454,0>,<559,1>))
        at generateNewItems(|std:///lang/rascal/grammar/ParserGenerator.rsc|(13681,44,<298,35>,<298,79>))
        at newGenerate(|std:///lang/rascal/grammar/ParserGenerator.rsc|(2771,21,<74,15>,<74,36>))
        at $parsergenerator$(|main://$parsergenerator$|)

        at org.rascalmpl.parser.ParserGenerator.getNewParser(ParserGenerator.java:265)
        at org.rascalmpl.parser.ParserGenerator.getNewParser(ParserGenerator.java:223)
        at org.rascalmpl.semantics.dynamic.Import.getParser(Import.java:582)
        at org.rascalmpl.interpreter.Evaluator.getObjectParser(Evaluator.java:773)
        at org.rascalmpl.interpreter.Evaluator.parseObject(Evaluator.java:722)
        at org.rascalmpl.interpreter.Evaluator.parseObject(Evaluator.java:125)
        at org.rascalmpl.values.RascalFunctionValueFactory$ParseFunction.parse(RascalFunctionValueFactory.java:252)
        at org.rascalmpl.values.RascalFunctionValueFactory$ParseFunction.apply(RascalFunctionValueFactory.java:230)
        at org.rascalmpl.values.RascalFunctionValueFactory$ParseFunction.apply(RascalFunctionValueFactory.java:191)
        at org.rascalmpl.values.RascalFunctionValueFactory$RascalFunctionValue.call(RascalFunctionValueFactory.java:129)
        at org.rascalmpl.interpreter.result.FunctionResultFacade.call(FunctionResultFacade.java:54)
        at org.rascalmpl.semantics.dynamic.Expression$CallOrTree.interpret(Expression.java:535)
        at org.rascalmpl.semantics.dynamic.Statement$Expression.interpret(Statement.java:365)
        at org.rascalmpl.semantics.dynamic.Statement$Return.interpret(Statement.java:782)
        at org.rascalmpl.interpreter.result.RascalFunction.runBody(RascalFunction.java:388)
        at org.rascalmpl.interpreter.result.RascalFunction.call(RascalFunction.java:329)
        at org.rascalmpl.interpreter.result.OverloadedFunction.callWith(OverloadedFunction.java:410)
        at org.rascalmpl.interpreter.result.OverloadedFunction.call(OverloadedFunction.java:370)
        at org.rascalmpl.semantics.dynamic.Expression$CallOrTree.interpret(Expression.java:535)
        at org.rascalmpl.semantics.dynamic.Command$Expression.interpret(Command.java:61)
        at org.rascalmpl.interpreter.Evaluator.eval(Evaluator.java:1106)
        at org.rascalmpl.interpreter.Evaluator.eval(Evaluator.java:976)
        at org.rascalmpl.interpreter.Evaluator.eval(Evaluator.java:931)
        at org.rascalmpl.repl.RascalInterpreterREPL.evalStatement(RascalInterpreterREPL.java:131)
        at org.rascalmpl.repl.BaseRascalREPL.handleInput(BaseRascalREPL.java:106)
        at org.rascalmpl.vscode.lsp.terminal.LSPTerminalREPL$1.handleInput(LSPTerminalREPL.java:183)
        at org.rascalmpl.repl.BaseREPL.handleInput(BaseREPL.java:180)
        at org.rascalmpl.repl.BaseREPL.run(BaseREPL.java:347)
        at org.rascalmpl.vscode.lsp.terminal.LSPTerminalREPL.main(LSPTerminalREPL.java:252)

ok

Expected behavior I would expect the parser generator not to crash. Additionally, the typechecker could issue a warning for the double label.

Desktop (please complete the following information):

  • Context: VSCode
  • Rascal Version: 0.22.1

rodinaarssen avatar Feb 07 '22 09:02 rodinaarssen