Angel \”Java\” Lopez on Blog

July 10, 2014

End Of Iteration 2014w27

Filed under: .NET, AjGenesis, C Sharp, Code Generation, Iteration, JavaScript, NodeJs — ajlopez @ 2:33 pm

Previous Post

Code Generation with AjGenesisNode

I updated and published new versions of my projects:

Now, there are new functions to manage the model directory in AjGenesis. That directory contains the JSON files that represent the model, ie entities, project settings, db settings, etc. It resides in “./ajgenesis/models”.

The code generation for Sinatra and Express was improved. Instead of create a project and then, generate a “build” subdirectory in project directory, now the code generation acts over the current project directory. This way is more straighforward, and more aligned with other projects that generates code: there is no “build” subdirectory.

I added the preserve of code regions by name. If a generated file has a code region delimited with special text, that region is preserved even when the file is regenerated.


My Dylan language interpreted in C#

I added more binary operations. I should add type support, but in the current use cases, the untyped evaluation is OK.


My Mule-like simple service bus in C#

I added message transformers, message processors, instead of play payload transformers and processors. And I added a Router object. So, the implementation has/will have:

– Lambdas that operates on payload (processors, transformers, outputs, routers)
– Lambdas that operatos on message (processors, transformers, outputs, routers)
– Objects that operates on payload (processors, transformers, outputs, routers)
– Objects that operates on messages (processors, transformers, outputs, routers)

A payload is an untyped object. A message has a payload and additional properties (by name/value).

JavaScript Samples

I wrote my first AngularJS samples

Dynamic Site in Express 4

Based on JSON definitions

I added the support of to load JSON files that have references to other JSON files. The site is a prototype based on pages defined in JSON files. So you can easy change the JSON data to alter the prototyped site. Next steps: add lists based on MongoDB collections, with views. Then, code generation for differents targets (Express 4? Laravel?)


I changed with minor improvements. I also worked on three non-public projects. More fun is coming.

Stay tuned!

Angel “Java” Lopez

June 27, 2014

End Of Iteration 2014w25

Previous Post
Next Post

Code Generation with AjGenesis

I published a new version of

My code generation tool, based on Node.js. Now, it can preserve files in generate tasks (if you want one of your files doesn’t overwritten). But the key change was to put models under current project directory, ajgenesis/models folder. In this way, I can put all the AjGenesis-related stuff in only one directory related to current project. So, I refactored and republished the modules and examples of:

Next steps: refactor to use the new directory, and refactor/complete the generation process in Express, Sinatra, Laravel, Django projects.


I worked on

implemented a simplified Mule-like message flow in C#, using TDD (Test-Driven Development). Now I have: input, output, transform, processors, routers, branches in flow. It was nice to see all in place, using “baby steps”, and the powerful lambdas of C#. I implemented transformer objects too. Next steps: instead of simply process a payload, start to process a complete message.


After attending a JavaScript meetup at Buenos Aires, I wrote a simple JavaScript curryfing function library:

Since then, I started to add some additional pieces, like partial application, and composition of functions.


Thanks to @fabiomaulo, I met state machine implementations in C#. So, I wrote my own version in JavaScript:

It has a fluent interface to define states, with triggers and actions. Next steps: add global triggers, and hierarchical states.


I added some functions to core and REPL. I worked on four private projects, too. More fun is comming.

Stay tuned!

Angel “Java” Lopez

June 11, 2014

End Of Iteration 2014w23

Previous Post
Next Post


My Go programming language interpreter in C#:

There are new nodes supported in parser. There are simple ones, but now the parser has a better coverage in order to implement simple use case. Next step: add some type checking, and generate commands and expression from parsed tree. I could generate commands and expression without type checking, as in an untyped interpreter. Or I could add type checking and generate the typed expression. In the first case, an add expression sums two objects. In the second case, an add expression sums two integers, or one integer and a float, or etc… In both cases, TDD helps me to implement the feature step by step.

