fener
is a interpreted ruby/lua-like language. It is a object-oriented programming language with first-class functions.
This is fener
. A easy language written in Golang.
It's a dynamicaly typed language with object-oriented features.
It is designed similar to languages like Ruby
or Python
.
Here's the FizzBuzz
program written in fener
fn fizzbuzz(n)
if n % 5 == 0 && n % 3 == 0 then
print("FizzBuzz")
elif n % 3 == 0 then
print("Fizz")
elif n % 5 == 0 then
print("Buzz")
else
print(n)
end
end
This language is a hobby project under heavy development. It's versatile and capable enough for small programs.
It's designed for reading and experimenting.
To use fener, you need the single binary.
You can get fener by using the Go
compiler.
go install github.com/pspiagicw/fener@main
Or if you use gox.
gox install github.com/pspiagicw/fener@main
To compile the project, you only need the Go
compiler.
git clone https://github.com/pspiagicw/fener
cd fener
go build .
fener has a extensive suite of tests. It's written in Go's native test runner.
Which depends on the fener binary being compiled inside the project directory.
go build .
go test ./...
You can run specific tests or get information about all subtests.
# Run only lexer tests, but show all subtests
go test -v ./lexer
This project is under heavy development and contributions are highly appreciated. A lot of decisions are yet to be taken, and you can be part of them.
fener
is a expression based language.
Every valid statmeent/expression returns a value.
You can interact with fener
using the REPL.
Run the repl using
fener repl
.
You can run arithmetic expresions.
>>> 1 + 2
int(3)
>>> 1 + 2 * 6 / 7 - 1
int(1)
fener has 3 fundamental data types.
>>> 10
int(10)
>>> true
bool(true)
>>> false
bool(false)
>>> "this is a string"
str(this is a string)
Complex data types include classes
, list
and maps
.
lists
andmaps
are not implemented yet.
- Lists
>>> [1 2 3 4 5]
[int(1) int(2) int(3) int(4) int(5)]
- Maps
>>> { "name" = "Chris" "surname" = "Pratt" }
{ str(name)->str(Chris) str(surname)->str(Pratt)}
Classes are covered later.
There is a bonus type null
, which is returned by builtin functions and some statements.
It can't be used by the user.
Variables don't have any type, they can hold value of any type.
The assignment expression <name> = <variables>
returns the value.
>>> a = 20
int(20)
>>> b = 10
int(10)
>>> a + b
int(30)
>>> a = "something"
str(something)
>>> a
str(something)
;; these are comments.
;; Comments are marked by 2 consecutive semicolons.
fener
supports if-expressions and while-statements.
You can declare functions using the fn
keyword.