Skip to main content

Show HN: Tack, a fast lightweight scripting language for games and embedding https://ift.tt/OwI4Dg5

Show HN: Tack, a fast lightweight scripting language for games and embedding https://ift.tt/AsQU8JG Hi HN! Tack is a scripting language I've been working on sporadically for the past year or so, and intensely for the past few weeks. It originated out of a desire for something that was like Lua, but with a more familiar syntax, and without some of the other surprises in Lua such as the 1-indexed tables. It's also been a great learning project, and a very satisfying challenge! While the current version is early beta at best, I hope to continue working on it and maybe see some adoption. Despite the relative lack of optimization, I'm very pleased with the performance so far - although I haven't done a huge amount of benchmarking, it seems to be significantly faster than the stock Lua 5.4 interpreter for the quicksort test, and the btrees test (copied from the Computer Language Benchmarks Game). The language is designed for embedding in C++ programs, and is written in C++ more or less from scratch including the handwritten recursive descent parser, and a register-based compiler/interpreter. The only dependency other than the standard library is my C++ adaptation of the khash library used for the object type - a from-scratch hashmap seemed not worth the trouble. Quick code example - more examples in the repo! fn quicksort(arr) { const n = #arr if n <= 1 { return arr } " find the midpoint " let l = min(arr) let r = max(arr) if r == l { return arr } const mid = (l + r) / 2 " split array into upper and lower " const upper = filter(arr, fn(x) { return x < mid }) const lower = filter(arr, fn(x) { return x >= mid }) " recursively sort the upper and lower sub-arrays and join the result" return quicksort(lower) + quicksort(upper) } let A = [] for i in 0, 1000000 { A << random() } let before = clock() let B = quicksort(A) let after = clock() print("Time taken: ", after - before, "seconds") Building requires just cmake and a C++20 compiler - tested with MSVC 2022, g++11 on WSL and Clang 15 on M1 https://craftinginterpreters.com was a great help with implementing closures, as I had gone down a blind alley with my first approach for locating the closed-over variables. However I have taken a slightly different approach towards boxing. As I do intend to use this for some small games myself going forward, there is a standard library already, and plans to expand it. I also intend to release a GLFW-based mini game framework along with precompiled binaries, so hobbyists (and younger relatives!) may use it without needing a full compiler toolchain. I would love if anyone is interested enough to try it out! James https://github.com/PlumeCat/tack May 14, 2023 at 11:39PM

Comments

Popular posts from this blog

Show HN: Moderator,lightweight peer4peer anon forum https://ift.tt/3fZSDGl

Show HN: Moderator,lightweight peer4peer anon forum hello all! here's a link to my little pinteresting like forum that stores no data on the server and uses IPFS for image storage. The design aesthetic is that everything would in 64kb of memory so we're going for a collapse-proof low bandwidth experience. this makes moderator really fast. https://moderator.rocks is the web preview, a flutter client is in the works at https://ift.tt/32wqdRb take a look, post something fun, ask questions. I'm also on twitter @moderatorium in case interested. Have fun! January 26, 2022 at 12:23AM

Show HN: Tape It, iOS recording app for musicians https://ift.tt/3udBTSi

Show HN: Tape It, iOS recording app for musicians Hello HN, Over the last 15 months, two friends and I developed the music recording app we felt we wanted based on our own needs as musicians. It's called Tape It [1] and has just recently hit the Apple App Store [2]. We put a lot of effort into a good UX to help musicians really focus on playing their instrument instead of pretending to be a recording engineer. The app records in stereo on newer iPhones (although that's a premium feature; the free version only records in standard mono audio quality). I would be really grateful for advice from this community on how to best approach marketing. We had a great TechCrunch article covering our launch [3], and we posted it on various music websites. Turns out advertising on Google or Apple Search is a dark art, though. We have some good ideas for developing a good social media presence, but they will take time. Please hit us with feedback, opinions and advice that you think a young ind

Show HN: Comment on live websites just like you comment on Google Docs/Figma https://ift.tt/GRhrjX0

Show HN: Comment on live websites just like you comment on Google Docs/Figma I'd love your feedback on this new JS plugin we launched. With this, you can comment on live websites just like you comment on Google Docs or Figma. You can use is to get Copy or UI feedback right on the website you are building. Feedback can be provided in rich formats like audio and video. You can get started by installing a JS tag in the footer of the website. You can then turn the review mode on or off on demand by adding “?review=true” to the URL. Demo video (43s): https://www.youtube.com/watch?v=cdnfBEw8TfI Demo video: https://www.youtube.com/watch?v=h6vxzXJuh8o https://ift.tt/ocLpdEu October 26, 2022 at 02:18AM