Differences between revisions 3 and 4
Revision 3 as of 2011-08-09 18:01:03
Size: 752
Editor: 211
Comment:
Revision 4 as of 2013-10-14 14:03:49
Size: 756
Editor: 61
Comment:
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
자동차를 움직이는 미니언어 [InterpreterMiniLanguage.java] 자동차를 움직이는 미니언어 [[InterpreterMiniLanguage.java]]
Line 12: Line 12:
 * 이 문법을 [BNF]로 표기하면,  * 이 문법을 [[BNF]]로 표기하면,

DesignPatterns에서 BehavioralPatterns의 하나.

미니언어를 사용해서 문제를 해결, 언어를 재귀적으로 정의하고, 구문Tree를 구축하고, Parsing하는 패턴

Structure

Example

자동차를 움직이는 미니언어 InterpreterMiniLanguage.java

  • go / right / left 로 이동하고 repeat 할수 있다.
  • 이 문법을 BNF로 표기하면,

    • <program> ::= program <command list>

    • <command list> ::= <command>* end

    • <command> ::= <repeat command> | <primitive command>

    • <repeat command> ::= repeat <number> <command list>

    • <primitive command> ::= go | right | left

관련정보

InterpreterPattern InterpreterPattern


CategoryPattern

InterpreterPattern (last edited 2013-10-14 14:03:49 by 61)

web biohackers.net