Git Product home page Git Product logo

fener's Introduction

fener

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

Status

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.

Getting Started

To use fener, you need the single binary.

Go

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

Compile

To compile the project, you only need the Go compiler.

git clone https://github.com/pspiagicw/fener

cd fener

go build .

Testing

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

Contribution

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.

Semantics

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.

Arithmetic

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 and maps 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

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)

Comments

;; these are comments.
;; Comments are marked by 2 consecutive semicolons.

Flow

fener supports if-expressions and while-statements.

Functions

You can declare functions using the fn keyword.

Builtin

Class

fener's People

Contributors

pspiagicw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.