作者scwg ( )
看板PLT
标题Re: [问题] BNF的问题
时间Mon Dec 3 17:01:19 2007
※ 引述《finaldark (......................)》之铭言:
: 有没有人可以解释一下,
: 我实在是看不懂,
: 有人可以给个 hint吗
: 谢谢
: *********************************************************************
: 95年高考-程式设计
BNF:
http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form
: 二、试写出一BNF文法,使其产生二进位数字,且数字之值为3之倍数。(20分)
: 答:3倍数之文法如下
: <N3> → <N3>0 | <N1>1 | 0
模三余零 = 余零的数 * 2 or 余一的数 * 2 + 1 or 0
: <N1> → <N2>0 | <N3>1 | 1
模三余一 = 模三余二 * 2 or 模三余零 * 2 + 1 or 1
: <N2> → <N1>0 | <N2>1
模三余二 = 模三余一 * 2 or 模三余二 * 2 + 1
: *********************************************************************
--
And in that line now was a whiskered old man,
with a linen cap and a crooked nose,
who waited in a place called the Stardust Band Shell
to share his part of the secret of heaven:
that each affects the other and the other affects the next,
and the world is full of stories, but the stories are all one.
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.30.54
1F:推 finaldark:谢谢 我懂了 :P 12/04 15:20