HTVM is a tool for creating and deploying new programming languages quickly. You define your language’s rules and syntax in a simple text file, and HTVM takes care of the rest. It generates the code needed for your language. HTVM supports transpiling to JavaScript, Python, and C++, making it easy to test and use your new language in different environments.
HTVM lets you create and deploy new programming languages efficiently. To configure your language:
-
Syntax Configuration: Use the website here or Adjust the syntax in
HT-instructions.txt
. Each line in this file corresponds to the same line ininstruction documentation.txt
, so line 10 ininstruction documentation.txt
matches line 10 inHT-instructions.txt
. -
Code Writing: Write your language code in
main.ht
. -
Execution: Use
HTVM.exe
or compile the C++ code to generate the output. Choose the target language by specifyingcpp
,py
, orjs
on the first line ofHT-instructions.txt
. -
Built-in Functions: Define built-in functions at the bottom of
HT-instructions.txt
by duplicating the relevant section. -
IDE Integration: Compile
IDE-generator.cpp
to produceIDE-generator
. You can then run it withHT-instructions.txt
to generateIDE.html
, which includes an IDE with syntax highlighting and code completion features.
In the IDE.html
your code will always be saved in local storage, so if you reload the page, your code will still be there.
- Use
Ctrl+Shift+Alt+F
to format code. WARNING: Once you press it, there is no going back. You better know what you are doing. - Use
Ctrl+Alt+Shift+V
to toggle Vim mode on and off. Changes will not be saved
Usage: HTVM <yourCodeFileName.yourExtension> <HT-instructions.txt> [optional LangToTranspileTo]
Options:
<yourCodeFileName.yourExtension> The source code file to transpile.
<HT-instructions.txt> The instructions file for transpilation.
[LangToTranspileTo] Optional: Specify the target language (cpp, py, js).
Example:
HTVM main.ht HT-instructions.txt cpp
To run the transpiler, use the following command:
HTVM main.ht HT-instructions.txt
You need at least 2 parameters:
yourCodeFileName.yourExtension
HT-instructions.txt
You can also optionally specify the target language for transpilation.
Instead of relying on the instruction file for the target language, you can specify one of the following languages:
cpp
(C++)py
(Python)js
(JavaScript)
Example:
HTVM main.ht HT-instructions.txt cpp
First, compile HTVM.cpp
and run it with the same arguments:
g++ HTVM.cpp -o HTVM
./HTVM main.ht HT-instructions.txt
You can also include the optional parameter:
./HTVM main.ht HT-instructions.txt cpp
Compile IDE-generator.cpp
to produce IDE-generator
and run:
./IDE-generator HT-instructions.txt
This will generate IDE.html
, providing an IDE with features like syntax highlighting, code completion, and formatting options.