Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Is interpret/co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 21 Topic 3960 of 4050
Post > Topic >>

Is interpret/compile the wrong distinction?

by Josh Grams <josh@[EMAIL PROTECTED] > Mar 23, 2008 at 02:50 PM

I've been thinking about Jonah Thomas's comment (back toward the
beginning of this month) that there is a bunch of unnecessary
complexity around IMMEDIATE/POSTPONE/etc and the divide between
interpretation and compilation semantics.

Coming mostly from languages other than Forth, it seems to me that
the complexity comes from Forth offering the wrong choice to the
programmer.  I *think* that what I normally want as a programmer
is a distinction between syntax and semantics (parse time and
"run" time).

For instance, I want the behavior of S" to be: parse a string
delimited by a double-quote, and add a string literal to the
current "statement", regardless of whether or not I'm inside a
definition.

: CHAR  PARSE-WORD DROP C@[EMAIL PROTECTED]
 LITERAL ; SYNTAX
: S"  CHAR " PARSE SLITERAL ; SYNTAX

It would, of course, add a bit of complexity to the compiler.  But
I think it simplifies things for the programmer.  And it has the
advantage that each name only ever has one piece of code attached
to it.  And I believe you could have ANS compliance with basically
just:

TRUE CONSTANT STATE
' SYNTAX ALIAS IMMEDIATE

I haven't implemented this, and of course I've skipped all the
details here; I just wanted to present the basic idea.  Thoughts?

--Josh




 21 Posts in Topic:
Is interpret/compile the wrong distinction?
Josh Grams <josh@[EMAI  2008-03-23 14:50:35 
Re: Is interpret/compile the wrong distinction?
Elizabeth D Rather <er  2008-03-23 15:06:31 
Re: Is interpret/compile the wrong distinction?
Bruce McFarling <agila  2008-03-23 14:09:50 
Re: Is interpret/compile the wrong distinction?
Jonah Thomas <jethomas  2008-03-23 19:23:48 
Re: Is interpret/compile the wrong distinction?
pablo reda <pabloreda@  2008-03-23 16:50:53 
Re: Is interpret/compile the wrong distinction?
Albert van der Horst <  2008-03-24 03:20:31 
Re: Is interpret/compile the wrong distinction?
John Doty <jpd@[EMAIL   2008-03-23 22:18:20 
Re: Is interpret/compile the wrong distinction?
Albert van der Horst <  2008-03-24 15:07:47 
Re: Is interpret/compile the wrong distinction?
John Doty <jpd@[EMAIL   2008-03-24 12:36:00 
Re: Is interpret/compile the wrong distinction?
Josh Grams <josh@[EMAI  2008-03-24 01:11:03 
Re: Is interpret/compile the wrong distinction?
Bruce McFarling <agila  2008-03-23 19:34:40 
Re: Is interpret/compile the wrong distinction?
John Doty <jpd@[EMAIL   2008-03-23 22:48:04 
Re: Is interpret/compile the wrong distinction?
Bruce McFarling <agila  2008-03-24 00:06:20 
Re: Is interpret/compile the wrong distinction?
Bruce McFarling <agila  2008-03-24 08:21:38 
Re: Is interpret/compile the wrong distinction?
Bruce McFarling <agila  2008-03-24 09:21:32 
Re: Is interpret/compile the wrong distinction?
Jonah Thomas <jethomas  2008-03-23 20:08:31 
Re: Is interpret/compile the wrong distinction?
Jonah Thomas <jethomas  2008-03-23 22:16:20 
Re: Is interpret/compile the wrong distinction?
Josh Grams <josh@[EMAI  2008-03-24 13:00:48 
Re: Is interpret/compile the wrong distinction?
Jonah Thomas <jethomas  2008-03-24 09:36:52 
Re: Is interpret/compile the wrong distinction?
Albert van der Horst <  2008-03-24 15:40:20 
Re: Is interpret/compile the wrong distinction?
anton@[EMAIL PROTECTED]   2008-03-24 13:41:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 0:54:59 CDT 2008.