Angel \”Java\” Lopez on Blog

June 22, 2015

Erlang: Links, News And Resources (14)

Filed under: Erlang, Functional Programming, Links, Programming Languages — ajlopez @ 9:28 am

Previous Post

Leapsight Semantic Dataspace – for High Resolution Customer Engagament Marketing | Erlang Solutions

Webinars | Erlang Solutions

London Erlang User Group: Data and logic on acid: Introducing Leapsight Semantic Dataspace (LSD) | Erlang Solutions

Erlang: The Unintentional Neural Network Programming Language

Announcing gerl: Genetic Programming in Erlang

A Generalized Parallel Genetic Algorithm in Erlang


A genetic algorithm example in Erlang. | Dream Child

Programming in Elixir with the Phoenix Framework – Building a basic CRUD app · Garrett Heinlen

Introduction – Elixir

Elixir Documentation – Elixir

BEAM File Format

Hitchhiker’s Tour of the BEAM

Joe Armstrong

Erlang Factory SF Bay Area 2015

Reactive Cloud Actors: An Evolvable Web of Events

gut is a template printing, aka scaffolding, tool for Erlang. Like rails generate or yeoman

FiaR @ ErlangBA Meetup by Inaka Labs on Prezi

Tiny Actor Run-Time in JavaScript

My Links

Stay tuned!

Angel “Java” Lopez

June 19, 2015

Erlang: Links, News And Resources (13)

Filed under: Erlang, Functional Programming, Links, Programming Languages — ajlopez @ 10:27 am

Previous Post
Next Post

[erlang-questions] Why do we need modules at all?

How I Start.


Erjang – inside Erlang on the JVM // Speaker Deck

Erjang – A JVM-based Erlang VM

integration – Java to Erlang messages – Stack Overflow

Erlang — The Jinterface Package

Erjang, Why? – Java to the Limit


Prettt-tty, pretty, pretty good!: Actors are not a good concurrency model

5 Programming Languages You’ll Need Next Year (and Beyond) – Dice News

My Links

Stay tuned!

Angel “Java” Lopez

December 10, 2014

SimpleLisp (2) Compiling Lisp Values and Variables to JavaScript

Previos Post

Let’s review the project’s implementation

the Lisp compiler to JavaScript, written in JavaScript, following the workflow of TDD (Test-Driven Development). All is “work in progress”, so today I will explain part of the implementation but it could be change in the future, when new use cases were added, and new ways of doing things were implemented.

I took the decision that each Lisp symbol is a JavaScript variable. So, the compilation of a symbol is:

