Browse thread
[Caml-list] mod_caml makes Apache segfault
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-09-06 (17:34) |
From: | luc.maranget@i... |
Subject: | Re: [Caml-list] ocamllex parametrized parse regexp |
> Hi, > > I try to use ocamllex like this (I want to have one of the parsing regexp > to be read from an external file) : > > > { > open Printf;; > > } > let digit = ['0'-'9'] > > let mark = ...read in a file... > > rule oaddress outcan = parse > | mark as bemark > { > printf "MARK(%s)" bemark; > oaddress outcan lexbuf > } > | _ as d > { printf "Unk[%c]\n" d; > oaddress outcan lexbuf > } > | eof > { > fprintf outcan "END"; > } > > Is it possible or useless to try somethink like that ? ocamllex is a standard compiler, it compiles its input base.mll file into a base.ml file that implements the lexer. The language understood by ocamllex remains quite basic. As a consequence there is no built-in support for what you want. (Basically the 'let name = regexp' feature can be seen as simple macros). However, nothing prevents you from generating the appropriate source (.mll) files before you feed them into ocamllex. -- Luc ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners