frg banner

frg

14 devlogs
20h 48m 6s

Programming language with frogs

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 about 1 month 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 about 1 month 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