1.6.8 • Published 2 years ago
typestack-lang v1.6.8
TypeStack
A stack-based, type-safe language
Warning This is a work in progress language
Instillation for CLI
npm install typestack-lang -g
Running Files via CLI
# tsk is the file extension for typestack
typestack filename.tsk
VSCode
Download the extension to provide language support to .tsk
files.
Instillation for JavaScript
npm install typestack-lang
Running TypeStack
import typestack from "typestack-lang/dist/index.js";
await typestack(`
100 for loop {
dup 15 % 0 ==
if {
"FizzBuzz" print drop
} else {
int dup 5 % 0 ==
if {
"Buzz" print drop
} else {
int dup 3 % 0 ==
if {
"Fizz" print drop
} else {
int print
}
}
}
}
`);
Example FizzBuzz Program
100 for loop {
dup 15 % 0 ==
if {
"FizzBuzz" print drop
} else {
int dup 5 % 0 ==
if {
"Buzz" print drop
} else {
int dup 3 % 0 ==
if {
"Fizz" print drop
} else {
int print
}
}
}
}
Example Number Guess Program
# make the random number
1 100 rand
# repeat while the guess is wrong
loop {
"Guess a number: " int read
over over # create a copy of the guess and random number
== if {
"You are correct!" print
break
} else {
int over # create a copy of the random number on the top
> if {
"Too high!" print drop
} else {
"Too low!" print drop
}
}
}
1.6.8
2 years ago
1.6.4
2 years ago
1.6.3
2 years ago
1.6.2
2 years ago
1.6.1
2 years ago
1.5.2
2 years ago
1.6.0
2 years ago
1.6.7
2 years ago
1.6.6
2 years ago
1.6.5
2 years ago
1.5.1
2 years ago
1.5.0
2 years ago
1.4.1
2 years ago
1.4.0
2 years ago
1.3.1
2 years ago
1.3.0
2 years ago
1.2.0
3 years ago
1.1.0
3 years ago
1.0.2
3 years ago
1.0.0
3 years ago
0.0.1
3 years ago