frg banner

frg

19 devlogs
35h 47m 3s

Updated Project: Remade the entire thing using treesitter and the Rust transpiler. The previous version used a really bad custom parser and an interpreter.
YOU NEEEED RUSTTT INSTALLEEDD!!!!
Programming language based off frogs.
I tried to mak…

Updated Project: Remade the entire thing using treesitter and the Rust transpiler. The previous version used a really bad custom parser and an interpreter.
YOU NEEEED RUSTTT INSTALLEEDD!!!!
Programming language based off frogs.
I tried to make it as nonsensical as treesitter could possibly allow me, which is a lot.
Also includes some examples, such as a prime number finder and a guessing game.
It’s BLAZINGLY FAST since it just transpiles to Rust, this means YOU NEED RUST INSTALLED FOR THIS TO WORK.

Demo Repository

Loading README...

AVD

Tagged your project as well cooked!

🔥 AVD marked your project as well cooked! As a prize for your nicely cooked project, look out for a bonus prize in the mail :)

Shuflentity

Shipped this project!

Hours: 35.78
Cookies: 🍪 1010
Multiplier: 28.22 cookies/hr

I made a programming language using a bit of treesitter and a LOT of Rust.
The highlight feature is the silly ass syntax where you can just bullshit your way into making it work. It doesn’t have a compiler or interpreter, it instead transpiles to Rust, so you do need some Rust knowledge to do some advanced stuff with this language.

The challenging part was treesitter, I would’ve done everything in Rust if I could, and I did try (that’s what rcket was), but it didn’t go anywhere so I had to make compromises on the grammar in order for everything to work at all. This project is an 8/9 in all categories with the feedback having a large focus on the interactable pet frog you can play with in the CLI. I also had some difficulties with cc (Rust build tool thing), but the issue was once again treesitter because it generated a Cargo.toml which stopped the build from working at all, but this bug ONLY occurred when publishing, not when doing cargo run or cargo build.

I’m proud of how polished everything is. I have a github action that automatically checks if the version was bumped, and if it was, it compiles frg for all major platforms and architectures and publishes to crates.io. I also have a VSCode extension for syntax highlighting that no one will ever find because FT users are sheep. The CLI is also very polished, it uses ANSI codes to bold and underline and dim certain text to make the whole thing look better. The whole project is the closest thing I have to a “real” product.

Shuflentity

I GOT IT TO PUBLISH TO CRATES IT WAS LIKE A SINGLE COMMAND!!!!

most of the work was on the readme and the repo, like the ci which now build for every platform for arm and x64

fixed a couple of bugs and i think im ready to ship now!!

Attachment
1

Comments

Ghost of Nova
Ghost of Nova 12 days ago

frogs

Shuflentity

three example programs, factorial, fizzbuzz, and number guessing game.

each of these somehow had its own challenges to overcome, which shows that this is kinda incomplete but idc
factorials needed me to fix ranges
fizzbuzz needed to implement modulus
and number guessing needed to implement the @rand builtin and while loops

0
Shuflentity

im shipping today so i gotta make sure its as idiot proof as possible
so i made a system for examples that will allow anyone to run any example with one single command, and its built into the binary, so it doesnt rely on any files being next to the binary or anything.
the video is just an example of what i think a normal user would experience when using it, i hope

0
Shuflentity

making the language actually USEABLE
i added user inputs and type conversions between ints and strs

using builtins was so smart for this thank you zig

Attachment
Attachment
0
Shuflentity

THANKSSS HACKATIME INDEX CORRUPTION OR SOMETHING PREVENTING ME FOR DEVLOGGING AT ALL!!!!!!!!!!!

k so this is gonna be lik 9 devlogs in one

  1. improved frg output and formatting, as well as a clearer verbose mode. i could probably improve this with ansi formatting codes but there are bigger issues to worry about
  2. more work on the treesitter grammar! it will take 100 hours to make a parser that can compete with ts, so i have to settle with making the syntax more boring. i learned regex just so i can avoid writing repeat1 and repeat and stuff, its honestly kinda easy (yes i am showing code screenshots deal with it)
  3. lots of tests to deal with the new grammar. i made a really hard one and a couple of variants and if i cant parse it im a failure
  4. better error handling when rustc isnt installed, with like a link to rust download and everything
  5. SYNTAX HIGHLIGHTING!!!!!!!! i currently have it working for helix via treesitter and vscode through a openvsx extension which uses something else i forgot
  6. a readme so massive it has a fucking table of contents. thats huge (and yes, there is a proper style guide)
  7. the help prompt that you get when running frg -h or frg –help, i just straight up stole it from mcx which used a library, but i did it manually with like ansi codes and stuff
  8. bigggg refactors, mostly to use FileBufs instead of strings when trying to access files, which should make it safer
  9. fuck around with treesitter precedence and remember why i started making an alternative in the first place (its so fucking annoying i cant get it to work) (no image because max of 8)
