5

I'm wondering if there already exists files that describe the Lex and Yacc tokens and parsing rules for LOGO.

I'll be using PLY for Python to parse the LOGO commands. I have to convert the files to Python so I'm hoping to use the files more as a guide.

I've searched here and Googled but can't find any.

Steven Doggart
  • 43,358
  • 8
  • 68
  • 105
Reactgular
  • 52,335
  • 19
  • 158
  • 208

1 Answers1

3

There doesn't exist a Lex/Yacc configuration files for LOGO. LOGO can't be used with Lex, because the language doesn't have clearly defined arguments for functions. Making the matching of arguments to function lazy depending upon context. Lex only works with clearly defined argument structures.

Reactgular
  • 52,335
  • 19
  • 158
  • 208
  • What would be the best approach to parse Logo? I want to do it, but intend to do it 'by hand' in college in my compiler class we saw the first&follow and bottom up techniques if I recall correctly, would any of those do? – orlybg Mar 01 '14 at 15:59
  • @orlybg The original turtle language is very difficult to resolve ambiguous parameters, but if you modify the syntax of logo a little bit then it's doable with a grammar parser. It's just that you have to know what changes to make to resolve problems. You write down all the grammar you want to support first, and then share it here asking if the grammar can be parsed. – Reactgular Mar 01 '14 at 16:23