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

10829Re: how to run ocamllex

Expand Messages
  • citromatik
    Mar 1, 2009
    • 0 Attachment
      In Windows you must call your executable files with the ".exe" extension

      ocamlc -o scanner1.exe scanner1.ml

      M;


      new2ocaml wrote:
      >
      > Hi,
      >
      > I'm absolutely new to ocaml / ocamllex and I am having a very basic
      > problem, most likely something very small that I am missing.
      >
      > I have a mll file called scanner1.mll with the following contents. This is
      > supposed to read an input file and if it sees the regex
      > "current_directory" then simply replace it with whatever the current
      > directory is.
      >
      >
      > { }
      > rule translate = parse
      > | "current_directory" { print_string (Sys.getcwd ()); translate lexbuf }
      > | _ as c { print_char c; translate lexbuf }
      > | eof
      >
      >
      > I compiled this from windows dos prompt using
      > ocamllex scanner1.mll
      >
      > This created a scanner1.ml file.
      >
      > Then I used the scanner1.ml to create a scanner1 object using
      > ocamlc -o scanner1 scanner1.ml
      >
      > I have an input text file called input.txt with the contents
      > current_directory
      > dummy_text
      >
      > The problem I am having is that when I run from the program from the dos
      > prompt using
      > scanner1 input.txt
      >
      > It complains that "'scanner1' is not recognized as an internal or external
      > command,
      > operable program or batch file."
      >
      > I have tried to add the directory where all the code is the system PATH
      > variable and it still continues to fail with the above problem.
      >
      > Any suggestions on how I may fix this will be greatly helpful -- the
      > examples I found online was to run it as ./scanner1 input.txt, but this is
      > for unix and I am on windows.
      >
      > Thanks in advance!
      >

      --
      View this message in context: http://www.nabble.com/how-to-run-ocamllex-tp22265946p22273206.html
      Sent from the Ocaml Beginner mailing list archive at Nabble.com.