exports['compile symbol'] = function (test) {
    test.equal(sl.compile('a'), 'a');

The sl is the SimpleLisp module, loaded in this test file (test/compile.js)

An integer and an string are compiled to natural values in JavaScript:

exports['compile integer'] = function (test) {
    test.equal(sl.compile('42'), '42');

exports['compile string'] = function (test) {
    test.equal(sl.compile('"foo"'), '"foo"');

It’s quoted values, too:

exports['compile quoted integer'] = function (test) {
    test.equal(sl.compile("'42"), '42');

exports['compile quoted string'] = function (test) {
    test.equal(sl.compile("'\"foo\""), '"foo"');

I decided to compile Lisp nil to JavaScript null. The boolean values are the same:

exports['compile nil'] = function (test) {
    test.equal(sl.compile('nil'), 'null');

exports['compile booleans'] = function (test) {
    test.strictEqual(sl.compile('false'), 'false');
    test.strictEqual(sl.compile('true'), 'true');

But, what happens if an expression serie is compiled? I build an anonymous function, invoked without arguments, and the last expression value is returned:

exports['compile two symbols'] = function (test) {
    test.equal(sl.compile('a b'), '(function () { a; return b; })()');

Next topics: compilation of a Lisp lisp, and more quoted values, macros, ect.

Stay tuned!

Angel “Java” Lopez

November 25, 2014

SimpleLisp (1) Compiling Lisp to JavaScript

Next Post

I implemented Lisp as interpreter, using C#, Java, and JavaScript. See:

The implementation of a Lisp is a good programming exercise. Lisp is a simple and powerful language, with functions as first class citizens. And with the “twist” of implementing functions that don’t evaluate their arguments, and macros.

This time, I want to implement a Lisp, but as a compiler. I started to write a Lisp compiler in JavaScript, that generates JavaScript. The project:

As usual, I worked using the Test-Driven Development workflow. With simple use cases, I implemented the needed features. This is my first Lisp compiler, so I’m trying new implementation approaches. I know Clojure, as a basis for a Lisp compiler. I should implement:

Symbols: identifiers witn name and associated value. Now, I’m compiling them to JavaScript variables. In SimpleLisp, a symbol can be defined at top, in a let block, or as a function argument. Then, I produce a top variable (or a least, a module variable), or a local variable in let, or an argument in function.

Functions: I’m translating a normal function in Lisp to a normal function in JavaScript. The main difference is that Lisp functions returns a value, there are no commands, all are expression, as in Ruby. A list in SimpleLisp is then compiled to a function call in JavaScript.

Special Forms: Their implementation is a novelty to me. In a compiler, I could generate directly the final code for each list with a head that is an special form. So, I’m compiling directly to JavaScript any list with head if, do, let, etc… . A list (if ….) is compiled to a JavaScript if, but returning a value.

Macros: In a compiler, I could adopt a new implementation: to expand the macro at COMPILING TIME. I’m not sure yet if I can take this approach in every case. Notably, in Clojure a macro is not a functional value: a macro cannot be passed as an argument. A macro make sense only at compiling time.

A final use case: write a web site using Node.js/Express in SimpleLisp.

Stay tuned!

Angel “Java” Lopez

November 11, 2014

SimpleScript (2) The Lexer

Previous Post
Next Post

These days, I was working improving my SimpleScript compiler to JavaScript. Today, I want to comment the implementation of the lexer, the repo is

Now, the lexer code resides in a dedicated file lib/lexer.js, that expose a module, that can be consumed from Node.js and from the browser. It starts defining the token types:

var lexer = (function () {
    var TokenType = { 
        Name: 1, 
        Integer: 2, 
        Real: 3, 
        String: 4, 
        NewLine: 5, 
        Separator: 6, 
        Assignment: 7 };

Then, it defines some operatores, delimiters, and the Token, with two elements, type and value.

var separators = ".,()[]";
var assignments = ["=", "+=", "-=", "*=", "/="];
var operators = ["+", "-", "*", "/", "==", "!=", "<", ">", "<=", ">="];

function Token(value, type) {
    this.value = value;
    this.type = type;

The main job is in the Lexer “class”, with the method nextToken:

function Lexer(text) {
    var length = text ? text.length : 0;
    var position = 0;
    var next = [];

    this.nextToken = function () {
        if (next.length > 0)
            return next.pop();


        var ch = nextChar();

        if (ch === null)
            return null;

        if (ch === '"' || ch === "'")
            return nextString(ch);

        if (ch === '\n')
            return new Token(ch, TokenType.NewLine);

        if (ch === '\r') {
            var ch2 = nextChar();

            if (ch2 === '\n')
                return new Token(ch + ch2, TokenType.NewLine);

            if (ch2)

            return new Token(ch, TokenType.NewLine);

        if (isAssignment(ch))
            return new Token(ch, TokenType.Assignment);

        if (isOperator(ch))
            return nextOperator(ch);

        if (isSeparator(ch))
            return new Token(ch, TokenType.Separator);

        if (isFirstCharOfName(ch))
            return nextName(ch);

        if (isDigit(ch))
            return nextInteger(ch);

Finally, the module expose a lexer factory and the enumeration of token types:

return {
    lexer: function (text) { return new Lexer(text); },
    TokenType: TokenType

The code was developed using Test-Driven Development workflow. There is a file test/lexer.js, fragment:

function getToken(text, value, type, test) {
    var lexer = sslexer.lexer(text);
    var token = lexer.nextToken();
    test.equal(token.value, value);
    test.equal(token.type, type);
    test.equal(lexer.nextToken(), null);

exports['Get names'] = function (test) {
    getToken('foo', 'foo', TokenType.Name, test);
    getToken('foo123', 'foo123', TokenType.Name, test);
    getToken('foo_123', 'foo_123', TokenType.Name, test);
    getToken('_foo', '_foo', TokenType.Name, test);

exports['Get integer'] = function (test) {
    getToken('123', '123', TokenType.Integer, test);
    getToken('1234567890', '1234567890', TokenType.Integer, test);

Remember: no TDD, no paradise ;-)

Next topics: the parser, commands and expressions implementations, compilation to JavaScript.

Stay tuned!

Angel “Java” Lopez

October 31, 2014

Smalltalk: Links, News And Resources (20)

Filed under: Links, Programming Languages, Smalltalk — ajlopez @ 6:42 pm

Previous Post

Objective-Smalltalk talk at FOSDEM 2014 – YouTube

Alan Kay On Messaging

Pharo Smalltalk – YouTube

pathToolsFramework – Squeak Community Projects

Pharo4 Plans and Dreams – YouTube

39 – Leandro Caniglia – self ideas asStream next – YouTube

20 – Nicolas Petton – Amber Smalltalk – YouTube

32 – Hernan Wilkinson – Web Development In Smalltalk For Newbies – YouTube

15 – Dale Henrichs – tODE: And Now For Something Completely Different – YouTube

Smalltalk reddit

Where Smalltalk Went Wrong 2

Where Smalltalk Went Wrong

Saying Goodbye To Python

Interview with Esteban Lorenzano

The goal of RMoD is to support remodularization of object-oriented applications. This objective is tackled from two complementary perspectives: reengineering and modularity constructs for programming languages.

PhaROS – FOSDEM 2014 – Slides

My Links

Stay tuned!

Angel “Java” Lopez

August 19, 2014

Smalltalk: Links, News And Resources (19)

Filed under: Links, Programming Languages, Smalltalk — ajlopez @ 3:33 pm

Previous Post
Next Post

ESUG: 2014

Pharo Open Source Smalltalk — News


Philippe Back Interviews Nicolas Petton on Amber Smalltalk by philippeback on SoundCloud – Hear the world’s sounds


smallworks: Why I’m using git in my Pharo projects

Dyla’14 at PLDI, Edinburgh, UK


Self Mallard (4.5.0) released | Self

Self | Fun through simplicity

stic13 – YouTube

(349) Programming Languages: Why create any more programming languages? – Quora

Anyone interested in smalltalk? : learnprogramming

ST 4U 510: Dynamic Code Generation in Pharo

Was Alan Kay wrong? And why does that matter?

Smalltalk on Raspberry Pi | a blog on Smalltalk on the Raspberry Pi

My Links

Stay tuned!

Angel “Java” Lopez

July 27, 2014

AjTalk Implementing Smalltalk In C# (4) The Project

Filed under: .NET, AjTalk, C Sharp, Programming Languages, Smalltalk — ajlopez @ 5:48 pm

Previous Post

Year and a half since I didn’t write about this project in C #, but I was working on it, and the parallel implementation I have in JavaScript (in fact, I introduced some concepts of both the Smalltalks 2013 conference, Rosario, Argentina).

The project is at:

Current structure:

The projects are:

AjTalk: class library, with a compiler to bytecodes implementation. There is a compiler to JavaScript too. There is an interpreter of those bytecodes.

AjTalk.Compiler: a console project that uses the compiler to JavaScript.

AjTalk.Console: a simple REPL (Read Eval Print Loop)

AjTalk.Gui: a work-in-progress example using windows

AjTalk.Tests: the test I wrote, followin TDD (Test-Driven Development) flow.

I guess now I don’t need the compiler to JavaScript, because I have a native JavaScript implementation at:

It can compile to bytecodes or to JavaScript. The project is written in JavaScript.

The window implementation is very primitive. I plan to replace it for direct AjTalk program using .NET types and object.

One point that I find very interesting (in both projects, C # and JavaScript) is to have a modular implementation: instead of loading an image yet defined, my plan is to define modules to load, as happens in the Node.js environment . The modules would be published in the NPM (Node Package Manager’s), and each could indicate which modules need in your program instead of lifting all Smalltalk.

Another topic in this C # project I have implemented that can run more than one AjTalk machine at the same time. And I can even make a machine “help” to the other. For example, if the machine does not have to compile methods to new methods, machine B can go to his aid. Thus, A machine (and his image, I’m already recording binary image) can be kept small.

Another feature that I have implemented: the ability to send a message to an object, without waiting for a response, a “fire and forget”. And that the target object can attend ONE OF those messages as models of actors.

I have to review the implementation of remote objects (now based on the old Remoting. NET). But I think it is an important feature to maintain and explore.

Well, you see, many issues remain for other posts, such as implementation details Smalltalk concepts such as Object, Class, ClassDescription, Behavior, MetaClass, etc..

Nos leemos!

Angel “Java” Lopez

July 22, 2014

ClojSharp Implementing Clojure In C# (1) The Project

Since the past decade I’m interested on Clojure. It’s a return to Lisp, but in modern times.. Clojure is implemented on the Java virtual machine, but is also implemented on. NET (AFAIK, using Dynamic Language Runtime). The version of Java compiles to Java bytecodes. There is also a version of JavaScript, called ClojureScript. The community is very active, and has brought an air of renewal within Java. It has features like immutability of his work-oriented structures in multithreading, avoiding concurrency problems. It supports Software Transactional Memory, but has been less used by what I see. Web frameworks have emerged, and has a project and dependencies manager called Leiningen. Some links in my Clojure posts.

To deliberate practice TDD (Test-Driven Development) and C#, I was building an interpreter (not a compiler to bytecodes, yet). The project:

Current status:

It has a class library project, and a test project. There is also a REPL (Read Eval Print Loop) simple console application.

In Lisp, an expressions is composed by a verb and arguments, written in a list enclosed by parenthesis. For example, a list that at evaluation returns the sum of 1, 2 and 3:

(+ 1 2 3)

Here, the plus + sign is a symbol that in Lisp/Clojure refers to a form. A form receives arguments, operates on them, and returns a result. A typical form receives its arguments as evaluated expressions: the expressions are evaluated BEFORE the evaluation of the form:

(+ 1 (- 3 4) 3)

In the above example, the first argument to plus is a constant 1, and the second argument is an expression that is evaluated to –1 before the evaluation of the outer list.

But there are forms that not need evaluated arguments. They receive the arguments without evaluation. They are called special forms. I have implemented:

And I have implemented some (non special) forms as primitives in C#. Most of them could be implemented in Lisp itself, but being so basic that I preferred to implement them directly in C#, using TDD as usual:

Next topics: the Machine implementation, Context, how to use Parser and Lexer, more about expression evaluation, macros, tail recursion, etc.

Stay tuned!

Angel “Java” Lopez

July 19, 2014

SharpGo Implementing Go in C# (1) The Project

Filed under: .NET, C Sharp, Go, Google, Open Source Projects, Programming Languages, SharpGo — ajlopez @ 5:06 pm

There is another project of mine to practice TDD (Test-Driven Development) and C#, at:

It is an interpreter (not a compiler) of Go programming language, written in C#. It has a class library project, and a test project. Go is a typed language, so I cannot follow the path of build an expression tree, and evaluate it, as in RubySharp, PythonSharp and Mass. Instead, the interpreter should have many phases, as in ScalaSharp, to detect type inconsistencies, and use the declaration of unknown types at the parse process.

The AST is implemented:

The AST (Abstract Syntax Tree) nodes are in two groups:

– Command Nodes, where they should generate commands to be executed.

– Expression Nodes, that generates expressions to be evaluated. They have an associated type.

The commands declare variables with types. By now, I have all in place to start:

– Declare the types of some declarations of variables and functions
– Control that types are the right ones, ie, an integer variable should not be assigned to an string expression
– Start to emit commands and expression

As in other projects, I want to add access to native .NET types, libraries and objects. I should research how many features of Go I could implement in this approarch. An example: the implementation of Go structures, and their original semantic in C#. I could implement channels (years ago, I implemented channels in C# and AjSharp).

Stay tuned!

Angel “Java” Lopez

Older Posts »

The Shocking Blue Green Theme. Blog at


Get every new post delivered to your Inbox.

Join 68 other followers