Re: a parsing question

From: John Prevost (prevost@maya.com)
Date: Thu May 04 2000 - 19:29:26 MET DST

  • Next message: John Prevost: "Re: translation of book (fwd)"

    >>>>> "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.



    This archive was generated by hypermail 2b29 : Thu May 04 2000 - 20:14:08 MET DST