2
{ }
rule translate = parse
| "current_directory" { print_string (Sys.getcwd()) }
| _ as c { print_char c }
| eof { exit 0 }
{
let main() =
let lexbuf = Lexing.from_channel stdin in
while true do
translate lexbuf
done
let _ = Printexc.print main()
}
有人可以請解釋我主要功能的工作原理嗎?我已經理解了正則表達式部分,並能夠理解主要功能,但不是確切的意思。Ocamllex語法問題