Problem Detail: Today I heard of BNF which is a language for languages. Also heard that it specifies the entire syntax of C in four pages. So I thought of checking it out. After reading through this page, I got a fair idea about how to read the syntax. But I don’t understand what the first two lines mean:
%token int_const char_const float_const id string enumeration_const %%
Also I am reading BNF just because I am just curious. How should I proceed to understand the formal syntax by reading BNF? Here is the BNF syntax of C.
Asked By : daltonfury42
Answered By : D.W.
Backus Normal Form does not define special syntax for %token. So that would be a special syntax custom-added by a particular person or web page or tool. Tool support is off-topic here, but if search for “%token” on the first link you gave, you’ll find a brief explanation that appears to describe what %token means in the context of that particular example. In other words: if you only want to understand BNF at a conceptual level, ignore it. That’s something that’s not part of BNF, but is an add-on that was added for some special purpose. If you want to understand that the specific syntax used by some specific tool (e.g., YACC), your best source is probably the reference manual for that tool.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/44895 Ask a Question Download Related Notes/Documents