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: [mg74486] Re: [mg74451] Advice for writing small Scheme interpreter
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Fri, 23 Mar 2007 19:00:38 -0500 (EST)
  • References: <200703220605.BAA16737@smc.vnet.net>

On Mar 22, 2007, at 2:05 AM, 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.

Give your parser the attribute HoldFirst or HoldAll as appropriate so  
its arguments aren't evaluated before being passed.

Wrap intermediate expressions you create in your parser in Hold as  
appropriate.

You may be able to get away with passing your expressions with  
Unevaluated but that's a bit more difficult.

Regards,

Ssezi


  • Prev by Date: Inverse of arbitrary functions
  • Next by Date: Display problem in X. Please help!
  • Previous by thread: Advice for writing small Scheme interpreter
  • Next by thread: Re: Advice for writing small Scheme interpreter