Code Monkey home page Code Monkey logo

ffe's Introduction

Forth Flavoured Erlang

This is forth on steorids in an Erlang environment send and receiving message running in parallell.

And it is nearly functional ...

module based forth.

words are organized into modules/vocabularies, words are called by using :, built in words are access directly without the : module separator.

The words in interactive mode are added into a special module.

: sqr dup * ;

In a module:

module foo

\ ( x -- (x*x) )
: sqr dup * ;

\ ( <a1> .. <an> <n> -- <sum> )
: sum 0 do + loop ;

If compiled then this is translated into the module foo.

-module(foo).
-export(['_ffe_sqr'/0,'_ffe_sum'/0]).

'_ffe_sqr'() ->
    { 0, <<"sqr">>, fun ffe:docol/4, ffe:star/0, ffe:semis/0 }).

'_ffe_sum'() ->
    { 0, <<"sum">>, fun ffe:docol/4, ffe:lit/4, 0, 
  fun ffe:pdo/0, 
     fun fee:plus/0,
      fun ffe:ploop/0, -2,
     ffe:semis/0 }.

CREATE DOES>

How do you compile CREATE DOES> in ffe? let's show an example.

: my-constant CREATE , DOES> @ ;

Compiles into

my-constant = 
  fun() -> {0,<<"my-constant">>, fun ffe:docol/4,
            fun ffe:'_ffe_create/0,
            fun ffe:comma/0,
            fun ffe:'ffe_does'/0,
            fun ffe:'ffe_fetch'/0,
            fun ffe:semis/0 }
  end.

This is a defining word that creat a constant used like this

10 my-constant ten

This compiles into

ten = 
  fun() -> {0, <<"ten">>, fun ffe:does1/4.
            {6, 

ffe's People

Contributors

tonyrog avatar

Watchers

James Cloos 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.