Aflex, a lexer generator for Ada
Created on 2011-12-26 07:24:00
Last Modified: 2011-12-26 07:26:20
I had to search for quite a while, but I managed to find a lexer generator for Ada. Unsurprisingly, it is called aflex, and comes with its brother ayacc. There are several downloads on the net, including broken ones, the one given by Pascal Obry seems to work. You have to go almost to the bottom of the page and click on the aflex/ayacc link in the text, not in the left table column. You obtain a .tgz file. which you can unpack easily. Aflex itself can be compiled easily by typing
gnatmake aflexin the
aflex/src directory of the tarball. You obtain an
executable of the same name.
A good start is the example.l file in the
aflex/doc subdirectory. It is easily readable and can be
compiled as follows:
$ aflex example.l $ gnatchop *.a $ gnatmake example(You might have to convert the
example.l file to unix line
endings on linux.) Isn't that perfectly easy and obvious?