Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #3637

Re: macro expansion ?

From Chris Hinsley <chris.hinsley@gmail.com>
Newsgroups comp.lang.forth
Date 2011-06-29 19:21 +0100
Message-ID <2011062919212920834-chrishinsley@gmailcom> (permalink)
References (4 earlier) <2011062819022446632-chrishinsley@gmailcom> <2011062819111570841-chrishinsley@gmailcom> <2011062819173534070-chrishinsley@gmailcom> <2011062819470472889-chrishinsley@gmailcom> <4e0b45ea$0$6982$a8266bb1@newsreader.readnews.com>
Subject Re: macro expansion ?

Show all headers | View raw


On 2011-06-29 16:34:02 +0100, Josh Grams said:

> Chris Hinsley wrote: <2011062819470472889-chrishinsley@gmailcom>
>> A big problem with doing recursive macros is that EVALUATE will push a
>> potentially unknown amount of state on the stack before the next
>> iteration of the macro
> 
> Not on any sensible Forth system, it won't.  The macros may, but
> EVALUATE itself can't keep stuff on the data stack if it is going to be
> at all useful.
> 
> 1 s" 2 +" evaluate .  \ this had better display 3
> 
> Or were you talking about something else?
> 
> --Josh

Ah, yes, your quite right ! It puts things on the return stack, silly 
me. :( I should have spotted that.

\ string evaluation
: EVALUATE	\ ( ... c-addr len -- ... )
	SAVE-INPUT N>R	\ save input spec
	#IN 2!		\ set the string as the SOURCE
	0 >IN !		\ reset buffer offset
	['] INTERPRET CATCH
	NR> RESTORE-INPUT -37 ?THROW
	THROW
;

OK, maybe the macro word then isn't so bad. I might have misjudged it.

Chris

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-28 14:43 +0100
  Re: macro expansion ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2011-06-28 10:58 -0500
    Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-28 18:34 +0100
      Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-28 18:51 +0100
        Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-28 19:02 +0100
          Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-28 19:11 +0100
            Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-28 19:17 +0100
              Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-28 19:47 +0100
                Re: macro expansion ? Josh Grams <josh@qualdan.com> - 2011-06-29 15:34 +0000
                Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-29 19:21 +0100
            Re: macro expansion ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2011-06-29 03:15 -0500
              Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-29 13:11 +0100
            Re: macro expansion ? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2011-06-29 17:17 +0100
              Re: macro expansion ? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2011-06-29 18:09 +0100
                Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-29 19:32 +0100
                Re: macro expansion ? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2011-07-02 08:48 +0100
    Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-29 00:44 +0100
    Re: macro expansion ? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2011-06-29 20:39 +0100
  Re: macro expansion ? Elizabeth D Rather <erather@forth.com> - 2011-06-28 08:59 -1000
    Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-28 20:39 +0100
      Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-28 21:34 +0100
        Re: macro expansion ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2011-06-29 03:26 -0500
  Re: macro expansion ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-06-29 11:25 +0000
    Re: macro expansion ? Chris Hinsley <chris.hinsley@gmail.com> - 2011-06-29 13:24 +0100
      Re: macro expansion ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-07-03 14:02 +0000
    Re: macro expansion ? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2011-06-29 18:48 +0000
  Re: macro expansion ? BruceMcF <agila61@netscape.net> - 2011-06-30 11:11 -0700
  Re: macro expansion ? Ian Osgood <iano@quirkster.com> - 2011-07-02 16:22 -0700
  Re: macro expansion ? Hugh Aguilar <hughaguilar96@yahoo.com> - 2011-07-05 17:35 -0700

csiph-web