詳しい解説はネット上に沢山存在するので割愛しますが、ご覧のようにEBNFの表現の一つに(EBNFはいくつかの表現方法があるようです。例えばこれはW3Cが定義しているものです)似ています。違いは先に述べたようにChoiceの働きが異なるのと、文法上に先読みが存在することです。 このPEGを使って四則演算を受理するシンプルなルールを書くとすると、例えばこのようになります。 # expressionからパースが始まるとする expression <- additive additive <- multitive ("+" multitive / "-" multitive)* multitive <- primary ("*" primary / "/" primary)* primary <- "(" expression ")" / number number <- digit+ digit
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く