Unisyn expressions.


Once there were many different character sets that were unified by Unicode. Today we have many different programming languages, each with a slightly different syntax from all the others. The multiplicity of such syntaxes imposes unnecessary burdens on users and language designers. UniSyn is proposed as a common syntax that is easy to understand yet general enough to be used by many different programming languages.

The advantages of having one uniform language syntax:

  • less of a burden on users to recall which of the many syntax schemes in current use is the relevant one for the programming language they are currently programming in. Rather like having all your electrical appliances work from the same voltage electricity rather than different voltages.

  • programming effort can be applied globally to optimize the parsing process to produce the fastest possible parser with the best diagnostics.

Special features

  • Expressions in Unisyn can be parsed in situ - it is not necessary to reparse the entire source file to syntax check changes made to the file. Instead changes can be checked locally at the point of modification.

  • Expressions in UniSyn can be parsed using SIMD instructions to make parsing faster than otherwise.

Dyadic operator priorities

UniSyn has only three levels of dyadic operator priority which makes it easier to learn. Conversely: Perl has 25 levels of operator priority. Can we really expect users to learn such a long list?

Even three levels of priority are enough to parse subroutine declarations, for loops and if statements with nested expressions:

is sub as array then == else v1 v2 plus then v3 v4 == else v5 v6 minus times v7 v8 v9 + v10 v11

The priority of a dyadic operator is determined by the Unicode Mathematical Alphanumeric Symbols that is used to encode it.

The new operators provided by the Unicode standard allows us to offer users a wider range of operators and brackets with which to express their intentions clearly within the three levels of operator precedence provided.

Minimalism through Unicode

This module is part of the Earl Zero project: using Perl 5 to create a minimal, modern Unicode based scripting language: Earl Zero. Earl Zero generates x86 assembler code directly from a program consisting of a single Unisyn expression with no keywords; only expressions constructed from user defined unary and binary operators are used to construct Unisyn programs.

Minimalism is an important part of Earl Zero; for example, the "Hello World" program is:

Hello World

Earl Zero leverages Perl 5 as its macro assembler and CPAN as its module repository.

Other languages

Lisp, Bash, Tcl are well known, successful languages that use generic syntaxes.

Join in!

Please feel free to join in with this interesting project - we need all the help we can get.

For documentation see: CPAN