Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Need list of feature for PBASIC emulator. (http://www.chiefdelphi.com/forums/showthread.php?t=4604)

rbayer 15-06-2002 17:22

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.

rbayer 17-06-2002 02:19

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.

VanWEric 17-06-2002 08:38

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

rbayer 17-06-2002 12:58

Quote:

Originally posted by VanWEric
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

Good idea. It's up at http://FIRSTprograms.tripod.com. Check out the readme for some of the little quircks and caveats as well as a quick overview of some of the more complex and obfuscated sections. I'll be checking my email (and therefore these forums) every few days or whenever I find an internet cafe, so post back with and questions or comments, and I'll do my best to answer them. Remeber that after tomorrow I won't have the code with me, so post the actual code of any sections you have ?'s about.

DanL 18-06-2002 16:32

ahh, what do you get for not reading the boards in a long time? Bringing topics back from the dead ;)

Quote:

Originally posted by rbayer
A 2k element array wouldn't be that bad (I've done multi-million-element), but its the principle of wasting RAM unnecesarily. I gave up on conserving disk space long ago, but I'd like to try (for the sake of good software engineering) to find a balance for RAM and speed.
This is definately an important consideration. Kudos to you. ;) Everyone here should read this article from today's Slashdot: http://msnbc.com/news/768401.asp.
Quote:

The issue, in the view of Dan Wallach, a computer scientist at Rice University, is not the pointless churning of the processor — after all, he notes, “processing power is cheap.” Nor is Microsoft software especially flawed; critics often employ the company’s products as examples more because they are familiar than because they are unusually bad. Instead, in Wallach’s view, the blooming, buzzing confusion in Visual Studio and so many other programs betrays how the techniques for writing software have failed to keep up with the explosive increase in its complexity.
Quote:

But as computers became widespread, attitudes changed. Instead of meticulously planning code, programmers stayed up in caffeinated all-night hacking sessions, constantly bouncing results off the compiler. Again and again, the compiler would spit back error messages; the programmers would fix the mistakes one by one until the software compiled properly. “The attitude today is that you can write any sloppy piece of code and the compiler will run diagnostics,” says SRI’s Neumann. “If it doesn’t spit out an error message, it must be done correctly, right?”
As programs grew in size and complexity, however, the limits of this “code and fix” approach became evident. On average, professional coders make 100 to 150 errors in every thousand lines of code they write, according to a multiyear study of 13,000 programs by Humphrey of Carnegie Mellon. Using Humphrey’s figures, the business operating system Windows NT 4, with its 16 million lines of code, would thus have been written with about two million mistakes. Most would have been too small to have any effect, but some — many thousands — would have caused serious problems.
It basically describes the problem of bad/rushed programming, its effects, and why in terms of the long run, more time should be spent concentrating on efficiency and structure rather than the "it's quick and dirty, but it works" method. As the quote from the article says, it's not really about processing power or memory... rather it's about the fact that because programs have become so complex, more time is needed think about how the program will work and design it to work. Otherwise, well we've all seen the Blue Screen.

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?

Ian W. 18-06-2002 17:22

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).

Matt Leese 18-06-2002 17:54

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.

Matt Leese 20-06-2002 16:17

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