how to write the input file for yacc with this grammar rule?

  • hiji
  • Novice
  • Novice
  • User avatar
  • Posts: 20

Post 3+ Months Ago

lexp->number|(op lexp_seq)
op->+|-|*
lexp_seq->lexp_seq lexp|lexp

the grammar after left recursion removal:

lexp->number|(op lexp_seq1)
op->+|-|*
lexp_seq1->lexp lexp_seq2
lexp_seq2->lexp lexp_seq2|E

E for null. and how to explain null in yacc?
how to write the action for lexp_seq1 and lexp_seq2?

thanks ..

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 69 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.