Abstract Language Tree
C Perl Makefile
Latest commit c2886d8 Feb 16, 2016 @radare Fix markdown

README.md

ALT :: Abstract Language Tree

Alt is another funny try to implement a programming language melting data and code. This combination enables language prototipation and eases source parsing in a really simple form while enabling extensibility and re-use of parsing for multiple purposes.

Language description rules

One of the key features of 'alt' is that the language form directly represents the AST (Abstract Structured Tree), so the compilation stage does not requires any extra work to generate this information because all the info is stored there.

Comments:

represents all the part of the source that are not goint to be parsed by the language. '#' is used for single line comments. /* and */ are used for block-based comments.

Words:

Words are represented by non-spaced strings. They are used to define the name of every node in the ast. If no name is given for a block {} the block will not be referable.

To define words with spaces, just use '"' quoting. Tabs and enters are also recognized as word separator tokens like if they were spaces.

When the word starts with '.' it is going to run an internal command.

If the word is followed by another word it is recognized as two different elements with empty contents.

If the word contains a dot is handled as a full-path object.

Keywords:

There are some few keywords that cannot be used as language words.

The keywords are:

'='  assignation (expects another word)

Execution:

The execution is done after the generation of the full AST.

The runtime engine will get the AST generated by the parser and iterate over all nodes following nested nodes and so on.

The execution backend interprets the language tree and generates code, executes the code starting from the 'main' symbol, etc..

Example Input:

linux + foo

.if Config.OS == linux {
}

ElementModule {
  .switch Config.OS {
    linux {
      .printf { "Using linux OS\n" }
    }
    windows {
      .printf { "Using w32 OS\n" }
    }
  }
}

foo = Thread { ElementModule() }

/*
Word types:
w = word
s = string
i = integer
f = float
*/

: if(i){}