Attachment
Attachment
Attachment
Attachment
Attachment
Attachment
Attachment
Attachment
0
Shuflentity

dealt with some annoying fucking bullshit, now im just trying to make the readme. its very heavily inspired by https://github.com/TodePond/GulfOfMexico (formerly known as Dreamberd). one of the bugs i had was a statement being parsed differently depending on how many variable declarations were next to it, like if you had [var decl] [very buggy struct decl] [var decl] then it wouldnt parse correctly, but changing the var decls to any other statement would make it work and getting rid of either var decl also fixed it. bullshit

Attachment
Attachment
0
Shuflentity

spent like two hours yesterday trying to get syntax highlighting in helix so im extremely demotivated rn. anyways i got the rust runner to kinda work. first it prints the input frg code, then the intermediate rust code, then the result of executing the rust code

Attachment
0
Shuflentity

uhh i made ranges for string slices, and empty collections dont brick everything now. most of the language is done, i just need type casting, user input, and a way to actually run the generated code

Attachment
Attachment
0
Shuflentity

ok wtfuck i need to make more devlogs, in order from olddest to i just made this feature:

  • declaring vecs
  • references fully work
  • accessing vecs
  • sets
  • all methods can now be used (calling rust method on a set for example)
  • made maps
  • making maps broke structs so i fixed structs
  • refactor treesitter grammer to make it more verbose but more useful
  • accessing elements with index (list[4])
Attachment
Attachment
1

Comments

kashsuks
kashsuks 4 months ago

FRG!!!!

Shuflentity

kinda simple but variable assignment. i feel like this is the point where its getting to the point where the resulting rust code is semi useable now
second image is input frg code
first image is the resulting rust

its kinda one to one, but it works and thats what matters

Attachment
Attachment
0
Shuflentity

im just at the grindy part where i get to implement all the features. its still so much faster than my last attempt thanks to treesitter being awesome. my previous method was like [source code -> lexing -> building ast -> interpreter] but now its like [source code -> treesitter -> treeslator -> transpiler] and its so much easier. anyways structs

Attachment
1

Comments

Ghost of Nova
Ghost of Nova 4 months ago

this looks cool!

Shuflentity

rust transpiler is basically done, its just a bunch of edge cases. the flashiest thing i did was functions, which are actually just rust closures.
original frg source - 1
resulting rust - 2

Attachment
Attachment
0
Shuflentity

started working on rust transpiler, which takes the ast i made and then turns it into rust code

  1. the original frg source
  2. transpiled rust code
  3. RAW transpiled rust code
Attachment
Attachment
Attachment
0
Shuflentity

succesfuly managed to parse fibonacci, this involves:

  • fixing binary operations
  • multiple statements
  • function calling again for some reason
Attachment
Attachment
0
Shuflentity

if statements now fully work, including else if and else, and several else if
(1) output ast
(2) input frg code

Attachment
Attachment
0
Shuflentity

more treeslator stuff:

  • function calling (1)
  • indexing into things (1)
  • very basic if statements (2)
Attachment
Attachment
0
Shuflentity

treeslator (thing that turns treesitter tree into rust tree) now works on very basic variable declarations, including negatives, which is something my previos attempt at this didnt allow

Attachment
0
Shuflentity

i spent like 3 hours trying to link the c code from treesitter into my rust code, and the solution was deleting the lib.rs file because having a lib.rs file, so now im on converting ts syntax (ugly, bad, slide 1) into a beautiful rust struct and enum representaion (clean, elegent, slide 2)

Attachment
Attachment
0
Shuflentity

starting the rewrite of this project, so far i wrote most of the parser with tree sitter, which is really cool i love tree sitter i love sitting on trees, also its so much better than hardcoding everything in rust

Attachment
0