Haystack
Haystack is a compiled, statically typed, stack-based language with opt-in variable assignment.
Install / Use
/learn @rtulip/HaystackREADME
Haystack
Haystack is a statically typed, stack-based programming language that adds opt-in variable assignment to improve ergonomics. Haysatck was heavily inspired by Porth. Note: This langue is is very early development and is subject to frequent and rapid changes.
Getting Started:
Getting sarted with Haystack is pretty simple, there's three requirements: rust, nasm, and ld. I'm working on Ubuntu, and can give no guarantee that Haystack will work properly on anything else. If you do give Haystack a try and something goes wrong, please open a bug and provide as many details as possible, and I'll do my best to try and figure it out. If you're using Windows, I recommend using virtualbox or something similar and get a Linux virtual machine until Windows is a supported target.
rust: I'm using nightly rustc version1.66.0, older versions should work, but I haven't tried to figure out what else works. See more about installing rust here. Once you've installed rust, use the commandrustup override set nightlyto switch to the nightly version of the rustc compiler.nasm: I'm using version2.13.02. I was able to install it usingapt.ld: I believe this was installed with the rest of the GNU Binutils, onUbuntu.
Install the project
You can clone the project from github
git clone https://www.github.com/rtulip/haystack
Run the tests
cd into the haystack directory, and run the tests with cargo t.
The tests run each of the .hay files under src/tests to make sure they produce the expected outputs. If all the tests pass you should be good to write your own programs using Haystack.
Compile and Run examples
You can try any of the examples under ./examples.
- You can compile the program with:
cargo r -- examples/name_of_file.hay - Add the
-ror--runflag to also run the program:cargo r -- examples/name_of_file.hay -r
Tutorial:
Check out the Tutorial to learn about how to use the language.
Example Programs
Here's a few simple programs to show off a little of what Haystack looks like:
Hello World
fn main() {
"Hello World" println
}
N'th Fibonacci Number
fn fib(u64: n) -> [u64] {
n 2 < if {
n
} else {
n 1 - fib
n 2 - fib +
}
}
Print Numbers 1 to 10
fn main() {
1 while dup 10 <= do {
as [i]
i println
i 1 +
} drop
}
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
