Erlang/OTP Forums

Author Message

<  User Contributions  ~  Leex - a lexical analyser generator

rvirding
Posted: Sat Sep 02, 2006 10:11 am Reply with quote
User Joined: 30 Aug 2006 Posts: 452 Location: Stockholm, Sweden
Here is Leex in its current state.

There is no documentation (yet) but I have included erl_scan.xrl which is the Erlang token syntax.

The section headers "Definitions.", "Rules." and "Erlang Code." areliteral strings which must occur at the begiining of a line. Only the rules section is necessary.

You nclude macros in the pattern by writing {MacroName}. Macros can reference macros. Macros are expanded "as is" without any implicit adding of parentheses.

Within the body of a rule you can access the token characters, length and line number thorugh the predefined variables TokenChars, TokenLen and TokenLine.

You return {token,Token}, {end_token,Token}, skip_token or {error,ErrorString}.

The interface to the generated scanner is the standard io interface:

string/1-2
token/2-3
tokens/2-3
format_error/1


Last edited by rvirding on Sat Sep 02, 2006 8:31 pm; edited 3 times in total


leex.zip
 Description:

Download
 Filename:  leex.zip
 Filesize:  14.91 KB
 Downloaded:  2737 Time(s)

View user's profile Send private message Visit poster's website MSN Messenger
rvirding
Posted: Sat Sep 02, 2006 10:51 am Reply with quote
User Joined: 30 Aug 2006 Posts: 452 Location: Stockholm, Sweden
I naturally forgot to tell how to run it:

leex:file(Name)

which reads the file Name.xrl and generates the module Name in the file Name.erl. The file leex.hrl must be in the current directory.

No options yet.
View user's profile Send private message Visit poster's website MSN Messenger
rvirding
Posted: Sat May 24, 2008 3:34 pm Reply with quote
User Joined: 30 Aug 2006 Posts: 452 Location: Stockholm, Sweden
This is the first proper release of leex. Changes from the previous non-release version are:

- It now has a proper open-source license.
- An elusive bug has been found to have been a bug and has been fixed.
- A cool new option dfa_graph has been added. Thanks for Sebastian Egner for showing me the possiblities.
- There is now some documentation. Yeah!

Apart from this there are no other noticeable changes. The Erlang and LFE token syntaxes are included as examples.



leex 0.1.zip
 Description:
Version 0.1 of leex

Download
 Filename:  leex 0.1.zip
 Filesize:  18.41 KB
 Downloaded:  2193 Time(s)

View user's profile Send private message Visit poster's website MSN Messenger
0x6e6562
Posted: Thu May 29, 2008 7:26 pm Reply with quote
User Joined: 12 Jul 2007 Posts: 250
For anybody wanting to read a short introduction to leex and yecc, you can read this article: http://hopper.squarespace.com/blog/2008/5/29/leex-and-yecc.html
View user's profile Send private message
rvirding
Posted: Fri Oct 31, 2008 9:35 pm Reply with quote
User Joined: 30 Aug 2006 Posts: 452 Location: Stockholm, Sweden
This is version 0.2 of Leex. New features and changes from the previous version are:

- The structure of the release is such that you can now drop straight into your ERL_LIBS directory.

- Added includefile option. Search for include file in current directory or leex/include lib dir.

- Restored text file version of documentation until I edoc and I are in agreement.

- Upgraded erlang_scan.xrl to full erlang tokeniser.

- Now use line number of token start.

- Fixed a bug where if the file ended in an incomplete token this was ignored and no error returned.



leex_0.2.zip
 Description:
Version 0.2 of leex

Download
 Filename:  leex_0.2.zip
 Filesize:  45.72 KB
 Downloaded:  1817 Time(s)

View user's profile Send private message Visit poster's website MSN Messenger
rvirding
Posted: Thu Jan 01, 2009 9:56 pm Reply with quote
User Joined: 30 Aug 2006 Posts: 452 Location: Stockholm, Sweden
This is version 0.3 of Leex. New features and changes from the previous version are:

- Added options to pushback characters into the input stream.

- Can now handle full unicode character sets in both input file and generated scanner. Of course i/o system can't generate such an input file yet.

- Enforce headings for all sections of .xrl file.

- Added verbose flag to control printing of parsing information.

- Fixed bug with completely empty erlang code section.

[Edit]: I just noticed that I failed to recompile the included leex.beam file. A "make compile" will fix this.



leex_v0.3.tgz
 Description:
Version 0.3 of leex.

Download
 Filename:  leex_v0.3.tgz
 Filesize:  39.99 KB
 Downloaded:  2159 Time(s)

View user's profile Send private message Visit poster's website MSN Messenger
mickeyy
Posted: Mon Feb 22, 2010 10:59 am Reply with quote
Joined: 22 Feb 2010 Posts: 1
This is of great information to me. Thanks for sharing. Great job guys. Keep it up.


_________________
FXBx-Sol
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum