![]() |
For now, I agree, and this is the quick-and-dirty implementation I have right now. If I become un-lazy in the next few weeks, I may implement something a little more elegant. Probably not, though. Anyway, VAR, CON, and DATA are all working now, and I'm putting the finishing touches on my expression and comparison evaluators. From there, the rest is just details.
BTW, parenthesis suck. |
Well, I finished the expression evaluator tonight. Currently it supports +,-,*,/,MAX, MIN, (). It even gives the correctly incorrect answers! The parenthesis implementation aint pretty, but it seems to work, so I'm not going to mess with it. To be added whenever I have a spare minute: <<, >>, &, |, ^, ~. I gave these a slightly lower priority because I don't see them as being as common. Anyway, it should be smooth sailing from here as the only other big concept I need to implement is goto.
Oh yeah, I decided not to take my laptop to England, so I'll be taking a two-week break from this project, so don't expect anything usable until mid-July. |
Well, if you are going, i am sure the good people of the forums would love to give it a good alpha testing... If you post the code i would appreciate it greatly, and you might just come back and have those opperators done for you...
Have fun in England |
Quote:
|
ahh, what do you get for not reading the boards in a long time? Bringing topics back from the dead ;)
Quote:
Quote:
Quote:
As for the actual emulator dilemma, since an array is the better way to go in terms of usability, but a linked list is better in terms of efficient memory management, how about you reach a compromise? How about you make an array of pointers, making them only point to information as needed? |
um, dan, i believe that an array is actually just a long thing of pointers, each pointing to a specific location in the memory, in which data of a certain type can be found. so making an array of pointers would really be completely pointless (yes, we all laugh at my clever little joke :p).
|
Assuming you're talking about the C programming language (and probably several others actually), an array isn't just a list of pointers. Instead an array is simply a single pointer. When you combine a pointer with an offset (ie the array index), you can point to any specific value in the array. Now as to, arrays of pointers, they do have a use. Unfortunately in this case, using an array of pointers wouldn't help. On most systems, integers and pointers are the same size (in bits). Therefore an array of 2000 integers takes up the same amount of space as 2000 pointers. Given that there needs to be space to allocate what the pointers are pointing too, it's less efficient to do the array.
As far as whether an array of 2000 integers takes up a lot of space, I'd have to say it doesn't as it's merely 8 kilobytes of space which is not much at all compared to what computers support. |
For those interested in an emulator, look here:
http://www.chiefdelphi.com/forums/sh...&threadid=4720 Matt |
| All times are GMT -5. The time now is 15:42. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi