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

  • hiji
  • Novice
  • Novice
  • User avatar
  • Joined: Feb 15, 2004
  • Posts: 20
  • Status: Offline

Post April 17th, 2004, 2:09 am

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 ..
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 17th, 2004, 2:09 am

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 211 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.