Version française
Home     About     Download     Resources     Contact us    
Browse thread
Dynamically switching lexer
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Dynamically switching lexer
I'm currently doing a toy DSEL,
Camlp4 pops to mind as a very nice way to embed it unfortunately the
standard lexer it comes with is not all that great for my language.
Although I do know how to use another lexer it comes with a catch:
antiquotation need to be properly lexed to string to be passed to the
standard ocaml parser as strings (I use
let expr_of_string = Gram.parse_string Syntax.expr_eoi
this seems simpler than what is shown in tutorials. Am I missing
something?) off course the easy way to delimit such strings
(respecting nested comments, escaped strings...) would be to use the
former lexer, It would need to be switched between both lexers, is
this all possibe?.
Cheers,
Till