Project

General

Profile

Bug #6330

java.util.NoSuchElementException: can't look backwards more than one token in this stream

Added by Alexander Kamkin almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Andrei Tatarnikov
Category:
-
Target version:
Start date:
10/07/2015
Due date:
% Done:

100%

Estimated time:
Detected in build:
svn
Platform:
Published in build:
2.3.5

Description

type HWORD = card(16)

type INT   = int(32)
type LONG  = int(64)

reg GPR [32, DWORD]

mode R (i : card(5)) = GPR[i]
  syntax = format("r%d", i)

op lui (rt: R, immediate: HWORD)
  syntax = format("lui %s, 0x%x", rt.syntax, immediate)
  action = {
    rt = coerse(LONG, (coerse(INT, immedidate) << 16));
  }
java.util.NoSuchElementException: can't look backwards more than one token in this stream
    at org.antlr.runtime.misc.LookaheadStream.LB(LookaheadStream.java:159)
    at org.antlr.runtime.misc.LookaheadStream.LT(LookaheadStream.java:120)
    at org.antlr.runtime.RecognitionException.extractInformationFromTreeNodeStream(RecognitionException.java:144)
    at org.antlr.runtime.RecognitionException.<init>(RecognitionException.java:111)
    at org.antlr.runtime.NoViableAltException.<init>(NoViableAltException.java:43)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.locationExpr(NmlTreeWalker.java:5696)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.atom(NmlTreeWalker.java:5522)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.numExpr(NmlTreeWalker.java:4648)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.expr(NmlTreeWalker.java:4255)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.dataExpr(NmlTreeWalker.java:4179)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.assignmentStatement(NmlTreeWalker.java:3463)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.statement(NmlTreeWalker.java:2997)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.sequence(NmlTreeWalker.java:2876)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.actionDef(NmlTreeWalker.java:2350)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.attrDef(NmlTreeWalker.java:2078)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.attrDefList(NmlTreeWalker.java:1934)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.opSpecPart(NmlTreeWalker.java:1582)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.opDef(NmlTreeWalker.java:1498)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.procSpec(NmlTreeWalker.java:380)
    at ru.ispras.microtesk.translator.nml.grammar.NmlTreeWalker.startRule(NmlTreeWalker.java:217)
    at ru.ispras.microtesk.translator.nml.NmlTranslator.startParserAndWalker(NmlTranslator.java:126)
    at ru.ispras.microtesk.translator.nml.NmlTranslator.start(NmlTranslator.java:160)
    at ru.ispras.microtesk.translator.Translator.start(Translator.java:97)
    at ru.ispras.microtesk.MicroTESK.translate(MicroTESK.java:141)
    at ru.ispras.microtesk.MicroTESK.main(MicroTESK.java:74)

History

#1

Updated by Andrei Tatarnikov almost 5 years ago

  • Status changed from New to Resolved

r5294 - better error handling is provided.

Three are 2 errors:
1. immedidate -> immediate. Now handled well.
2. coerse -> coerce. Added error reporting. The issue is that there are unused syntax rules in common grammar (used only by MMU) which can be called as result of a coding mistakes in nML specifications. In such situations, ANTLR can come to an invalid state and throw an exception.

In future, grammar needs to be revisited to avoid such issues.

#2

Updated by Andrei Tatarnikov almost 5 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Published in build set to 2.3.5

Also available in: Atom PDF