Bazinga! is a multi-paradigm, dynamically-typed language based on 'The Big Bang Theory' show. The language is turing-complete but is far from being a complete and usable language, I just hope its enough to humiliate my teacher! xD
Humiliate my teacher at a coding competition 😁
Boolean
String
Number
spot variableAreNamedInCamelCase = 0;
if (2 == 2) {
eureka "xD";
}
while (true) {
eureka "I will be here forever";
}
for (spot i = 0; i < 5; i = i + 1) {
eureka "I will actually never be executed because of the loop above";
}
fun sayHello(a, b) {
spot result = a + b;
bazinga result;
}
Note, that instead of return
we have bazinga
:D
class Animal {
init(name, age) {
this.name = name;
this.age = age;
}
talk() {
eureka "I'm an animal";
}
}
class Dog < Animal {
init(name, age, breed) {
super.init(name, age);
this.breed = breed;
}
talk() {
super.talk();
eureka "I'm from " + breed " breed.";
}
}
spot dog = Dog("Filipe", 16, "Teenager");
dog.talk();
Some popular keywords were changed to resemble the famous show.
print
->eureka
return
->bazinga
var
->spot
If you have ideas for changing some other keywords, all you have to do is edit the Scanner.java
file :D
print
(this is the only function that does not have paranthesis)Array(size)
(this as the additional.get(index)
and.set(index, value)
methods)Number(value)
floor(value)
split(array)
String(value)
readFile(path)
type(value)
There are two ways in which you can run Bazinga!, either by running the prompt or a file. To run the prompt just execute:
java Bazinga.java
And to execute a file:
java Bazinga.java [file_name.baz]
P.S. I plan in developing a more concise way of running Bazinga!, but for now it is not my priority. If you're
having trouble executing the a file you can always try to hardcode the file name inside main()
in Bazinga.java
and executing the file through your IDE.
This programming language would probably not exist if it was not for the incredible book, Crafting Interpreters by Robert Nystrom. The book is very well-structured and I would totally recommend it for anyone interested in building an interpreter. There is a paid physical copy of the book or a totally free web option, which you can find here.