caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Right way to determine used syntax ( camlp4 )
@ 2003-11-04 10:46 Artem Prisyznuk
  2003-11-04 12:59 ` Dmitry Lomov
  0 siblings, 1 reply; 3+ messages in thread
From: Artem Prisyznuk @ 2003-11-04 10:46 UTC (permalink / raw)
  To: caml-list

Hello,

I write small extension for ocaml. But I have next question.

Grammar entry differ for pa_o.cmo and pa_r.cmo. So in my pa_ module
I want auto determinate which syntax used and apply differ EXTEND
branches for normal syntax and revised syntax. Now I determine which 
syntax
used with next code:

let normal_extend () =
	EXTEND
  	GLOBAL: expr;
	expr: LEVEL "expr1"
	  [[ ..... ]]
         ......
	END;;

let revised_extend () =
	EXTEND
  	GLOBAL: expr;
	expr: LEVEL "top"
	  [[ ..... ]]
         ......
	END;;


let _ =
   try ignore(Grammar.Entry.find Pcaml.expr "expr1"); normal_extend ()
   with Not_found -> revised_extend ();;


It work, but I don't assurance what it's right way.

Any suggestions?

-- 
Artem Prysyznuk
tema@sit.kiev.ua

-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Right way to determine used syntax ( camlp4 )
  2003-11-04 10:46 [Caml-list] Right way to determine used syntax ( camlp4 ) Artem Prisyznuk
@ 2003-11-04 12:59 ` Dmitry Lomov
       [not found]   ` <oprx3918mvafbmjd@uaapc442>
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Lomov @ 2003-11-04 12:59 UTC (permalink / raw)
  To: caml-list

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:
> Hello,
>
> I write small extension for ocaml. But I have next question.
>
> Grammar entry differ for pa_o.cmo and pa_r.cmo. So in my pa_ module
> I want auto determinate which syntax used and apply differ EXTEND
> branches for normal syntax and revised syntax. Now I determine which
> syntax
> used with next code:
>
> let normal_extend () =
> 	EXTEND
>   	GLOBAL: expr;
> 	expr: LEVEL "expr1"
> 	  [[ ..... ]]
>          ......
> 	END;;
>
> let revised_extend () =
> 	EXTEND
>   	GLOBAL: expr;
> 	expr: LEVEL "top"
> 	  [[ ..... ]]
>          ......
> 	END;;
>
>
> let _ =
>    try ignore(Grammar.Entry.find Pcaml.expr "expr1"); normal_extend ()
>    with Not_found -> revised_extend ();;
>
>
> It work, but I don't assurance what it's right way.
>
> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Right way to determine used syntax ( camlp4 )
       [not found]   ` <oprx3918mvafbmjd@uaapc442>
@ 2003-11-04 14:54     ` Artem Prisyznuk
  0 siblings, 0 replies; 3+ messages in thread
From: Artem Prisyznuk @ 2003-11-04 14:54 UTC (permalink / raw)
  To: caml-list


  On Tue, 4 Nov 2003 15:59:53 +0300, Dmitry Lomov
  <Dmitry.Lomov@intellij.com> wrote:

> 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.

  Module has ~400 lines. Revised and normal verison differ in three lines.
  So I think make and maintance two different version no have sense.

> What you propose has a strong hackish smell :)

  I smell it. Because I ask question. :-)

-- 
Artem Prysyznuk
tema@sit.kiev.ua

-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-04 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-04 10:46 [Caml-list] Right way to determine used syntax ( camlp4 ) Artem Prisyznuk
2003-11-04 12:59 ` Dmitry Lomov
     [not found]   ` <oprx3918mvafbmjd@uaapc442>
2003-11-04 14:54     ` Artem Prisyznuk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).