Have you ever heard of Bacchus Naur Notation?
It is a language for describing languages used to define context free grammars.
Today's problem is to solve a BNF that describes the following programming language.
Declaration part.
short abc ;
long efg ;
int hij ;
Execution part
abc = 5 ;
efg = abc - 1 ;
hij = abc + 2 * efg ;
[Program] : : = [Declaration part] [Execution part]
[Declaration Part] : : = [Declaration Part Description] { [ ?1 ] }
[Execution Part] : : = [Sentence] { [Sentence] }
[Declaration Part Description] : : = [Declaration Descriptor] [ ?2 ] ' ; '
[Declaration Descriptor] : : = ' short ' | ' ?3 ' | ' int '
[Sentence] : : = [Identifier] ' = ' [Expression] ' ; '
[Expression] : : = [Term] { ' + ' [Term] | ' - ' [Term] }
[Term] : : = [ ?4 ] { ' * ' [Factor] | ' / ' [Factor] }
[Factor] : : = [Number] | [Identifier] }
Did you find the answer?
If you didn't, let's study it together!
If this is too easy for you, please share your IT knowledge with me! If you have any IT knowledge, please share it with me!
*I'll write the answer in my reply.
?1 : Declaration Part Description
?2 : Identifier
?3 : long
?4 : Factor
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
@neko9 さん、こんにちは。
@japansteemitがこの記事をアップボートしました。
tomoyan.witnessに投票お願いします👇
https://steemitwallet.com/~witnesses
💡 アップボートガイド 💡
分からない事は何でも質問して下さい🙇
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit