tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] tcc in the language machine


From: Peri Hankey
Subject: [Tinycc-devel] tcc in the language machine
Date: Wed, 17 Aug 2005 09:28:31 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050717

I thought members of this list might be interested to see how the excellent tiny C compiler can be combined with a generalised toolkit for language. My language machine is under gnu GPL, and it's at

http://languagemachine.sourceforge.net

This is a complete rewrite of software that I developed and used in real projects over a long period that began in 1975. The software consists of a shared library which implements the 'language machine', a minimal main program, several different flavours of a metalanguage compiler (all of which are written in the same metalanguage and share the same frontend), and a number of examples, including the application that generates the web pages from wiki-style text.

An example which directly generates and executes C code using tcc is at

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

The language machine is intended to be useful across a wide range of applications, from quick'n'dirty text mungers upwards - anything that has a linguistic or grammatical component. It compiles to rules wrapped as shebang scripts, to rules wrapped in the C and D languages, and to rules compiled as (slightly odd) C and D language procedures, and it's quite easy to call external procedures in the C and D languages.

The neat thing about it is that it lets you play directly with the fundamentals of language. The engine can generate a diagram that explains exactly how rules are applied, and it turns out that an engine that directly and efficiently implements the most general kind of recognition grammar is very much like a macro processor that lets you define your own syntax as part of the macro definition. It does this in a way that lets you concentrate on recognising and transforming patterns that happen to contain symbols of the kind that appear only in the rules of the grammar. Going at it this way, you can do everything from lexical analysis to code generation.

Incidentally, the D language that I have used to implement the engine at the heat of the language machine is an interesting advance from C. A tiny D compiler would be really useful - I may yet try to combine libtcc with the D language frontend (see web pages) that I wrote as an exercise, but that would probably turn out a bit heavier than something hand coded along the lines of tcc.

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]