Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] Lex/Parsing & configuration file

Expand Messages
  • Daniel Andor
    ... I just had the same problem (for a stochastic simulation) and I ended up using Genlex and Stream parsing using the camlp4o pre-processor. This
    Message 1 of 7 , Jul 8, 2006
    • 0 Attachment
      On 04/07/06, Julien Michel <julien.michel@...-orleans.fr> wrote:
      >
      > Hi all,
      > I would like to "scan" a configuration file, pick up some values from it,
      > and
      > pass them as arguments to some functions.
      >
      > I also would like to make the main program run from this configuration
      > file. I
      > mean, if a particular keyword ( token ?) appears in this file, the program
      > should run the corresponding function... and so on, until the program
      > parses
      > the whole configuration file. This is nothing more than scripting,
      > actually.


      I just had the same problem (for a stochastic simulation) and I ended up
      using Genlex and Stream parsing using the camlp4o pre-processor. This
      significantly restricts your grammar (
      http://caml.inria.fr/pub/docs/oreilly-book/html.bak/book-ora106.html#toc138),
      but all I needed was something light-wight. I defined a variaty of
      keywords, like "set", "run", "plot" and "dump", which took identifiers and
      numbers that were bound to parameters and functions in my simulation. With a
      bit of hackery I even got a for loop working.

      D.


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.