26.02.2013, 11:32
(
Last edited by Slice; 28/02/2013 at 08:57 PM.
)
I've been thinking about creating a pre-compiler for quite a while now.. I did create something similar here, but it's written in PHP and isn't flexible enough.
Design
I'm thinking Node.js would be great for this. In fact, I've already written libraries to run servers, compile scripts, and modify anything in an AMX file.
Are you good at JavaScript? Participate!
"Hooking" the compile process
I think the best way to deal with the preprocessor is let it do its thing, then step in.
The compiler would include a plain Pawn script containing functions that would be used throughout the script.
These functions could help with memory allocation, string manipulation, managing data structures, and so on.
Plugins
This is where I think the compiler could grow in strength. Support loading JavaScript plugins that does, well, whatever you want to your code. Anyone can make them, and anyone can use them.
Ideas
Source code
Here's the GitHub repository:
https://github.com/oscar-broman/Prawn
Design
I'm thinking Node.js would be great for this. In fact, I've already written libraries to run servers, compile scripts, and modify anything in an AMX file.
Are you good at JavaScript? Participate!
"Hooking" the compile process
I think the best way to deal with the preprocessor is let it do its thing, then step in.
- Compile with the -l flag (only preprocess)
- Do the pre-compilation magic
- Include the runtime script
- Compile the resulting script
- Open the AMX and modify debug information and the header for additional customization
The compiler would include a plain Pawn script containing functions that would be used throughout the script.
These functions could help with memory allocation, string manipulation, managing data structures, and so on.
Plugins
This is where I think the compiler could grow in strength. Support loading JavaScript plugins that does, well, whatever you want to your code. Anyone can make them, and anyone can use them.
Ideas
- OO!
- Pointers!
- Improved enums (fix issues, store info on keys). This would allow easily saving/loading data in enums without having to modify code every time the enum is changed.
- Improved runtime introspection (allow people like Y_Less and I to make more cool stuff).
Source code
Here's the GitHub repository:
https://github.com/oscar-broman/Prawn