TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: CHRIS CRANFORD
from: Pascal Schmidt
date: 2004-05-07 15:53:02
subject: Re: Scripting/Basic Compiler/Interpretor

Hi Chris! :-)

 CC> Now, from what I have read thus far, I need to, as my parser is 
 CC> reading the source file(s), need to create a number of stacks that
 CC> hold information like:
[...]
 CC> I know this can be done from the BISON grammer file to call C 
 CC> functions which populate these things, but I'm unsure of really
 CC> how I should best structure this monster. 
Well, for each action that's possible, you need to think about what
information the runtime system will need to have to execute it. Then think
about at what stage the parser has all the necessary information. At that
point, create a data structure holding all that info and add it to a list,
array, or stack of already parsed elements.

You will most likely need temporary buffers for the larger structures that
are filled out by different calls in the parser, before they are stored in
some bigger list or stack.

You might need a second pass over the generated data structures, depending
on whether your language allows to use stuff that is defined only later in
the source text.

There's also the decision of where you want to put the bulk of the
complexity - you can either have the parser do heavy processing and keep
the runtime system simple, or the other way around.

Ciao
Pascal

--- Msged/LNX 6.1.1
* Origin: let fun a b c d = b (c,d) in a op < 17 end 23 (1:153/401.2)
SEEN-BY: 633/267 270
@PATH: 153/401 307 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.