On Sat, 13 Dec 1997, Peter Gerwinski wrote:
I know this is a stupid question but what is the title/author/foobar of this famous "Dragon Book"? I really have the impression that I should read it ...
"Compilers: Principles, Techniques, and Tools" by Aho, Sethi and Ullman. I heard it was the compiler writer's bible :) I don't personally own the book, so I don't know how much of the information still applies today (it was written in 1986, but I don't think that makes it obsolete).
going to reinvent Pascal or Java. I assume that you want to have a language that allows the user to customize and extend the
That's exactly what I want it to do :) I want to allow the user to customize and extend the program (be it a game or a normal app).
behaviour of your program. Did you have a look at GUILE, GNU's answer to this question? (I haven't, but I have read a lot about GUILE's existence.;-) Or else, what about defining a CGI-like
I'll have to check it out, I've never heard of it be4 :}
interface between your program and another program written by the user in his/her favourite language?
That's along the lines of what I want to do. But the important thing is that to the user it will be plain-text, but when it's compiled it'll be bytes with literal strings, etc.
What is the difference between this and the concept of user-defined types, variables, and procedures?
In what I wrote, the "user-defined" refers to the non-programmer (product designer who uses the script to write parts of the program without actually coding, a small example is in a game) and end-user (the person who uses the script to extend the program). Now that I think about it, adding tokens at run-time is not different than adding tokens at compile time in terms of adding the variables/etc that interface to the program in a descendant type. You brought up a good point, what I want to do is provide a base syntax and have the programmer merely add the addresses and the labels of their variables/functions/etc. so that the end-user can access them in the script and control certain parts of the program.
The GNU compilers also support such a platform-independent "bytecode", and so does UCSD's P-Code and Java's J-Code. Perhaps you should have a look at their specifications first? Those of GCC/GPC are in the source code.
First a random thought, I've decided to put the data right after the byte-code (Java does that, I thought the idea I had would be better in order to compact the code. But now that I look at it, that would make it unneccessarily complicated, so I'm thinking of going with how Java does it which is putting the data right after the code) so the header will consist of nothing more than the version of the script compiler. I didn't know that GNU had that feature, I took a look at the GPC bytecode specs, but I'll have to look at them again since I just glanced at them. Where can I find the full specs on the GNU bytecode specs? I have a P-Code interpreter written in Pascal, but don't know how to code for it (hence my having a bit of trouble understanding how it works).
What I'm working on learning now is breaking down an Algabraic Equation (did I get the right term?) and arranging it so that it's in an order ready to be translated into the byte codes. I think this step is called converting Postfix to Infix. I saw some code in Pascal that parses an equation and translates it by using loops and arrays rather than recursing. What it does is juggle variable names, I don't know how capable it is for processing real numbers or others. It only handles * / + and - but it can be modified to handle Boolean operations, etc. I got the code out of the Pascal SWAG. I'll upload the code where Peter moved Hans' upload.
See ya! Orlando Llanes
"Hey, we all did the drug thing, we all did the money thing, and eventually you find out that none of that stuff fixes anything, and we have nowhere else to go except to evolve spiritually and intellectually" -- Meredith Brooks
"Look out fo' flyeeng feet" O__/ a010111t@bc.seflin.org /|____. O <__. /> / \ ____________|_________ http://ourworld.compuserve.com/homepages/Monkey414