Article 5QPAM Bison YACC compiler generator question

Bison YACC compiler generator question

by
schmitta
from LinuxQuestions.org on (#5QPAM)
I have a grammar BOOK -> PAGES -> page -> lines -> line ->tokens. the book page can have any number of lines (set by user) and the line can have as many tokens as can fit the Line Length which is set by the user. I can't use ; to end a line as this is text. a token is added to the line with a space until the line length is reached then it is UNPUT. I do not know how to tell yacc that I can't fit any more tokens on a line and so to terminate the production and go back up the tree (un load the grammar stack ) This is probably my problem as my grammar is probably suppose to solve this but I do not know how. If a call or a bit could be set in yacc to tell it the line has been made and now reduce the grammar stack it would be useful to me. the input to yacc is a bunch of tokens with some commands

The input is just to feed tokens but the line being built determines when it is finished and is time to reduce.

one way to do this would be, upon a line full condition, unput the input a certain number of times and then insert a crazy string such as (}{) and have a bnf rule <data> ::=tokens token (}{) and then ask lex for the next token and it would get (}{) which would terminate the rule. Is this possible?latest?d=yIl2AUoC8zA latest?i=YZ1VUd9fgk8:sVoLIO7GYEk:F7zBnMy latest?i=YZ1VUd9fgk8:sVoLIO7GYEk:V_sGLiP latest?d=qj6IDK7rITs latest?i=YZ1VUd9fgk8:sVoLIO7GYEk:gIN9vFwYZ1VUd9fgk8
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments