I'm taking a compiler-design class where we have to implement our own compiler (using flex and bison). In dragon book by V.Aho et al. They have mentioned backpatching to backpatch forward references for control structure and boolean expressions but this needs only one pass .

I don't want to use backpatching for forward references .

How to do this without using backpatching ?

I am using LEX/YACC aka FLEX/BISON and C/C++ .

  • 1
    $\begingroup$ What other approaches have you considered? Use 2 passes? The methods for building a 2-pass compiler are well documented. We expect you to do significant research before asking, and to tell us what research you've done and what approaches you've considered or rejected. Have you done any research into 2-pass compilers? Where have you looked? $\endgroup$
    – D.W.
    Apr 14 '15 at 0:05
  • $\begingroup$ @D.W. can you provide few links ? $\endgroup$
    – sonus21
    Apr 14 '15 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.