Programming language with frogs
Programming language with frogs
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
Log in to leave a comment
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
Log in to leave a comment
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
Log in to leave a comment
ok wtfuck i need to make more devlogs, in order from olddest to i just made this feature:
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
Log in to leave a comment
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
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
Log in to leave a comment
started working on rust transpiler, which takes the ast i made and then turns it into rust code
Log in to leave a comment
succesfuly managed to parse fibonacci, this involves:
Log in to leave a comment
if statements now fully work, including else if and else, and several else if
(1) output ast
(2) input frg code
Log in to leave a comment
more treeslator stuff:
Log in to leave a comment
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
Log in to leave a comment
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)
Log in to leave a comment
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
Log in to leave a comment