-1

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?

Steven Doggart
  • 43,358
  • 8
  • 68
  • 105
Hensembryan
  • 1,067
  • 3
  • 14
  • 31

2 Answers2

3

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!

Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192
  • Thanks for your help, it's very helpfull. I use command pattern but its very slow, because each method act as object. Seems like abstract syntax trees is interesting :) – Hensembryan Oct 28 '11 at 05:12
0

Interpreter is ideal solution

mishadoff
  • 10,719
  • 2
  • 33
  • 55
  • yeah but that make the application more complex T.T, i've done it with normal parser function and use state, composite, and command pattern. – Hensembryan Oct 28 '11 at 21:01