-
Notifications
You must be signed in to change notification settings - Fork 9
Home
Welcome to the Tagha Virtual Machine wiki! the Wiki is a work in progress
The purpose for Tagha's creation is to use C as an embeddable scripting language or, for better and accurate words, Tagha is a C scripting environment with embedding and scripting capabilities. Though C might sound too low level to be used for scripting, Tagha is a viable alternative to running a C plugin architecture via dynamically loaded .so/.dll's, especially with the advantage of being able to run C code without having to recompile the .so/.dll for different OSs. Not to mention that most programmers have knowledge of C-like languages, so there would be no need to learn a new language or syntax.
Three reasons why Tagha exists!
Reason 1: so far, the only C interpreters (that I currently know of) are CINT, PicoC, TCC [1] and Ch:
- The problems with CINT is that it's old, clunky to use, outdated, and deprecated.
- PicoC is good but its problem is that it uses old-school interpreting (just runs literal code) instead of compiling to bytecode which would allow it to execute faster.
- The problem with Ch is that, though it's embeddable and updated, it's proprietary and it's unknown how it interprets code; as the usual problem with proprietary code, you don't know what code it could contain and there's no telling what security issues Ch could possibly have; not to mention that proprietary code shuts out enthusiastic individuals or groups from contributing to the software. UPDATE: I read on the Ch's developers website that Ch also interprets source code directly, doesn't use a bytecode machine! Specifically, Ch uses an AST-walking interpreter that's combined with a JIT Compiler [2], that'll speed up things alot but reduces portability significantly
- [1] - Tiny C Compiler, it can compile and run scripts for testing but it can't be embedded the same way a scripting system can be.
- [2] - citation from Ch dev website
Reason 2: I've always wanted to create a useful, open-source piece of software for many to use and one of my particular interests happens to be computer languages, so why not make a scripting engine?
Reason 3: To learn from making a scripting engine from scratch. If polished good enough, Tagha can hopefully be used in education to teach about virtual machines, scripting engines, and/or embedding for educational use!
The goal for Tagha is to...
-
- be a new and modernly optimized piece of software.
-
- have the clear execution speed advantage bytecode interpreters have over more traditional interpreters.
-
- be open-source and open for anyone who wants to improve or use Tagha.
-
- be an example of how to create and design a minimal scripting system.
-
- be portable and embeddable for any program and platform.
- register-based virtual machine with 3 different addressing modes to tackle any kind of code.
- 11 general purpose registers alongside 3 reserved-use registers.
- floats and doubles are supported!
- uses computed gotos (the ones that use a void*) which is 20%-25% faster than a switch {citation}.
- Tagha is "64-bit" as the registers and memory addresses are 64-bit.
- Embeddable into host applications.
- scripts can call host functions.
- host can give arguments and call script functions and retrieve return values.
- host can bind its own global variables to script-side global variables by name.
- integer and float arithmetic, (un)conditional jumps, comparison operations,
SIMD operations, and stack and memory manipulations. - function call and return opcodes automatically execute function prologues and epilogues.
- It's Turing Complete! (lol)
- little-endian format architecture.