[wg-camlp4] nested quotation lexing problem?

Bob Zhang bobzhang1988 at gmail.com
Sat May 11 16:08:50 BST 2013


Hi,


On Sat, May 11, 2013 at 10:42 AM, Wojciech Meyer
<wojciech.meyer at gmail.com>wrote:

> Hi,
>
> I'd make it following OCaml convention, but also make it plugable so the
> user can choose how to lex the contents, because string can contain
> arbitrary text, and I've never seen a computer language that had
> different delimiters (apart from Python ''') so it all makes sense. On
> other hand allowing strings between other delimiters would be good to.
>
> Yes, I think the requirement  for the string convention is reasonable, but
the requirement for char convention is a bit loose. So,
   {:q| "|}" |} (* accepted*)
   {:q| '"' |}  (* accepted *)
   {:q| '     '  |} (* accepted as well, the char check is intended to be
loose *)

Now even the lexer generator is embedded in Fan and bootstrapped by Fan
itself,
check out :
 https://github.com/bobzhang/Fan/blob/master/src/FLexer.ml

The advantaged compared with ocamllex is that it works in toplevel :-)


> Now it's time to say, you would love how the PEG packrat parses, because
> it does not have lexing pass so you would not have this problem. (but
> has some slightly different).
>
> Wojciech
>



-- 
Regards
-- Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/wg-camlp4/attachments/20130511/213ecaac/attachment.html>


More information about the wg-camlp4 mailing list