All Projects → Feral-Lang → Feral

Feral-Lang / Feral

Licence: mit
Feral programming language reference implementation

Programming Languages

cpp
1120 projects
cpp11
221 projects
cxx
24 projects

Projects that are alternatives of or similar to Feral

Webassemblyjs
Toolchain for WebAssembly
Stars: ✭ 566 (+535.96%)
Mutual labels:  compiler, interpreter
Rascal
A simple Pascal interpreter written in rust.
Stars: ✭ 38 (-57.3%)
Mutual labels:  compiler, interpreter
Tiny Compiler
A tiny evaluator and compiler of arithmetic expressions.
Stars: ✭ 680 (+664.04%)
Mutual labels:  compiler, interpreter
Ph7
An Embedded Implementation of PHP (C Library)
Stars: ✭ 422 (+374.16%)
Mutual labels:  compiler, interpreter
Mir
A light-weight JIT compiler based on MIR (Medium Internal Representation)
Stars: ✭ 1,075 (+1107.87%)
Mutual labels:  compiler, interpreter
Renjin
JVM-based interpreter for the R language for the statistical analysis.
Stars: ✭ 466 (+423.6%)
Mutual labels:  compiler, interpreter
Cfl
a Compileable statically typed Functional programming Language
Stars: ✭ 7 (-92.13%)
Mutual labels:  compiler, interpreter
Craftinginterpreters
Repository for the book "Crafting Interpreters"
Stars: ✭ 4,298 (+4729.21%)
Mutual labels:  compiler, interpreter
Cymbal
Yet another Rust implementation of the Monkey language from "Writing an Interpreter in Go" and "Writing a Compiler in Go"
Stars: ✭ 49 (-44.94%)
Mutual labels:  compiler, interpreter
U6a
Implementation of Unlambda, an esoteric programming language.
Stars: ✭ 46 (-48.31%)
Mutual labels:  compiler, interpreter
Enso
Hybrid visual and textual functional programming.
Stars: ✭ 5,238 (+5785.39%)
Mutual labels:  compiler, interpreter
Flashforth
FlashForth development
Stars: ✭ 60 (-32.58%)
Mutual labels:  compiler, interpreter
Passerine
A small extensible programming language designed for concise expression with little code.
Stars: ✭ 341 (+283.15%)
Mutual labels:  compiler, interpreter
Red
Red is a next-generation programming language strongly inspired by Rebol, but with a broader field of usage thanks to its native-code compiler, from system programming to high-level scripting and cross-platform reactive GUI, while providing modern support for concurrency, all in a zero-install, zero-config, single 1MB file!
Stars: ✭ 4,725 (+5208.99%)
Mutual labels:  compiler, interpreter
V8
The official mirror of the V8 Git repository
Stars: ✭ 18,808 (+21032.58%)
Mutual labels:  compiler, interpreter
Bic
A C interpreter and API explorer.
Stars: ✭ 719 (+707.87%)
Mutual labels:  compiler, interpreter
Enso Archive
Looking for Enso, the visual programming language? ➡️ https://github.com/enso-org/enso
Stars: ✭ 305 (+242.7%)
Mutual labels:  compiler, interpreter
Umka Lang
Umka: a statically typed embeddable scripting language
Stars: ✭ 308 (+246.07%)
Mutual labels:  compiler, interpreter
Antlr4 Calculator
Simple antlr4 calculator.
Stars: ✭ 40 (-55.06%)
Mutual labels:  compiler, interpreter
Tiny Lisp
A tiny lisp compiler written in JS
Stars: ✭ 58 (-34.83%)
Mutual labels:  compiler, interpreter

About

Build Status

Feral is a dynamically typed, imperative, interpreted language which revolves (to most extent) around the idea of minimalism.

The primary example being that the language syntax itself does not contain anything related to imports, structure, or enums. Instead, there are libraries/functions that allow the user to import modules, and create structures as well as enums.

For feral, all imports, structures, enums, and functions are variables. This makes all of them a first class citizen. One can pass and modify all of those around in functions, etc, just like a normal variable.

Do note that Feral is not an object oriented programming language, but does support one primary construct - the dot operator.

variable.inside = 10;
let x = variable.func();

This makes the code a bit cleaner and easier to understand. See examples to understand its usage.

There is also a (WIP) book/guide for Feral available here: https://feral-lang.github.io/Book/ (source)

Examples

Hello World

let io = import('std/io');
io.println('Hello World');

Hello greeting using a function

let io = import('std/io');

let hello_fn = fn(name) {
	io.println('Hello ', name);
};

hello_fn('Electrux'); # prints 'Hello Electrux`

Simple factorial of 5 using a function

let io = import('std/io');

let facto = fn(num) {
	let fact = 1;
	for i in range(num, 1, -1) {
		fact *= i;
	}
	return fact;
};

io.println('factorial of 5 is: ', facto(5));

Creating an empty struct

let lang = import('std/lang');
let struct_t = lang.struct(); # empty structure type (struct with no fields)

Creating a struct with fields

# fields `a` and `b` of type integers having default values `10`, and `20` respectively
let lang = import('std/lang');

let struct_t = lang.struct(a = 10, b = 20);

To create objects of this structure:

# default values for struct fields
let struct_obj1 = struct_t(); # a = 10, b = 20

# overwrite first field's value (a)
let struct_obj2 = struct_t(30); # a = 30, b = 20

# overwrite using assigned argument
let struct_obj3 = struct_t(b = 30); # a = 10, b = 30

Installation

Prerequisites

To install Feral, the following packages are required:

  • CMake (build system - for compiling the project)
  • LibGMP (large integers)
  • LibMPFR (large floating point numbers)

Note: Feral doesn't yet support Windows.

Automated Build

You can automatically build Feral and its standard library by downloading and running build.sh. It requires Git and the packages listed under Prerequisites.

# Download the script (example using wget:)
wget https://raw.githubusercontent.com/Feral-Lang/Feral/master/build.sh
# Run it!
sh build.sh

Manual Build

Once the prerequisites have been met, clone this repository:

git clone https://github.com/Feral-Lang/Feral.git

Inside the repository, create a directory (say build), cd in it and run the commands for building and installing Feral:

cd Feral && mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release # optionally PREFIX_DIR=<dir> can be set before this
make -j<cpu cores on your system> install

By default, PREFIX_DIR=$HOME/.feral. Once installation is done, execute the installed feral binary ($PREFIX_DIR/bin/feral) to use the Feral language.

Post Installation

After installation is done, you'd probably also like to use the feral init command to initialize the $FERAL_HOME directory, which currently is $HOME/.feral. This directory is where external packages shall be installed.

Syntax Highlighting Extensions

As of right now, there are Feral language's syntax highlighting extensions available for Visual Studio Code and Vim editors. Installation steps can be found on their repositories.

Visual Studio Code: Feral-Lang/Feral-VSCode

Vim: Feral-Lang/Feral-Vim

Communication

Join us on Discord: https://discord.gg/zMAjSXn

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].