Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 24th, 2006, 7:08 AM   #11
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
also, what order should i traverse my tree in?
everyone suggested postorder, but i have no clue how that's possible
preorder makes much more sense, but then people called me weird.

but the reason i think preorder would work while postorder might not is because procedures are defined towards the top of the tree, and then they are called towards the bottom of the tree .... so if i see the function call towards the bottom of the tree, i would have no idea what it is, unless i move all the way up and find out it's a procedure! until then, it would just be an identifier for me, with no meaning

i hope i am making sense
programmingnoob is offline   Reply With Quote
Old Jul 26th, 2006, 2:42 PM   #12
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
also, how am i supposed to handle different "procedures" within the program i supposed to interpret
programmingnoob is offline   Reply With Quote
Old Jul 26th, 2006, 2:45 PM   #13
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
I would create a map of all the procedures with their locations. When calling a procedure, you push the current address/line on the call stack, and when the procedure returns you continue at the previously stored value.
Polyphemus_ is offline   Reply With Quote
Old Jul 26th, 2006, 3:48 PM   #14
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 376
Rep Power: 0 King is an unknown quantity at this point
ProgrammingNoob, instead of posting 4 posts in a row, just edit your previous one to add more information.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Jul 26th, 2006, 3:49 PM   #15
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
Quote:
Originally Posted by Polyphemus_
I would create a map of all the procedures with their locations. When calling a procedure, you push the current address/line on the call stack, and when the procedure returns you continue at the previously stored value.
i see! .... but see ... according to my current abstract syntax tree, the callee comes before the caller.... so the callee doesnt even know the value of the variable that caller passes to the callee yet (also the variable gets declared in the caller function of course) .... maybe when i am trying to interpret the callee function and find out there is no value set for the variable it's supposed to act on, then maybe skip interpreting the rest of the procedure?

you see what i am saying?
programmingnoob is offline   Reply With Quote
Old Jul 26th, 2006, 4:20 PM   #16
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
Quote:
Originally Posted by King
ProgrammingNoob, instead of posting 4 posts in a row, just edit your previous one to add more information.
really?
my understanding was ... when you edit something, the forum posters wont find out about it until they open the thread and bother to read the edited post carefully
i dont expect so much work from you people .... let's face you're all busy
so whats the other way of posting my q's if i have 4 different q's?
now if i make a separate thread for each of the question, i can understand how that be considered a problem

(oh btw .... i really apologize if i am wrong about what i said about editing)
programmingnoob is offline   Reply With Quote
Old Jul 26th, 2006, 6:03 PM   #17
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
King was probably just suggesting that you append to you post if it's the last one in the thread; however, IIRC there is only a 1/2 hr window in which to edit a post. If you have something else to say after that, just posting a new reply is fine, but if you can edit and just add on to the last post, that would be preferrable.
Jimbo is offline   Reply With Quote
Old Jul 26th, 2006, 6:25 PM   #18
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
Quote:
Originally Posted by Jimbo
King was probably just suggesting that you append to you post if it's the last one in the thread; however, IIRC there is only a 1/2 hr window in which to edit a post. If you have something else to say after that, just posting a new reply is fine, but if you can edit and just add on to the last post, that would be preferrable.
well if you look at my posts, they are far more apart than half an hour! lol
but i know ... it can be annoying ... oh well! i will try to be more careful
programmingnoob is offline   Reply With Quote
Old Aug 22nd, 2006, 5:44 PM   #19
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
the instructions given by my prof:
1)Save formal parameters on the stack
2)save local variables on the stack
3)initialize formal parameters with the values of actual parameters
4)interpret the procedure body
5)restore local variables and formal parameters from the stack

what does he mean by "store formal parameters and variables on the stack"? did he mean store their names? if yes, then when he said initialize formal parameters with the values of actual paramters, am i supposed to link the name (a string type) to the value (integer type)?
(btw it's pretty safe to assume that there will be only one parameter passed)

oh also, what about the actual parameter? can i just have the value of the actual parameter be the value of a global variable? simple?
programmingnoob is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running executables in C++ crawforddavid2006 C++ 22 Jun 26th, 2006 12:00 PM
Create an Interpreter proudnerd Coder's Corner Lounge 12 May 20th, 2006 10:24 AM
Bad interpreter? a thing Bash / Shell Scripting 4 May 18th, 2006 3:31 AM
[ANN] New script engine (Basic sintax) MKTMK C++ 3 Sep 1st, 2005 5:51 PM
Voicexml Interpreter mehul_haria Other Web Development Languages 1 Mar 18th, 2005 11:01 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:23 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC