using ocamllex with ocamljs

5 views
Skip to first unread message

hp

unread,
Apr 11, 2010, 12:16:22 PM4/11/10
to ocamljs discuss
I tried to create a parser and compile to js but I get

Error while linking /usr/local/lib/ocaml/stdlib.cmjsa(Lexing):
The external function `caml_new_lex_engine' is not available


Is it possible to use ocamllex with ocamljs?

peter
halacsy

Jake Donham

unread,
Apr 11, 2010, 12:59:33 PM4/11/10
to ocamljs...@googlegroups.com
Ocamllex depends on a C function to run the recognizer (see
byterun/lexing.c); I have not ported this to Javascript. It does not
look like a lot of code, so maybe a port would be straightforward.

On the other hand, the performance would be pretty bad compared to the
built-in regex functions in Javascript, so it might be worthwhile to
use these directly in your application, with the javascript library in
ocamljs.

Out of curiosity, what is the application?

> --
> You received this message because you are subscribed to the Google Groups "ocamljs discuss" group.
> To post to this group, send email to ocamljs...@googlegroups.com.
> To unsubscribe from this group, send email to ocamljs-discu...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ocamljs-discuss?hl=en.
>
>

Peter Halacsy

unread,
Apr 11, 2010, 1:11:49 PM4/11/10
to ocamljs...@googlegroups.com

On Apr 11, 2010, at 6:59 PM, Jake Donham wrote:

thank you for your answer



Out of curiosity, what is the application?



just a demo for a talk about ocamljs for javascript coders

I thought I can say: ocaml is very good for writing parsers so ocamljs can help them to create parsers in javascript



Jake Donham

unread,
Apr 11, 2010, 1:15:38 PM4/11/10
to ocamljs...@googlegroups.com
On Sun, Apr 11, 2010 at 10:11 AM, Peter Halacsy <peter....@prezi.com> wrote:
> just a demo for a talk about ocamljs for javascript coders
> I thought I can say: ocaml is very good for writing parsers so ocamljs can
> help them to create parsers in javascript

You could try ulex:

http://www.cduce.org/download.html#side

which is pure OCaml. I haven't tried it though so I don't know if it would work.

Jake Donham

unread,
Apr 11, 2010, 1:23:09 PM4/11/10
to ocamljs...@googlegroups.com
On Sun, Apr 11, 2010 at 10:15 AM, Jake Donham <jake....@gmail.com> wrote:
> You could try ulex:
>
>  http://www.cduce.org/download.html#side
>
> which is pure OCaml. I haven't tried it though so I don't know if it would work.

And of course ocamlyacc has the same problem---it uses a C function to
run the parser.

Reply all
Reply to author
Forward
0 new messages