0

I am using jison and I saw the documentation of ebnf grammars but I can't make my grammar works: Here are the images of my grammar, input and error In the error, the grammar is recognizing just one line but kleen star should recognize 0 to several instances. I am new in jison so maybe the way to use ebnf is not as i'm doing it, if you can help i'd be so grateful

The minimal complete version of my grammar:

METODO

: 'void' id '(' ')' '{' INSTR '}'
;

INSTR

: INSTRUCCION*
;

INSTRUCCION

: IF
| id '=' EXP ';'
| id ':' INSTR
;

Input:


void metodo_1(){

t2 = p + 1;
l2:
    t6 = heap[t4];
    print("%c", t6);
    t5 = t5 + 1;
    if t6 != 0 goto l2;
l0: }

Error: Error

I added %ebnf at the beginning of my parser

Marilu
  • 1
  • 2
  • Please, elaborate your question. What do you want to accomplish? – Jefferson Lima May 03 '18 at 00:49
  • I want to make the kleen star works because doesn't work. The INSTR production only recognized 1 line of my text (i.e. id: ir_a = array[];) – Marilu May 03 '18 at 00:58
  • Please show us a minimal-but complete version of your grammar and an input that should be matched by that grammar, but isn't (and how you know it isn't). Also show us any conflicts you might be getting. From what I can tell, `id : INSTR` should produce conflicts because it's ambiguous, but that should not prevent your input from parsing. – sepp2k May 03 '18 at 10:58
  • Use text. It's text. – Dave Newton May 04 '18 at 01:38

0 Answers0