Just one more experiment!

Want to know how it is organized? Read more »

Blog posts

A grammar for projectional editor

Describing a language editor can be repetitive, for instance when you have to define expressions. expression '+' expression and expression '*' expression is a typical example. From the grammar file that describes the language structure it's possible to recognize repetitive rule structures and build an editor in a consistent way.

The PE project defines a grammar and generates AST in a way not related to any projectional editor. PE4MPS project imports the generated ASTs into MPS generating for example from this rule:

      strict=STRICT? type=GraphType name=string?
      statementList<indentList('{', '}')>=Statement*

this MPS editor:

Graph editor example

New ECMAScript4MPS project

There are several strategies for code generation. The one used by MPS could be called no code generation strategy. In fact the suggested implementation for code generation is first to transform models in your language to models in the target language, or if you prefer first to transform AST representation of your program into AST representation of target language. Then models from a real language, for example Java, are translated to text. This means that only construct, like if-then-else, of language that one can compile or execute, like Java, have a place where one say how to translate them to text, in MPS called TextGen aspect.

MPS gives you for free a language called baseLanguge that transform seamlessly to Java. Whereas one of my target languages is Javascript, so I created this new MPS language. The new project is hosted on github.

Sunset in Antignano

Sketching UI with text tools

The idea to sketching UI, or other types of drawing, using text file is not new. Text can be embedded into text files so a whole document can be defined using only text. This is the approach used by Sphinx, with it you can use reStructuredText to define your HTML or PDF documentation.

Sphinx is integrated with PlantUML so you are able also to define UI, UML diagrams, charts using text.

The subproject used by PlantUML to define UI sketch is called Salt. What I do not like about Salt it's that it uses lines, curves and text to draw a UI sketch. This way the result is not realistic.
And ok... I would like to exercise with ANTLR.

ANTLR4 grammar for Markdown

Markdown is today used in several place including this blog.
ANTLR is also used, almost, everywhere where you need a parser.
So to learn ANTLR I have chosen to try teach ANTLR how to parse Markdown syntax. This task has been much more hard then I expected.

The smallest static site generator

Now that I can write posts in HTML and in Markdown what is missing to create the smallest static web generator we can imagine?

Adding a markup language

The previous post introduces a small language to define post files and in this project you can find some java classes to transform them into a small blog, based on bootstrap. The first improvement I see that was missing it's a markup language to speed up writing of posts. I decide to investigate a bit on static site generators like for example Jekyll, actually the one used by github.