Alex 2.0

Per Larsson per@L4i.se
Fri, 22 Aug 2003 18:54:21 +0200


On Friday 22 August 2003 13.04, Immanuel Litzroth wrote:
> Has anyone an example of <reg>{n,k} regular expression in Alex 2.0?
> I can not get them to work, alex won't parse them (not the way I write
> them anyway)
> Immanuel
>

Hi,

Here comes a silly example which in any case=20
works as expected on my linux system with alex and ghc.

file "foo.x" contains:
------------------------------------
{
module Main (main) where
}

%wrapper "basic"

words :-

$white+=09=09=09;
A{3,5}                     { \s -> () }

{
main =3D do
 s <- getContents
 print (length (alexScanTokens s))
}
-------------------------------------------

% alex foo.x
% ghc --make foo.hs
% a.out  < testfile.txt

Regards Per