Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Advice for writing small Scheme interpreter

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

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
http://www.dbaileyconsultancy.co.uk




  • 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