Question

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?

Était-ce utile?

La solution

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!

Autres conseils

Interpreter is ideal solution

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top