Barn: Simple and Efficient Programming Language 🚀

Barn is a simple and efficient programming language designed for beginners and experienced programmers alike. It is compiled to C, making it fast and portable. Barn has a clean and easy-to-read syntax, making it a great choice for learning programming. It also has a growing community of users and contributors.

So, the whole Barn adventure started when I got back from school, wondering about how compilers really work. I decided to dig into the topic a bit more. After picking up some knowledge, I thought, "Why not create my own programming language that will compile to C?".

Now, why the name Barn? No clue, but it just stuck up because how short and easy it is (Barn means Children in Swedish... So saying "I like barn" in beautiful Stockholm might be a little risky).

The first compiler of barn, was named BarnGo, it was a bit of a mess and had lots of design issues. So, I decided to ditch the GoLang version and roll up my sleeves for a fresh start in C sometimes named BarnC.

And here we are, on this wild ride of Barn development. It's been a journey, fixing things, making it better. Who knew diving into compiler intricacies could lead to this? Anyway, we're making a language, having some fun, and maybe learning a thing or two along the way!
@import "std.ba"
@import "math.ba"

fun main() -> i32 {
println("Enter the radius of the circle:")
let circle_radius: f32 = parse_float(read_line_stdin())

if circle_radius < 0 {
println("Incorrect circle radius")
} else {
let circle_area: f32 = _MATH_PI * pow2(circle_radius)
fmt_printf("Circle area = πr² = %f\n", circle_area)
}

return 0
}
$ barn ./main.ba
$ ./b.out

Enter the radius of the circle:
20
Circle area = πr² = 1256.6