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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Prevost <prevost@m...>
Subject: Re: a parsing question
>>>>> "kn" == knotwell  <knotwell@f5.com> writes:

        {...}

    kn> Unfortunately, I don't know how to "export" yoyo_time to
    kn> parser.mli.  My Makefile currently does the following:

    kn>     echo "val yoyo_time: int ref" >> parser.mli

    kn> While this works fine, I'd like to avoid using Make as a
    kn> post-processor.

The right solution is to define yoyo_time in another module:

blah.ml ------------

let yoyo_time = ref 10
let set_yoyo_time newtime = yoyo_time := (int_of_string newtime)

blah.mli ------------

val yoyo_time : int ref
val set_yoyo_time : string -> unit

parser.mly ----------

%{
open Blah
%}

This way you can stay away from touching the scary .mli file generated
by ocamlyacc.

John.