Version française
Home     About     Download     Resources     Contact us    
Browse thread
Using ulex
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Paul Snively <psnively@m...>
Subject: Using ulex
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi folks,

I'm trying to use Alain Frisch's ulex to write a simple .ini file  
lexer. I'm still pretty new to the module system, how libraries work,  
and in particular how camlp4 and syntax extensions work. Here are the  
things I've tried to just get ulex to tell me I'm not being foolish.  
This is with O'Caml 3.08.3 and findlib 1.0.4 on Mac OS X 10.4.1:

- -------------------------------------snip  
snip-------------------------------------
Valhalla:~ psnively$ ocaml
         Objective Caml version 3.08.3

# #load "camlp4o.cma";;
         Camlp4 Parsing version 3.08.3

# #load "/usr/local/lib/ocaml/site-lib/ulex/pa_ulex.cma";;
# #load "/usr/local/lib/ocaml/site-lib/ulex/ulexing.cma";;
# (lexer ("#!" [^ '\n']* "\n")? -> ()) lexbuf;;        (* This is  
from the README *)
Unbound value Ulexing.mark
#
- -------------------------------------snip  
snip-------------------------------------

OK, so maybe I need to "open Ulexing;;":

- -------------------------------------snip  
snip-------------------------------------
# open Ulexing;;
Unbound module Ulexing
#
- -------------------------------------snip  
snip-------------------------------------

I'm working too hard: this is what findlib is for. So, in a fresh ocaml:

- -------------------------------------snip  
snip-------------------------------------
Valhalla:~ psnively$ ocaml
         Objective Caml version 3.08.3

# #use "topfind";;
- - : unit = ()
Findlib has been successfully loaded. Additional directives:
   #require "package";;      to load a package
   #list;;                   to list the available packages
   #camlp4o;;                to load camlp4 (standard syntax)
   #camlp4r;;                to load camlp4 (revised syntax)
   #predicates "p,q,...";;   to set these predicates
   Topfind.reset();;         to force that packages will be reloaded
   #thread;;                 to enable threads

- - : unit = ()
# #camlp4o;;
/usr/local/lib/ocaml/camlp4: added to search path
/usr/local/lib/ocaml/camlp4/camlp4o.cma: loaded
         Camlp4 Parsing version 3.08.3

# #require "ulex";;
/usr/local/lib/ocaml/site-lib/ulex: added to search path
/usr/local/lib/ocaml/site-lib/ulex/pa_ulex.cma: loaded
/usr/local/lib/ocaml/site-lib/ulex/ulexing.cma: loaded
# (lexer ("#!" [^ '\n']* "\n")? -> ()) lexbuf;;
Unbound value __ulex_partition_0
#
- -------------------------------------snip  
snip-------------------------------------

I confess to being stumped. Any advice would be most welcome.

Best regards,
Paul Snively

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iEYEARECAAYFAkLIOMEACgkQO3fYpochAqLSsACgyRinCveNEtyHRQUyt/1Y//ao
q/gAn1tj7Zw0g1KyqBpeQMxd9LvscE13
=45hF
-----END PGP SIGNATURE-----