H
halkun
Guest
So I've been probing more into Fieldscript's form can say pretty much with 95% probably that the original language was a TCL extension.
I'm creating my own "compiler" of sorts using TCL and extending the opcodes myself. I've only worked on it for 5 hours last night and the whole thing fell into place. Because of the way the an interpreter is implemented in C, there can't be any other way this wasn't a TCL system to begin with.
The framework I have so far puts all the opcode handlers in a separate C module. Each opcode is represented by a single function. How TCL works is that the whole system is based on substitution. There are no keywords and everything is defined by commands. You can easily extend TCL by adding a custom command (It's a line of code) The TCL syntax is the following
Code: [Select]
It's trivial to implement fieldscript
Code: [Select]
Using TCL also allows you to define global vars, and then hook them directly into the engine. If you change a varible in the TCL script, it's changed within the C code as well.
You call a proc from C and on return, control goes back to the engine. It's exactly how fieldscript works. In the script itself, a proc can call another proc without giving control back to the engine.
The "compiler" I'm making will allow anyone to take the handlers and hook it directly into q-gears, as opposed to spitting out bytecode.
I'll be working on this this weekend, after I learn a little more TCL.
I'm creating my own "compiler" of sorts using TCL and extending the opcodes myself. I've only worked on it for 5 hours last night and the whole thing fell into place. Because of the way the an interpreter is implemented in C, there can't be any other way this wasn't a TCL system to begin with.
The framework I have so far puts all the opcode handlers in a separate C module. Each opcode is represented by a single function. How TCL works is that the whole system is based on substitution. There are no keywords and everything is defined by commands. You can easily extend TCL by adding a custom command (It's a line of code) The TCL syntax is the following
Code: [Select]
Code:
proc function {arg arg arg}{code}
Code: [Select]
Code:
proc tifa{ }{ on_click { battle {1 999} ret }}
You call a proc from C and on return, control goes back to the engine. It's exactly how fieldscript works. In the script itself, a proc can call another proc without giving control back to the engine.
The "compiler" I'm making will allow anyone to take the handlers and hook it directly into q-gears, as opposed to spitting out bytecode.
I'll be working on this this weekend, after I learn a little more TCL.