MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Advice for writing small Scheme interpreter

  • To: mathgroup at
  • Subject: [mg74502] Re: Advice for writing small Scheme interpreter
  • From: David Bailey <dave at>
  • Date: Fri, 23 Mar 2007 19:09:20 -0500 (EST)
  • References: <ett6c9$gba$>

wooks wrote:
> I need to write a very small Scheme interpreter in Mathematica to
> complete my project.
> How can I stop Mathematica from evaluating statements so that they can
> be parsed in their raw form by the interpreter code.
> For example I don't want (+ 7 8) converted into 56 before I can parse
> it.
There are two issues here. You not only require Mathematica not to 
evaluate input, but you do not want it parsed in any way. The only 
solution is to read the information as strings. If your scheme source is 
in a file you could read it as strings using ReadList using a type of 
String. If it is in a notebook, things get more complicated because of 
Mathematica's BoxForm. Notebook input might be best entered within 
strings, as in:

Scheme["(+ 7 8)",

In that way you could still enter Mathematica code as well - which you 
will need to debug your interpreter!

I don't think this project will be as easy as you think, so I would 
carefully evaluate if you really need to do this.

David Bailey

  • Prev by Date: Re: label graph vertices
  • Next by Date: Re: notebook as TXT
  • Previous by thread: Re: Advice for writing small Scheme interpreter
  • Next by thread: About function to evaluation