#133087 - 2005-01-27 05:16 PM
Script Compiler
|
cbf305
Fresh Scripter
Registered: 2004-11-02
Posts: 7
|
First I would like to thank the programmer(s) of KiXtart for creating an awesome language, Thanks! And yeah, I know this has been asked a lot in the forums, and everyone has said "no" and there won't be because it's an interpreted language...but...so are PHP and PERL and those have compilers. Basically the interpreter has to compile (or interpret) each line into machine code anyway before it can even execute it, so why not just make it output that to a file and slap an .exe on the end. I'm sure it's not that simple code wise, but I have not read a good reason why there can't be a compiler other than maybe the fact that no one wants to make one. I would if I new how to program a compiler. I have the ASE editor and have used the packager, but I feel it is a flaky method. Anyway I would like to see a compiler for KiXtart. Please don't flame me to bad, after all this is only a suggestion.
|
|
Top
|
|
|
|
#133089 - 2005-01-28 10:04 AM
Re: Script Compiler
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Ok, you are confusing a lot of things here, so let's try and address some of them.
Quote:
and everyone has said "no" and there won't be because it's an interpreted language
Not quite right. No-one will object to having a compiler to generate a small tight stand-alone version of a script. However to be worth the significant time and effort that would be needed to write it there needs to be some sort of benefit. There is unlikly to be any significant benefit from compiling the KiXtart script for reasons which will become clear.
Quote:
Basically the interpreter has to compile (or interpret) each line into machine code anyway before it can even execute it, so why not just make it output that to a file and slap an .exe on the end.
No, the interpreter does not render the script to machine code. Not even close.
The interpreter performs three discrete but complex tasks. - Parsing. The first task is to parse the script into meaningful chunks. These may be simple keywords and data, or slightly more complex structure of keywords with associated data. This is the "tokenising" phase and will include simple syntax and error checking. At the end of this phase the script is reduced to a form that the interpreter can handle much more rapidly.
- Metadata management. Behind the scenes the interpreter is keeping track of all sorts of information about variables, loop structures, i/o states and so-on.
- Execution. The interpreter "executes" the script by looking at each token and calling branches within it's own code. The tokenised script is never in a state that can be executed.
An added wrinkle is that KiXtart supports on-the-fly execution of arbitrary code using Execute(). This means that you cannot do away with the parse/tokenise elements of the interpreter.
What you can do it pre-tokenise the main script. This will make the script hard to reverse engineer and will speed up the start up the initial load time but otherwise has little benefit. This feature will be available in version 4.50 which is currently undergoing testing.
This pre-tokenisation is more like "compiling" Java to it's portable byte-code form. You still need an interpreter and all the support libraries to execute it.
Quote:
I have the ASE editor and have used the packager, but I feel it is a flaky method.
Tut tut. You ask not to be flamed, yet you include an extraordinary statement like that. As you say this is a packager, not a compiler. What is "flaky" about it? Have you taken this up with the ASE development guys and asked them to de-flake their product?
Quote:
Anyway I would like to see a compiler for KiXtart
Why?
You've said you'd like to see it, and you've said other languages have it but you haven't said what you would use it for or what good it will do.
To take your suggestion forward, have a think about what you want a compiler for. What is it going to do for all the people who use KiXtart? What problems will it fix? What opportunities will it offer?
Bear in mind from what I've explained above that the parser and interpreter will always need to be present, either as a standalone or included in the compiled script.
If you can come up with some really good reasons then someone may take up the challenge and produce a compiler, albeit not all KiXtart intrinsic feature will be supportable.
|
|
Top
|
|
|
|
Moderator: Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
0 registered
and 533 anonymous users online.
|
|
|