Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we add comments in flex/bison source code?

Like in other languages, we can add comments using either //, /---/, #, % etc. So similarly if I want to add comments in flex/bison source code for better understanding of code. Can I do the same? If yes then how? Whenever I tried to search about same on the internet, answers usually come for defining comment in flex/bison and not about how to add comments in flex/bison source code.

like image 673
Echostar Avatar asked Oct 19 '25 09:10

Echostar


1 Answers

(F)lex: Indent the comment, and use a comment style appropriate to the generated code. (/*...*/ is recommended.) You must indent every line of the comment. Indented text is copied verbatim to the generated file, but a comment is a comment.

Yacc/Bison: Use /* ... */ anywhere in the grammar. In bison, but possibly not other yacc derivatives, you can also use // comments.

like image 120
rici Avatar answered Oct 22 '25 04:10

rici



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!