the language machine

Peri Hankey <mpah@thegreen.co.uk>
10 Sep 2005 12:38:26 -0400

          From comp.compilers

Related articles
the language machine mpah@thegreen.co.uk (Peri Hankey) (2005-09-10)
| List of all articles for this month |

From: Peri Hankey <mpah@thegreen.co.uk>
Newsgroups: comp.compilers
Date: 10 Sep 2005 12:38:26 -0400
Organization: Compilers Central
Keywords: tools, available
Posted-Date: 10 Sep 2005 12:38:26 EDT

I hope that readers of this list will be interested in 'the language
machine - a toolkit for language and grammar' which I have published
under Gnu GPL at sourceforge.


The grammatical engine of the language machine applies grammatical
substitution rules so as to analyse and interpret a stream of input
symbols. Each rule has a left-side and a right-side, and takes the
general form


          sequence-to-be-matched <- sequence-to-be-substituted ;


where both the left- and the right- sides may contain any number of
terminal and/or non-terminal symbols, together with variable bindings
and deferred or immediate variable references and side-effect
operations that can include calls on external procedures in the C or D
programming languages.


Rules are written in a metalanguage called 'lmn' (language
machine/meta notation). There are a number of different metalanguage
compilers: these are all written in lmn, and they share a common
frontend:


          lmn2m compile rules to textual loader format for use as shell script
          lmn2d compile rules to textual loader format wrapped as data and procedures in D
          lmn2D compile rules to procedures in the D programming language
          lmn2c compile rules to textual loader format wrapped as data and procedures in C
          lmn2C compile rules to procedures in the C programming language


The grammatical engine of the language machine is implemented as a
shared library in the D language using the gdc frontend to gnu gcc. At
present it is driven by a minimal main program in either C or D, but
the intention is to provide ways of embedding the engine and compiled
rulesets in any license-compatible free software languages and tools
where it has something to offer. The distributuin includes a variety
of examples, including a D-to-D translator and various small examples,
some of which demonstrate how to call external procedures in D and
C. There is a proof-of-concept interface to tcc (the tiny C compiler),
in the form of a caclulator that compiles and executes each expression
using libtcc, and some very crude beginnings of a GENERIC interface to
gnu gcc4.


The engine provides extensive builtin diagnostics, including a unique
diagram generator which explains exactly what happens when
unrestricted grammatical substitution rules are applied to an input
stream.


The project web pages are at:


      http://languagemachine.sourceforge.net


There is a page which explains how this system relates to received
wisdom about language and language implementation at:


      http://languagemachine.sourceforge.net/grammar.html


The lm-diagram is explained in relation to two very trivial examples at:


      http://languagemachine.sourceforge.net/lm-diagram.html


I hope some of you will find that the language machine offers a useful
and unusally direct approach to language and grammar.


Regards
Peri Hankey


--
http://languagemachine.sourceforge.net - The language machine


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.