GithubHelp home page GithubHelp logo

krircc / floyd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from floydlang/floyd

0.0 1.0 0.0 184.5 MB

The Floyd programming language

License: MIT License

CMake 1.71% C++ 82.53% C 0.04% Nix 0.13% Makefile 0.20% Python 0.40% Shell 0.11% Scheme 0.20% JavaScript 14.33% HTML 0.07% Clojure 0.08% Dockerfile 0.04% Scala 0.13% Ruby 0.02%

floyd's Introduction

License: MIT

Status: Alpha. All the basics of the language are finished and robust. Runs on bytecode interpreter. Will run natively soon. Production ready for smaller programs. The next step is implementing the LLVM backend and the data structure optimisation features.

ROADMAP

CURRENT MILESTONE

This repo holds the compiler, the bytecode interpreter and documentation.

WHAT IS FLOYD?

Floyd is a general-purpose programming language designed for making very large and robust programs that run really fast, while ducking many of the problems of older languages. Floyd wants to become a better choice than C++, Rust, C#, Python and Javascript for any project.

The goal is to make a programming language that:

  • Executes faster than the same programming written in C or C++ - it should become the preferred language to write a video game engine with, for example

  • Makes it fast and simple to program - less accidental complexity

  • Helps you make big programs that are fun and straight forward to work on for a long time

  • Simple built-in support for concurrency and parallelism

How can this level of execution speed be reached? By designing Floyd to give exceptional freedom to the compiler and runtime to drastically control the mapping of the program's execution to the hardware. The programmer supervises this mapping interactively using a profiler-like tool. This is done separately from writing the program logic. Precise selection of data structures, exact memory layouts, data packing, hot-cold data, hardware caches, thread tasks priorities, thread affinity and so on.

Floyd separates your program into three separate concerns:

  1. Writing the program logic
  2. Programming internal concurrent processes and how they access the outside world
  3. Mapping the program to the CPU and memory system

Floyd compilers and tools are written in C++ 17 and compiles with Clang and GCC.

Floyd's web page: www.floydlang.org

LANGUAGE SYNTAX

Floyd looks like Javascript and has a lot fewer features, syntax and quirks than most languages. Floyd is statically typed with type inference. It's got built in types for vectors, dictionaries, JSON, a struct type and strings. All values are immutable / persistent data structures using HAMT and other techniques.

Notice that the last example gives you a NEW dictionary - it doesn't change the old one

It's a mashup of imperative, functional and OOP. Functions defaults to pure (but with normal local variables).

Floyd has no classes, no pointers / references, no tracing GC (uses copying and RC), no threads, mutexes, atomics and no header files. No Closures. No generics.

TBD: protocol type for simple polymorphism, basic encapsulation feature, sum-type and limited lambdas.

CONCURRENCY, STATE AND THE WORLD

Processing and concurrency is done using Floyd's virtual processes and message passing. Each Floyd process has its own private state and is sandboxed. Floyd processes can interact with the world, calling OS APIs and accessing files. Keep this code small, with minimal logic.

The bulk of your program should be blue code - pure code.

PARALLELISM

(Implementation in progress)

Safe parallelism is built in using map() reduce() filter() and supermap(). Like shaders running on a GPU. They share an internal OS thread team with the Floyd processes.

BYTECODE AND NATIVE

Floyd runs on a bytecode interpreter (now) and natively using LLVM (implementation in progress). Both will be available.

OPTIMIZATION

(Implementation in progress)

You optimise your program by running it and augmenting your Floyd processes and their function call graph. Each process has its own optimisation settings. This automatically generates new optimized versions of affected functions. This cannot introduce defects! Examples:

  • Change memory layout of structs, order, split, merge, array-of-structs vs struct-of-arrays.
  • Select backend for collections: a dictionary can be an array with binary search, a HAMT, a hash table or a red-black tree - all with different performance tradeoffs.
  • Control thread priority, affinity, how many threads to use for the parallelization features.
  • Insert read or write caches, introduce batching.

STATUS

The essentials of Floyd are up and running and very robust (approximately 1000 tests), including the concurrent Floyd processes. The compiler generates bytecode that runs at about 5-10% of native speed on the interpreter. The manual is complete.

A handful features are needed for a satisfying 1.0: rounding out the language features somewhat and then it's all about performance.

IN THE BOX

Item Feature
Floyd Manual Programming language manual
Core Library Manual File system access, JSON support, hashes, map() etc.
Floyd compiler Compiles Floyd source code to byte code
Floyd bytecode interpreter Runs your program

LOOKING FORWARD

ROADMAP

CURRENT MILESTONE

floyd's People

Contributors

ebiroll avatar marcusz 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.