19.08.2013, 16:51
Hi,
about almost a year ago I started trying to reconstruct the modifications by SAMP made to the PAWN compiler. That actually started when I thought that the compiler was quite slow and I tried to find out why, which in fact I did, at least partially (there was a bug in the staging buffer which caused the buffer to be reallocated everytime something was written to it and slowed compilation time down by around 20% (from 9 seconds down to 11-13 in a script I tested, especially had a huge impact on scripts with large global variables)).
So I started with the same version used by SAMP (3.2.3664) and started with fixing that bug and adding (constant) string concatenation (which was used by the script I tested). Later I also changed some other things like strings starting with a # or string indexing ("teststring"[2]) and some other things. However I have to admit that I'm not really familiar with compilers at all, I just tried to understand the PAWN compiler and made the changes where I thought they would be the easiest (so especially the string stuff may look like a quite bad workaround).
Also it's not yet tested that good and not everything that works in the SAMP compiler does work yet (e.g. some preprocessor definitions as they are used in YSI, which seems to be caused by the Ј characters, I didn't look into that any further yet), however many scripts I tried to compile did compile (as long as they don't use YSI).
So this is just a beginning/work-in-progress, that I started and released to probably also get someone who already knows the compiler better to help as well Though the compiler should be already usable for many scripts and cases.
I think it would be good to have the (or a similar) source of the compiler back, because there are a few bugs in the current compiler that could be fixed and also, it could finally be compiled for Linux as well
I created a project on GitHub for this (though I think I made some changes to a header file regarding an issue compiling the compiler on x64 Linux (which caused CELL_MAX to be zero) that aren't in the repo yet):
https://github.com/Fabsch/pawnccsamp
about almost a year ago I started trying to reconstruct the modifications by SAMP made to the PAWN compiler. That actually started when I thought that the compiler was quite slow and I tried to find out why, which in fact I did, at least partially (there was a bug in the staging buffer which caused the buffer to be reallocated everytime something was written to it and slowed compilation time down by around 20% (from 9 seconds down to 11-13 in a script I tested, especially had a huge impact on scripts with large global variables)).
So I started with the same version used by SAMP (3.2.3664) and started with fixing that bug and adding (constant) string concatenation (which was used by the script I tested). Later I also changed some other things like strings starting with a # or string indexing ("teststring"[2]) and some other things. However I have to admit that I'm not really familiar with compilers at all, I just tried to understand the PAWN compiler and made the changes where I thought they would be the easiest (so especially the string stuff may look like a quite bad workaround).
Also it's not yet tested that good and not everything that works in the SAMP compiler does work yet (e.g. some preprocessor definitions as they are used in YSI, which seems to be caused by the Ј characters, I didn't look into that any further yet), however many scripts I tried to compile did compile (as long as they don't use YSI).
So this is just a beginning/work-in-progress, that I started and released to probably also get someone who already knows the compiler better to help as well Though the compiler should be already usable for many scripts and cases.
I think it would be good to have the (or a similar) source of the compiler back, because there are a few bugs in the current compiler that could be fixed and also, it could finally be compiled for Linux as well
I created a project on GitHub for this (though I think I made some changes to a header file regarding an issue compiling the compiler on x64 Linux (which caused CELL_MAX to be zero) that aren't in the repo yet):
https://github.com/Fabsch/pawnccsamp