PHP Samples and Laravel Code Generation

My scripts at:

I improved a bit my Laravel sample, using layouts, and now, Bootstrap for style. Laravel is a simple web framework, that I want to use in AjGenesis code generation for PHP. So, I updated:

too, to generate a seed site. Next steps: generate the Laravel model, migration, controllers from entity free model.


I added a simple figure to (a rectangle). So the API is in good shape, I published version 0.0.1 of I added some nodes to parser in I worked on two non-public projects, too. I started a sample accesing database, using Express version 4, at

Stay tuned!

Angel “Java” Lopez

May 14, 2014

End Of Iteration 2014w19

Previous Post
Next Post


I published a new version of:

A Node.js module to process argument options. I refactored some pieces, and now, the use of the module is more simple. The current API is inspired in the previous work, mixed with minimist project ideas, by @substack.

Code Generation for PHP Laravel

I started to write

using my AjGenesis code generation tool, based on Node.js. Only the first tests (models, create a project) are in place. Next steps: improve create project, and start generate site task and templates.

Clojure in C#

I updated

to use multifunctions (functions that have different bodies depending on number of arguments). It was good to see TDD helping me to add this functionality.


In my project:

scraper for JavaScript/Node.js, I added a new sample (scrap news from argentinean news site). And refactor some methods and internal implementation. TDD Rocks!

Go in C#

The SharpGo project:

I added new node to AST (Abstract Syntax Tree), some operators, lexer tokens, and parser tests.

I was working in three non-public projects, too.

More fun is coming.

Keep tunes!

Angel “Java” Lopez

April 26, 2014

Applications Creating Applications

I was working in different approaches to make programs create more programs. This post is a brief review of the path I took in the past years/months/weeks, and that it is still work in progress. I think they are interesting ways of doing programming, to be explored.

Dynamic Applications

The idea is to describe an application (entities, some relations, some code), and run it in a web runner that knows how to interpreted the application definition. I wrote a first implementation for past year Knockout competition:

More info at Dynamic Applications in Node.js.

The application could be described in a simple structure (in this example, a simple JavaScript object that can be serialized to JSON). The same structure could be interpreted and run by different host applications: a web application, an SPA, a mobile app, etc. And it could be used as a seed to generate code in a “concrete” technology, like Sinatra, Express+MongoDB, etc.

Code Generation

One of my preferred topics. I created tasks, templates and free models to generate applications in Express, and in other technologies (Sinatra, Django, Flask, PHP, all work in progress). I have implementations in C#, Ruby and Node.js. But my latest work is on Node.js:

You can have a simple example in:

Screenshots of a simple generated application:


And I’m working on creating an online site where you can describe the application (the free model, the features, databases, entities, web framework to use) and then download the generated application code.


In the project:

I describe each application as a set of cards (a deck). A card can have simple values, or a another card or deck. For example, a card could have an id, a name, a title to be displayed, and additional info. A card could have another deck of cards as a property (ie an Chemical Elements card could have a deck with one card by element). They can be rendered in different context: a web application, a web application as a Single Page Application, a mobile app (in Phonegap, or native). One thing is the structure and content of a card, and another thing is the render of a card. The later depends on the context of the host application.

A simple example

