<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/a5e3d51ebade36d6991bf4b045e55347"
  from="Dmitry Lomov &lt;Dmitry.Lomov@i...&gt;"
  author="Dmitry Lomov"
  date="2003-11-04T13:07:24"
  subject="Re: [Caml-list] Right way to determine used syntax ( camlp4 )"
  prev="2003/11/26590f366f401c39cd62b82a784477dd"
  next="2003/11/fc711ff363ee98e5a52de94c646ee486"
  prev-in-thread="2003/11/26590f366f401c39cd62b82a784477dd"
  next-in-thread="2003/11/fd0f1ccee25a666249fd8b99def103b8"
  prev-thread="2003/11/5bfc54158708ba55850a695ef7c3c554"
  next-thread="2003/11/7d1a89526a373d9c8ad55df4f4d4ad97"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Right way to determine used syntax ( camlp4 )">
<msg 
  url="2003/11/26590f366f401c39cd62b82a784477dd"
  from="Artem Prisyznuk &lt;tema@s...&gt;"
  author="Artem Prisyznuk"
  date="2003-11-04T10:45:48"
  subject="[Caml-list] Right way to determine used syntax ( camlp4 )">
<msg 
  url="2003/11/a5e3d51ebade36d6991bf4b045e55347"
  from="Dmitry Lomov &lt;Dmitry.Lomov@i...&gt;"
  author="Dmitry Lomov"
  date="2003-11-04T13:07:24"
  subject="Re: [Caml-list] Right way to determine used syntax ( camlp4 )">
<msg 
  url="2003/11/fd0f1ccee25a666249fd8b99def103b8"
  from="Artem Prisyznuk &lt;tema@s...&gt;"
  author="Artem Prisyznuk"
  date="2003-11-04T14:54:26"
  subject="Re: [Caml-list] Right way to determine used syntax ( camlp4 )">
</msg>
</msg>
</msg>
</thread>

<contents>
Hi,

I believe the best way is to have two separate syntax extension files,
and then just supply the right one (either for normal or 
"revised" syntax) at compile time.
What you propose has a strong hackish smell :)

Friendly,
Dmitry

On Tuesday 04 November 2003 13:46, Artem Prisyznuk wrote:
&gt; Hello,
&gt;
&gt; I write small extension for ocaml. But I have next question.
&gt;
&gt; Grammar entry differ for pa_o.cmo and pa_r.cmo. So in my pa_ module
&gt; I want auto determinate which syntax used and apply differ EXTEND
&gt; branches for normal syntax and revised syntax. Now I determine which
&gt; syntax
&gt; used with next code:
&gt;
&gt; let normal_extend () =
&gt; 	EXTEND
&gt;   	GLOBAL: expr;
&gt; 	expr: LEVEL "expr1"
&gt; 	  [[ ..... ]]
&gt;          ......
&gt; 	END;;
&gt;
&gt; let revised_extend () =
&gt; 	EXTEND
&gt;   	GLOBAL: expr;
&gt; 	expr: LEVEL "top"
&gt; 	  [[ ..... ]]
&gt;          ......
&gt; 	END;;
&gt;
&gt;
&gt; let _ =
&gt;    try ignore(Grammar.Entry.find Pcaml.expr "expr1"); normal_extend ()
&gt;    with Not_found -&gt; revised_extend ();;
&gt;
&gt;
&gt; It work, but I don't assurance what it's right way.
&gt;
&gt; Any suggestions?

-- 
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

