Page 1 of 1 1
Topic Options
#133087 - 2005-01-27 05:16 PM Script Compiler
cbf305 Offline
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
#133088 - 2005-01-27 05:46 PM Re: Script Compiler
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Lets await the official statement from Ruud here ....
_________________________



Top
#133089 - 2005-01-28 10:04 AM Re: Script Compiler
Richard H. Administrator Offline
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.
  1. 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.
  2. 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.
  3. 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
#133090 - 2005-01-28 03:31 PM Re: Script Compiler
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If having a single stand-alone EXE file is the only objective, my MakeEXE suggestion would achieve that.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#133091 - 2005-01-30 02:18 AM Re: Script Compiler
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
The closest way to a "compiler" would be a procedure that creates a executable with embedded KiXtart interpreter and script. The executable's tasks are to decompress the "payload" into memory, then execute the KiXtart interpreter that's now in memory and feed the script that's also in memory into the interpreter. Basically, the approach would be ASE but without any kind of file creation, just in-memory execution.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 601 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.058 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org