精華區beta TransCSI 關於我們 聯絡資訊
※ 引述《x0315b100 (飛來飛去)》之銘言: : 在課本上看到了... : 整傻住 : 什麼是BNF阿?? : 全名又是什麼?? : 希望大大能舉個例子說明一下@@" : 麻煩了~ Backus-Naur Form – Invented by John Backus to describe Algol 58 – BNF is equivalent to context-free grammars – BNF is a metalanguage used to describe another language – In BNF, abstractions are used to represent classes of syntactic structures--they act like syntactic variables (also called nonterminal symbols ) BNF FundamentalsNon-terminals: BNF abstractions ‧ Terminals: lexemes and tokens ‧ Grammar: a collection of rules – Examples of BNF rules: <ident_list> → identifier | identifier, <ident_list> <if_stmt> → if <logic_expr> then <stmt> supplement: The example Grammar : <program> → <stmts> <stmts> → <stmt> | <stmt> ; <stmts> <stmt> → <var> = <expr> <var> → a | b | c | d <expr> → <term> + <term> | <term> - <term> <term> → <var> | const For a = b + const it's derivation is: <program> => <stmts> => <stmt> => <var> = <expr> => a = <expr> => a = <term> + <term> => a = <var> + <term> => a = b + <term> => a = b + const Read "Program Language" books for more detail. -- 空中精靈。SkyElf/Stevennick        要重新在空中飛翔‧遨遊全世界 未來正在我的手中 一點一滴的實現                My Blog: http://stevennick.dyndns.org/            My Podcasting: http://podcast.blog.webs-tv.net/skyelf  ____________________________________________________________________________ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.68.140.151
x0315b100:謝謝大大喔~ 05/28 00:33