var model = {
    title: "My Deck",
    cards: [
        { title: "Card 1", text: "This is the card 1" },
        { title: "Card 2", text: "This is the card 2" },
        { title: "Card 3", text: "This is the card 3" }

Another sample, with screenshots:

A card content could be a simple text, a long text, an URL, an image, or a widget to be displayed by the hosted application (ie a Google Map). The card description could be static or could be generated on the fly (ie, a feed could be transformed to a card/deck, or it could be retrieved from a REST API). A card could have partial content (id, title), and a resolver can retrieve the rest of its content, using the id (ie, a card could represent a Wikipedia Page, and the id would be the URL; the resolver downloads the page content, and complete the card, if needed).

More fun is coming.

Keep tuned!

Angel “Java” Lopez

April 15, 2014

End Of Iteration 2014w15

Previous Post
Next Post

Code Generation

I wrote new tasks, templates using my AjGenesis code generation tool. I create a simple:

to generate a Django web site, with admin page. The code generation creates the model, and admin feature allows you to edit the data, using Sqlite. It’s simple, but it is working. Next steps: create custom views, and a new project to generate Flask web site.

I added text area input fields to the project that generates Express/Node.js web site from a model. Next steps: client-side validation, better server code organization, some initial tests.

I want to integrate these tools in a online app, so I started to have a web site that generate codes from a model, defined at client side. You will select technology (Express, PHP, Sinatra, Django, Flask, …), the models (mainly, entities like: customer, supplier, department, employee, invoice… ), the database, the features (multiple pages, single page, angular? backbone? other?, REST API?, phonegap wrapper?), and voila. A zip will be generated with the generated solution. That is, code generation as a service. Maybe I could add an API to be externally consumed.


I added a Flask web site example, work in progress, to my Python Samples:

I will use as a basis for my AjGenesis code generation version for Flask web sites.

Actor Model in C#

I refactored my project

an Akka-like actor model implemented in C#. Now, I have a mailbox per actor, but the actor message process is executed consuming task from a queue, with n thread launched by the initial actor system. It was good to see such refactor working: all is in place, now. It is a proof that you don’t need to design everything before coding. If you follow TDD (Test-Driven Development) new ideas (or old ideas that have not implemented yet) can be added without much effort.

Erlang in C#

I started to add serialization of message to my project

As usual, I started simple, using TDD: write input and out channel, using tests, red to green, refactoring. Instead of consuming an external library for serialization, I wrote a simple code, towards my first use case of distributed application. When the use case will be in place, I could start to think about other implementation path.

Google Code Jam

Past Saturday, I participated in Google Code Jam, Qualification Round. My code, usually written following TDD:

The Minesweeper problem is the tricky one. I should add the description of the problems, copying it from the original site.


I added some code kata tests to my JavaScript samples I added metadata macro readind go my Clojure in C# I started to add type checking in my node tree for Scala in C# I added qualified name evaluation to my Rust interpreter in JavaScript I worked on two non-public projects, too.

More fun is coming.

Keep tuned!

Angel “Java” Lopez

April 9, 2014

End Of Iteration 2014w14

Previous Post
Next Post

Code Generation

I updated my template engine in JavaScript, with a minor change to skip new lines in some contexts:

Then I consumed the new version in AjGenesis for Node:

I published the first version of my Sinatra code generation tasks and templates:

The simple generated site can manage list of entities, persisted using sqlite3 and data-mapper.

I removed bower from my Express code generation tasks and templates:

because I think it is more clear to have directly the assets in the repository, instead of installing via bower.

And I updated my Php tasks and templates:

so now it is using a first page with Bootstrap.


I wrote a simple library to support complex number operations in JavaScript

As usual, I wrote the code using TDD workflow. You can check the commit history.

Learning Node.js

I updated my

with a simple sample of a web server. I recorded a Google Hangout (see Spanish post)


Additionally, I started new code kata in JavaScript,

I did a minor internal refactor in ScalaSharp my Scala interpreter in C#.

I added a do operation to my simple asynchronous library. The do operation launch a “parallel” function. You can chain do operations, to launch more than one operation. The next then or map operation will receive the result of the do operations as elements in an array, after full completion of the “launched” functions. Usually, those functions perform asynchronous calls.

I was working in two non-public projects, too.

More fun is coming.

Keep tuned!

Angel “Java” Lopez

March 25, 2014

End Of Iteration 2014w12

Filed under: AjGenesis, Code Generation, JavaScript, NodeJs, Ruby, RubySharp, RuScript — ajlopez @ 10:41 am

Previous Post
Next Post

Ruby Interpreters

I updated my projects

The first in a Ruby interpreter in C#. I started to add the support to detect the local variables in an scope. In Ruby, there is the function local_variables() that returns a list of the names of local declared variables (not only the already initialized).

The second project is the seed to my next talk: it implements Ruby in JavaScript, as an interpreter. I added more support for modules and classes, and function declaration with and without arguments and parenthesis. I’m using my grammar/parser generation:

It was updated to support new use cases (dog fooding!).


I added some simple features to

My Rust Programming Language interpreter in JavaScript. Not, it has function definition with arguments, let and let mut (mutable), some new arithmetic, bitwise and logical operators, with precedence. And a powerful assert! to start writing test programs.


I updated

My Scala interpreter in C#. The additions were simple: more node support. A node is the product of a parser, and define a part of the program. It has a type to be checked. That is the main difference with expression: a node has a type that can be inferred from the rest of the program, or by explicit declaration. As a typed language, an Scala interpreter cannot directly evaluate expression. I should check the types of the nodes, and THEN, generate a correct expression tree.

Code generation

I created

A new global tasks to be used by AjGenesis and related tasks to modify the model using command line. I started the new global tasks

to generate code for PHP and Django. There are only the skeletons, but I want to generate code for these languages/frameworks using a free model. Meanwhile, you can check the simple pages generated from:

The next big step: having a code-as-a-service application, written in Node.js, using AjGenesisNode, and deployed on Heroku.

I worked on two non-public projects, too.

More fun is coming!

Keep tuned!

Angel “Java” Lopez

February 7, 2014

New Month’s Resolutions: February 2014

Review of my January’s Resolutions:

– Start to implement Akka-like actor model in C# [complete] see repo
– Start to implement Scala interpreter in JavaScript [complete] see repo
– Work on AjErl [complete] see repo
– Work on Mass (I have many ideas to implement as module pattern and variable scope access) [pending]
– Work on DylanSharp [complete] see repo
– Start an implementation of ML (JavaScript? C#?) [pending]

I also worked on:

– Improving Scala interpreter in C# [complete] see repo
– Adding dot notation to Lisp interpreter in C# [complete] see repo
– Improving Ruby interpreter in JavaScript [complete] see repo
– Improving Clojure-like interpreter in C# [complete] see repo
– First templates, tasks generating Sinatra application in AjGenesis for Node [complete] see repo

My new month’s resolutions:

– Complete distributed messaging in AjErl
– Complete dot notation in AjLisp
– Improve ClojSharp
– Work on ScaScript
– Work on ScalaSharp
– Add variable scope to Mass
– Complete first version Aktores actor model in C#
– More code generation tasks, templates, models in AjGenesis for Node, generating Express, Meteor, Sinatra applications

More fun is coming

Keep tuned!

Angel “Java” Lopez

January 12, 2014

New Month’s Resolutions: January 2014

A bit late, I was busy these days.

Review of my December’s Resolutions:

– Give a one-day Node.js course [complete]
– Refactor and improve CobolScript [partial] see repo
– Continue writing Ruby to JavaScript compiler [complete] see repo
– Variable scope in Mass language [pending]
– More modules in AjTalkJs [pending]

I was working on:

– Code generation using AjGenesis for Node, and templates for Express [complete]
– Started DylanSharp, Dylan interpreter in C# [complete] see repo
– Start to revamping old PHP websited [complete] see repo and repo
– Start support for modules and REPL to AjErl, my Erlang interpreter in C# [complete] see repo

My new month’s resolutions are:

– Start to implement Akka-like actor model in C#
– Start to implement Scala interpreter in JavaScript
– Work on AjErl
– Work on Mass (I have many ideas to implement as module pattern and variable scope access)
– Work on DylanSharp
– Start an implementation of ML (JavaScript? C#?)

More fun is comming

Keep tuned!

Angel “Java” Lopez

Older Posts »

Blog at