[Haskell-cafe] Alex problem, help needed!!!!!!!!! ASAP :)
María Laura
del_31416no at hotmail.com
Sat Oct 3 14:17:03 EDT 2009
Dear list,
I am trying to make a compiler and we are having a hard time getting Alex to work. We have succeded to work out Alex using older version, but with the the 2.2 version we keep getting this error and we havent been able to figure it out.
So this is our tokens definition:
{
module Lexico where
import Alex
}
%wrapper "posn"
$digit = 0-9 -- digits
$alpha = [a-zA-Z] -- alphabetic characters
tokens :-
$white+ ; --Los espacios en blanco los omito
\/\/.* ; --Lo que venga después de dos barras omito
\/\*.*\*\/ ; --Lo que está entre las barras de comentario omito
$digit+ { \p s -> TokenEntero p (read s) }
\' [$alpha $digit \_]* \' { \p s -> TokenString p (read s)}
[$digit]+\.[$digit]+ { \p s -> TokenDouble p (read s) }
$alpha [$alpha $digit \_]* { \p s -> TokenVar p (read s) }
And when we call the alexScanTokens "hello" we get this error:
[TokenVar (AlexPn 0 1 1) "*** Exception: Prelude.read: no parse
So we are concerned about the "TokenVar p (read s)" . Would that be the way to read a string?
We just get this error with TokenVar and TokenString, whenever we call the function like: alexScanTokens 19 , for instance we dont get any problems and the token 19 is recognized ok.
Please, any ideas on what am i doing wrong????????
regards,
L
_________________________________________________________________
Keep your friends updated—even when you’re not signed in.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091003/718ae79c/attachment.html
More information about the Haskell-Cafe
mailing list