One question,how to compile that it recognizes "[<..>]" ?

open Genlex;;
let keywords = [
    "REM"; "GOTO"; "LET"; "PRINT"; "INPUT"; "IF"; "THEN";
    "-"; "!"; "+"; "-"; "*"; "/"; "%";
    "="; "<"; ">"; "<="; ">="; "<>";
    "&"; "|"
];;
(*takes as input a string of characters and returns the corresponding
stream of lexemes.*)
let line_lexer l =
    make_lexer keywords (Stream.of_string l) ;;

line_lexer "LET x = x + y * 3" ;;

let rec spaces s =
match s with parser
| [<'' ' ; rest >] -> spaces rest    (* this is the line 14*)
| [<''\t' ; rest >] -> spaces rest
| [<''\n' ; rest >] -> spaces rest
| [<>] -> () ;;

$ ocaml toolsForLexical.ml
File "toolsForLexical.ml", line 14, characters 2-4:
Error: Syntax error

--
All the best: Ivo

-- 
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html

Reply via email to