trionex-tx
v0.4.0
Published
TRIONEX TX - a simple, beginner-friendly, cross-platform programming language. Write once. Build everywhere.
Maintainers
Readme
TRIONEX TX
A simple, beginner-friendly, cross-platform programming language.
Write once. Build everywhere.
What is TX?
TX compiles to multiple targets from one source:
- JavaScript — Node.js and browser
- HTML/CSS/JS — websites
- Kotlin + Jetpack Compose — Android apps
Installation
npm install -g trionex-txRequires Node.js 16 or newer.
Quick start
Create hello.tx:
print "Hello World"Run it:
tx run hello.txOutput:
Hello WorldCLI
| Command | What it does |
|---------|-------------|
| tx run file.tx | Run a TX program (interpreter) |
| tx compile file.tx | Compile TX to JavaScript |
| tx build web file.tx | Build a website (dist/index.html) |
| tx build android file.tx | Generate Android Kotlin project |
| tx new MyApp | Create a new TX project |
| tx --version | Show version |
| tx --help | Show help |
Language
// Variables
name = "Ali"
age = 20
// Functions
function greet(name) {
return "Hello " + name
}
// Conditions
if age >= 18 {
print "Adult"
} else {
print "Minor"
}
// Loops
repeat 5 { print "Hi" }
for item in ["a", "b", "c"] {
print item
}
// Built-ins
print upper("hello")
print sort([3, 1, 2])
print len([1, 2, 3])Web UI
app "MyApp"
screen Home {
heading "Welcome"
text "This is a real TX app."
button "Login" { navigate Login }
}
screen Login {
heading "Login"
button "Back" { navigate Home }
}Build it:
tx build web myapp.tx
REM creates dist/index.htmlAndroid
tx build android myapp.tx
REM creates build/android/ - open in Android StudioTests
node tests/test.js REM 55 interpreter tests
node tests/compiler.test.js REM 37 compiler testsLicense
MIT
