문제

In wikipedia, Logo Programming is a multi-paradigm computer programming language used in education. I want to make an application like TurtleGraphicEditor (which using logo programing) using C#. I want each logo command act as method, example command "forward val" act as "forward(float val)", etc. What is design pattern that suitable for parsing the Logo code?

도움이 되었습니까?

해결책

This is a very general question. Here are some topics that you might want to read up on:

  • lexers
  • parsers (as you mentioned)
  • abstract syntax trees
  • compilers
  • domain-specific languages
  • interpreters

A general design for such an application might have two main components:

  1. read text, lex and parse into abstract syntax tree
  2. walk the syntax tree, either evaluating it or transforming it (compiling) into source code in a different language

But be warned! This is not trivial!

다른 팁

Interpreter is ideal solution

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top