The best programming language since it's named after frogs
Table of Contents
Showcase
int jump =
map frog_ages =
vec swamp =
Frog wisest_frg =
frog_ages.iter.for_each
int jumps_remaining = jump
@print
Purpose
frg was made for one reason:
- The silly factor
Basically i took some Rust code, and sillyfied it. Heres an example
First, remove anything that doesn't have to be there in order to function. This includes any commas, semicolons, keywords, stuff like that
Next, seperate the declaration from the implementation (make it a closure)
// we still keep types!!
let jump: fn =
Lastly, rearrange everything and hide the exact data type (i32 -> int)
int jump =
You don't like not having an if keyword? Does that make you annoyed? Have three.
int jump =
You want to add another parameter? And a loop? Your greed is insulting.
int jump =
If you're insecure about the size of your -= or your >=, you should be, but also frg is perfect for you!
int jump =
If you can't comprehend the last expression in a function being the returned value, you can use the return keyword.
return jumping_frg.leg_count
"Oh but how does it know when one statement ends and one begins! I don't have my fucking semicolons!". This system works on hopes and dreams and is flawless.
int your_iq = 5 int recalc = your_iq -= recalc
But you can add semicolons if you want i guess.
int your_iq = 5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[!NOTE] semicolons can be used to guide treesitter since its stupid and needs them sometimes :(
More examples
Take some normal rust code, for example a vector declaration.
let mut number_list: = vec!
number_list -= number_list
(do everything above)
And done! Ideal frg code!
vec number_list =
number_list
The parser will not trust you after this one.
Features
Types
- Integers (
int) - Floats (
float) - Strings (
str) - Booleans (
bool) - Vectors (
vec(int)) - Maps (
map(str, int)) - Functions (
int(str)) - Structs (
StructName) - References (
&int)
These type aliases since you'll forget map somehow:
map:obj,hashmap,dict,dictionaryvec:array,arr,list
Plagiarized
Some pointer bullshit you can probably pull off (from C):
// this is one of the tests in this projects
&people.pets.* += calculate >= threshold * active
Functions as values (from Java i think):
// this is also a test
int average_java_developer =
Parentheses (invented by Lisp):
Semicolons (invented by javascript because i hate javascript and i hate semicolons):
// scroll up to the part about semicolons i hate talking about them more than i need too
STRUCTS!! FROM HIT LANGUAGE RUST!!
Person josch =
Dereferencing from Zig bc that syntax is nicee
&int var = &5
void increment =
increment
If Statements
Keywords? I think? im not sure i blacked out when i was adding this part. this code might ont even run but its in my tests (from python? maybe lua?)
if thing else if other_thing else
wait no keywords are optional
if if if thing else else else if if other_thing else if if
[!NOTE]
elseis required due to technical limitations (treesitter). Getting rid ofifis fine though.thing { } else other_thing { } else { }
Structs and Maps
also maps and structs share the same syntax so they have to be declared in their declaration
// THIS IS FINE
Frog frg =
map slur_count =
// THIS WONT WORK
frg =
slur_count =
// I THINK REASSIGNING THEM IS FINE THOUGH
Frog frg =
map slur_count =
You can declare struct literals like its Rust if you need them inline:
Frog new_frg = mitose
Also from Zig, builtins:
@print: Uses Rust's string interpolotation to println!
@<type>: Try casting to a certain BUILT IN type
treesitter is begging for its dear life
Basically anytime you see something that doesn't need to be there you can probably remove it. Or add extra.
// example: commas in maps
map round_table =
Voiding Values
When you call a function, its required to use all of it's values. If you don't need to use them, assign them to the special _ variable, which discards its value when its set:
_ = returns_value
Theres a special keyword for this action: void
void returns_value
Yes, it's the same void as the type.
[!NOTE] The void keyword is optional
returns_value
Installation
[!IMPORTANT] Rust is required to use this project. You can install Rust through the official website.
Cargo (Recommended)
You need Rust installed to use this project anyways.
cargo install frg- Only 29 dependencies, installs quickly and works on any platform
- Execute with
frganywhere
Linux
- Go to the latest release
- Download
frg-linux-[ARCH] - Rename to
frg - Execute with
./frgwhile in the directory with the binary
MacOS
- Go to the latest release
- Download
frg-macos-[ARCH] - Rename to
frg - Execute with
./frgwhile in the directory with the binary
Windows
- Go to the latest release
- Download
frg-windows-[ARCH].exe - Rename to
frg.exe - Execute with
frg.exewhile in the directory with the binary
Editor Setup
Helix
- Add this to your
languages.toml:
[[]]
= "frg"
= { = "https://github.com/Shuflduf/frg", = "*", = "tree-sitter-frg" }
[[]]
= "frg"
= "source.frg"
= ["frg"]
= ["//"]
= { = 4, = " " }
- Run
helix --grammar fetchandhelix --grammar build
VSCode
-
Download the extension from OpenVSX
-
Go the extensions panel in the sidebar (
Ctrl + Shift + X) -
Open the three-dot menu and select
Install from VSIX -
Select the downloaded extension.
Usage
Invoke the binary with its name, usually frg.
frg Transpiler and Runner (v2.0.0)
Usage: frg [FILE]
Options:
-h, --help Print this help menu.
-v, --verbose Show input code and intermediary treesitter, AST, and Rust.
-n, --no-exec Don't run generated Rust. Usually used with -v.
-e, --example Run an example. No args provided will list the examples.
Examples:
frg my_code.frg Execute a frg file.
frg --example List examples
frg -e fibonacci Run the fibonacci example
frg -v -n my_code.frg Show the process of a frg file being turned into Rust.
To write your own frg code, use your editor of choice, and add anything you want to a text file.
Having the file extension be .frg is not required, but is recommended.
If something isn't working as expected, use the -v flag to inspect the generated Rust to see if everything works.
Examples
fibonacci: Calculate a target fibonacci numberfactorial: Calculate a target factorial numberprimes: Lists numbers 1 - 50 and tells you if they're primeguessing: Higher or lower guessing game, this is the BIG one you SHOULD TEST
Style Guide
fuck around and find out