The similarity of our "productions" with the computer BNF is shown in the following example. Variables can be any string, we use uppercase letters and numbers. Terminals are enclosed in apostrophes. Colon, :, replaces arrow, -> Vertical bar, |, is "or" Computer BNF Production file type .y file type .g S : 'a' S -> a | 'a' S S -> aS S -> a | aS term : var '*' var T1 : V1 '*' V1 T1 -> V1*V1 when * in Sigma B : B -> epsilon | Bab | Bb | B 'a' B | B 'b' Additional actions/output/statements can be used in computer BNF, { stuff } C : 'c' { printf("found a 'c' \n); } | 'c" C { printf("here comes more 'c' \n); } Thus, formatting, put "|" under ":". May also need or use ";"
The blog provides study material for Computer Science(CS) aspirants. Mostly says "material nahi milta, padhun kahan se.", I think If you can not find content on the Internet, then you are not a CS student. Dedicated to (Prof. Rakesh Kumar, DCSA, K.U.Kurukshetra, HARYANA, INDIA)- "Ek teacher ka bahut jyada padhna, bahut jyada jaroori hota hai."
Monday, 24 June 2013
BNF Backus-Naur Form
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment