comp.lang.ada
 help / color / mirror / Atom feed
* [ANN] an EBNF parser and coding pattern tool (LGPL)
@ 2003-01-24  3:36 Cedric LEMAIRE
  2003-01-24 16:40 ` Victor Porton
  2003-01-24 16:40 ` apm
  0 siblings, 2 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-01-24  3:36 UTC (permalink / raw)


"CodeWorker" is a scripting language that is intended to assist the
developer in writing source code or documentation. It is distributed
under the ''GNU Lesser General Public License'' at the URL
"http://codeworker.free.fr".

This application is a 'semiskilled worker' specialized in generating
repetitive and tedious source code and text.

The software doesn't care of parochialism about languages and can
generate JAVA code as well as C++ or ADA or LaTeX or your own output
file, whatever it is.

Generic programming and implementation of coding patterns become very
easy.

The way it proceeds is:
	- to acquire modeling data from an extended BNF parser
interpreter,
	- to handle parse trees well adapted to represent a design and
easy
to walk,
	- to generate source code via kinds of 'coding patterns'.

It carries out these tasks via a scripting language, whose syntax is
particularly studied for:
	- describing an extended BNF: the syntax looks like the one
commonly
admitted for BNF,
	- providing all functions, statements and procedures that are
expected for a procedural language,
	- defining 'coding patterns': the principle is the same as XSLT,
JSP,
PHP and so on, but no target language is imposed (nor XML neither HTML
neither JAVA ...).

The predicated-LL(k) grammar is powerful enough to allow parsing any
kind of file (C++, 'Petal' file of Rational ROSE, LaTeX, ...).

The documentation ("http://codeworker.free.fr/CodeWorker.pdf") is
written in "frenglish" (easy to understand for French people, but very
far from Shakespeare!). I'll be very glad to take your remarks into
account (email "codeworker@free.fr") to improve it!

      [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-24  3:36 [ANN] an EBNF parser and coding pattern tool (LGPL) Cedric LEMAIRE
@ 2003-01-24 16:40 ` Victor Porton
  2003-01-25  0:33   ` llewelly
  2003-01-29  2:55   ` Cedric LEMAIRE
  2003-01-24 16:40 ` apm
  1 sibling, 2 replies; 40+ messages in thread
From: Victor Porton @ 2003-01-24 16:40 UTC (permalink / raw)


In article <clcm-20030123-0008@plethora.net>,
	codeworker@free.fr (Cedric LEMAIRE) writes:
> The documentation ("http://codeworker.free.fr/CodeWorker.pdf") is
> written in "frenglish" (easy to understand for French people, but very
> far from Shakespeare!). I'll be very glad to take your remarks into
> account (email "codeworker@free.fr") to improve it!

So one needs to know French to use it?
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-24  3:36 [ANN] an EBNF parser and coding pattern tool (LGPL) Cedric LEMAIRE
  2003-01-24 16:40 ` Victor Porton
@ 2003-01-24 16:40 ` apm
  2003-01-29  2:56   ` Cedric LEMAIRE
  2003-02-01  4:09   ` White Wolf
  1 sibling, 2 replies; 40+ messages in thread
From: apm @ 2003-01-24 16:40 UTC (permalink / raw)


codeworker@free.fr (Cedric LEMAIRE) wrote in message news:<clcm-20030123-0008@plethora.net>...
> The software doesn't care of parochialism about languages and can
> generate JAVA code as well as C++ or ADA or LaTeX or your own output
> file, whatever it is.
> Generic programming and implementation of coding patterns become very
[snip]
Does this mean it can be used to implement a program that can add and
remove Hungarian warts? This would enable programmers that don't speak
Hungarian to observe corporate standards but still work with
maintainable code.

-apm
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-24 16:40 ` Victor Porton
@ 2003-01-25  0:33   ` llewelly
  2003-01-29  2:55   ` Cedric LEMAIRE
  1 sibling, 0 replies; 40+ messages in thread
From: llewelly @ 2003-01-25  0:33 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> In article <clcm-20030123-0008@plethora.net>,
> 	codeworker@free.fr (Cedric LEMAIRE) writes:
> > The documentation ("http://codeworker.free.fr/CodeWorker.pdf") is
> > written in "frenglish" (easy to understand for French people, but very
> > far from Shakespeare!). I'll be very glad to take your remarks into
> > account (email "codeworker@free.fr") to improve it!
> 
> So one needs to know French to use it?

No. The documentation is quite comprehensible to native english
    speakers, even if (like me) you don't like seeing 'is' substituted
    for 'are'. 
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-24 16:40 ` Victor Porton
  2003-01-25  0:33   ` llewelly
@ 2003-01-29  2:55   ` Cedric LEMAIRE
  1 sibling, 0 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-01-29  2:55 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) wrote in message news:<clcm-20030124-0004@plethora.net>...
> In article <clcm-20030123-0008@plethora.net>,
> 	codeworker@free.fr (Cedric LEMAIRE) writes:
> > The documentation ("http://codeworker.free.fr/CodeWorker.pdf") is
> > written in "frenglish" (easy to understand for French people, but very
> > far from Shakespeare!). I'll be very glad to take your remarks into
> > account (email "codeworker@free.fr") to improve it!
> 
> So one needs to know French to use it?

Not at all! It is written in English, but with some spelling mistakes
or unappropriate vocabulary or grammar faults.
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-24 16:40 ` apm
@ 2003-01-29  2:56   ` Cedric LEMAIRE
  2003-01-31  2:25     ` Cedric LEMAIRE
                       ` (2 more replies)
  2003-02-01  4:09   ` White Wolf
  1 sibling, 3 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-01-29  2:56 UTC (permalink / raw)


apm35@student.open.ac.uk (apm) wrote in message news:<clcm-20030124-0006@plethora.net>...
> codeworker@free.fr (Cedric LEMAIRE) wrote in message news:<clcm-20030123-0008@plethora.net>...
> > The software doesn't care of parochialism about languages and can
> > generate JAVA code as well as C++ or ADA or LaTeX or your own output
> > file, whatever it is.
> > Generic programming and implementation of coding patterns become very
> [snip]
> Does this mean it can be used to implement a program that can add and
> remove Hungarian warts? This would enable programmers that don't speak
> Hungarian to observe corporate standards but still work with
> maintainable code.

Exactly. This program will be a script interpreted by 'CodeWorker', or
be a C++ program generated from the script automatically.
The way to do it is to use the 'source-to-source translation'
functionality of the software (an parse tree isn't necessary to
process the language-to-same-language transformation).

You must write the Extended BNF of the language you use (I don't
propose EBNF for languages yet) and to redefine some clauses
(identifier of a variable that is being declared, lambda-expression,
method identifier) to apply/remove the Hungary Notation on it.

Just a little detail: today, the source-to-source translation supposes
that the formats of the input and the output are different. So, you
must write explicitely the output. In the case of a source
transformation (your case), the imput should be implicitely copied to
the output, except when a special transformation must be processed
(change of variable names).
So, I'll improve the 'source-to-source translation' to process a
source transformation in a more convenient way. It will be available
before the end of the week, except if you are on a hurry!

About EBNF, I don't know what is your targeted language, but I'll be
interested in your contribution. And if you need help to write this
EBNF, do not hesitate to email me.
---------------
Cedric Lemaire
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-29  2:56   ` Cedric LEMAIRE
@ 2003-01-31  2:25     ` Cedric LEMAIRE
  2003-01-31  2:25     ` Anthony Williams
  2003-02-04 16:53     ` apm
  2 siblings, 0 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-01-31  2:25 UTC (permalink / raw)


> You must write the Extended BNF of the language you use (I don't
> propose EBNF for languages yet) and to redefine some clauses
> (identifier of a variable that is being declared, lambda-expression,
> method identifier) to apply/remove the Hungary Notation on it.
Finally, I'll provide the Extended BNF grammar of C++ in a few days.

> Just a little detail: today, the source-to-source translation supposes
> that the formats of the input and the output are different. So, you
> must write explicitely the output. In the case of a source
> transformation (your case), the imput should be implicitely copied to
> the output, except when a special transformation must be processed
> (change of variable names).
> So, I'll improve the 'source-to-source translation' to process a
> source transformation in a more convenient way. It will be available
> before the end of the week, except if you are on a hurry!
Implemented, will be available in the next release.


-- Cedric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-29  2:56   ` Cedric LEMAIRE
  2003-01-31  2:25     ` Cedric LEMAIRE
@ 2003-01-31  2:25     ` Anthony Williams
  2003-02-01  4:10       ` Cedric LEMAIRE
  2003-02-04 16:53     ` apm
  2 siblings, 1 reply; 40+ messages in thread
From: Anthony Williams @ 2003-01-31  2:25 UTC (permalink / raw)


codeworker@free.fr (Cedric LEMAIRE) writes:

> apm35@student.open.ac.uk (apm) wrote in message
> news:<clcm-20030124-0006@plethora.net>...
> > codeworker@free.fr (Cedric LEMAIRE) wrote in message
> > news:<clcm-20030123-0008@plethora.net>...
> > > The software doesn't care of parochialism about languages and can
> > > generate JAVA code as well as C++ or ADA or LaTeX or your own output
> > > file, whatever it is.
> > > Generic programming and implementation of coding patterns become very
> > [snip]

> You must write the Extended BNF of the language you use (I don't
> propose EBNF for languages yet) and to redefine some clauses
> (identifier of a variable that is being declared, lambda-expression,
> method identifier) to apply/remove the Hungary Notation on it.

So, if you want to use CodeWorker to modify C++ code based on a set of rules,
you need a grammar for C++, which you don't supply :-(

I can see the benefit of this tool, in that it would allow you to use
Aspect-Orientated Programming in C++ by performing C++-to-C++ translations
based on a set of rules, but someone has to write the grammar first.

C++ is not an easy language to parse, so I don't fancy that job.

Anthony
-- 
Anthony Williams
Senior Software Engineer, Beran Instruments Ltd.
Remove NOSPAM when replying, for timely response.
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-24 16:40 ` apm
  2003-01-29  2:56   ` Cedric LEMAIRE
@ 2003-02-01  4:09   ` White Wolf
  2003-02-03  1:28     ` Martin Ambuhl
                       ` (3 more replies)
  1 sibling, 4 replies; 40+ messages in thread
From: White Wolf @ 2003-02-01  4:09 UTC (permalink / raw)


"apm" wrote:
[SNIP]
> Does this mean it can be used to implement a program that can add and
> remove Hungarian warts? This would enable programmers that don't speak
> Hungarian to observe corporate standards but still work with
> maintainable code.

I would appreciate if people could stop here:

1.) connecting the Hungarian notation to Hungarians

2.) call Hungarians warts

I _am_ a Hungarian.  And I really do not like that tone.  Even if it is a
joke, it is a bad joke.  Two facts:

1.) There are over 15 million other Hungarians than Simonyi

2.) The Hungarian notation has _nothing_ to do with the Hungarian language.
In fact, one of the quite frequent prefixes (szar) means sh*t in Hungarian.

BTW I am yet to see any Hungarian who likes Hungarian notation.

So please keep it in mind, that I will fight 'till death against making the
Hungarians targets for lame jokes in the C++ community.  And you may wanna
notice, that the very computer you use to type in your not-funny lines -
among other Hungarians about me - is a Neumann computer.  He was a
Hungarian, too.

WW aka Attila

Ps: Now that was one (the post I have answered to), which moderation should
have stopped.
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-31  2:25     ` Anthony Williams
@ 2003-02-01  4:10       ` Cedric LEMAIRE
  0 siblings, 0 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-02-01  4:10 UTC (permalink / raw)


> > codeworker@free.fr (Cedric LEMAIRE) wrote:
> > You must write the Extended BNF of the language you use (I don't
> > propose EBNF for languages yet) and to redefine some clauses
> > (identifier of a variable that is being declared, lambda-expression,
> > method identifier) to apply/remove the Hungary Notation on it.
> >
> anthony.williams@anthonyw.cjb.net wrote:
> So, if you want to use CodeWorker to modify C++ code based on a set of rules,
> you need a grammar for C++, which you don't supply :-(

CodeWorker is Open-Source and, in that spirit, each contribution of
interested people that might improve the tool is welcome. For the C++
grammar, I'm taking it in charge finally.

> I can see the benefit of this tool, in that it would allow you to use
> Aspect-Orientated Programming in C++ by performing C++-to-C++ translations
> based on a set of rules, but someone has to write the grammar first.

This tools pretents first generating a lot of code for you, acquiring
your Design from any kind of format (I'm rewriting the Rational ROSE
one for publishing it, the first I wrote isn't my intellectual
property) - thanks to the E-BNF -, decorating the parse tree and
exploring it through coding patterns. The process is straight-forward,
without a binding to an external programming language, as proposed
ordinarly.

The source-to-source translation came later (I wrote a LaTex-to-HTML
translation adapted to my documentation for example). It isn't the
original purpose of the tool ; it explains why no language grammars
are available yet!

> C++ is not an easy language to parse, so I don't fancy that job.

I understand. I wrote the E-BNF grammar of the C++/ISO 14882 ; It
scans C++ files. I need more time to give a description of all
declarations seen from any scope in the C++ file.
I terminate this tedious job as soon as possible.

--Cedric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-01  4:09   ` White Wolf
@ 2003-02-03  1:28     ` Martin Ambuhl
  2003-02-03  1:28     ` Hillel Y. Sims
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 40+ messages in thread
From: Martin Ambuhl @ 2003-02-03  1:28 UTC (permalink / raw)


White Wolf wrote:

> I would appreciate if people could stop here:
> 
> 1.) connecting the Hungarian notation to Hungarians
> 
> 2.) call Hungarians warts
> 
> I _am_ a Hungarian.  And I really do not like that tone.  Even if it is a
> joke, it is a bad joke. [etc.]


Is it OK for me to continue calling it "the Transylvanian Heresy"?
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-01  4:09   ` White Wolf
  2003-02-03  1:28     ` Martin Ambuhl
@ 2003-02-03  1:28     ` Hillel Y. Sims
  2003-02-03 16:31       ` Tars_Tarkas
  2003-02-03  1:29     ` Mark McIntyre
  2003-02-03 16:31     ` Cedric LEMAIRE
  3 siblings, 1 reply; 40+ messages in thread
From: Hillel Y. Sims @ 2003-02-03  1:28 UTC (permalink / raw)


"White Wolf" <wolof@freemail.hu> wrote in message
news:clcm-20030131-0001@plethora.net...
>
> I would appreciate if people could stop here:
>
> 1.) connecting the Hungarian notation to Hungarians
>
[..]
> Two facts:
>
> 1.) There are over 15 million other Hungarians than Simonyi

This seems slightly logically inconsistent. If Simonyi is
Hungarian, then there is a valid connection between Simonyi's
invention and Hungarians. I don't think anyone of any reasonable
intelligence capable of reading these articles therefore relates
any negative aspects in his invention to Hungarians in general
though!

>
> 2.) The Hungarian notation has _nothing_ to do with the
Hungarian language.

And then there's Reverse Polish Notation too; which is a
generally well-respected, if also oddly named, technique. Who
was making fun of Hungarians?? Everyone reading these groups
understands what is meant by "Hungarian notation"; at most the
previous poster was merely guilty of omitting the word
"notation" in a few places, where it was already implictly
assumed anyhow. As someone who has a fair dislike for overuse of
Hungarian notation style, it does not really lead me to feel any
kind of negativity toward Hungarians in general, and even that
particular post did not make me feel any kind of negativity
toward Hungarians in general, and I doubt anyone else thinks
there is any kind of slur on Hungarians, except for some
overly-sensitive Hungarians! :-O)

>
> BTW I am yet to see any Hungarian who likes Hungarian
notation.

Probably not many non-Hungarians either!

>
> So please keep it in mind, that I will fight 'till death
against making the
> Hungarians targets for lame jokes in the C++ community.  And
you may wanna
> notice, that the very computer you use to type in your
not-funny lines -
> among other Hungarians about me - is a Neumann computer.  He
was a
> Hungarian, too.
>
> WW aka Attila

I don't speak for the previous poster, but I think you are
simply overreacting. People should be entitled to speak their
minds without fear of possibly offending someone somewhere with
the slightest nuance of their speech. Did you ever hear the
saying "sticks and stones may break my bones, but words will
never hurt me"?

Can't we all just get along? :-D

hys
--
(c) 2003 Hillel Y. Sims
hsims AT factset.com
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-01  4:09   ` White Wolf
  2003-02-03  1:28     ` Martin Ambuhl
  2003-02-03  1:28     ` Hillel Y. Sims
@ 2003-02-03  1:29     ` Mark McIntyre
  2003-02-03 16:31       ` CBFalconer
  2003-02-03 16:31       ` ozbear
  2003-02-03 16:31     ` Cedric LEMAIRE
  3 siblings, 2 replies; 40+ messages in thread
From: Mark McIntyre @ 2003-02-03  1:29 UTC (permalink / raw)


On 01 Feb 2003 04:09:52 GMT, in comp.lang.c , "White Wolf"
<wolof@freemail.hu> wrote:

>"apm" wrote:
>[SNIP]
>> Does this mean it can be used to implement a program that can add and
>> remove Hungarian warts? This would enable programmers that don't speak
>> Hungarian to observe corporate standards but still work with
>> maintainable code.
>
>I would appreciate if people could stop here:
>1.) connecting the Hungarian notation to Hungarians

nobody did this.
>
>2.) call Hungarians warts

or this.

>
>I _am_ a Hungarian.  And I really do not like that tone.  Even if it is a
>joke, it is a bad joke.  

You're too sensitive. Get a thicker skin. If I rose to it every time
someone said that scotsmen were mean, I'd spend my entire life rising.

>Two facts:
>1.) There are over 15 million other Hungarians than Simonyi

Good god, there's More? But can they dance? 


-- 
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-03  1:28     ` Hillel Y. Sims
@ 2003-02-03 16:31       ` Tars_Tarkas
  0 siblings, 0 replies; 40+ messages in thread
From: Tars_Tarkas @ 2003-02-03 16:31 UTC (permalink / raw)


Hillel Y. Sims wrote:
> "White Wolf" <wolof@freemail.hu> wrote in message
> news:clcm-20030131-0001@plethora.net...
> 
[ overreacting to post where no offense was ment ]
> 
> I don't speak for the previous poster, but I think you are
> simply overreacting. People should be entitled to speak their
> minds without fear of possibly offending someone somewhere with
> the slightest nuance of their speech. Did you ever hear the
> saying "sticks and stones may break my bones, but words will
> never hurt me"?

Are you sure you can always follow this advise yourself though? Not that 
I can, though I do try...

Might sound strange, but the way the www works (on an html - protocol 
level) is actualy a good idea for human-human interaction.

The way that html is specified is those that produce it (editors...) 
should take greatest care to produce nice html code and those that 
accept it (browsers...) should try to make some sense out of even the 
most confused/un-nice code.

So, if those who speak try to be as nice as possible and those that hear 
try to have as thick a skin as possible, communication remains possible 
in a nice way.

> Can't we all just get along? :-D

Approximately 2000 years ago, there was somebody who was horribly killed 
and he was only saying exactly that...
-- 
GP_Spukgestalt.
"The world is made of Love and Peace!"
	-- Vash the Stampede.
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-03  1:29     ` Mark McIntyre
@ 2003-02-03 16:31       ` CBFalconer
  2003-02-04 16:53         ` Georg Bauhaus
  2003-02-03 16:31       ` ozbear
  1 sibling, 1 reply; 40+ messages in thread
From: CBFalconer @ 2003-02-03 16:31 UTC (permalink / raw)


Mark McIntyre wrote:
> 
.... snip Hungarians ...
> 
> You're too sensitive. Get a thicker skin. If I rose to it every
> time someone said that scotsmen were mean, I'd spend my entire
> life rising.

And it would make my standard defense against accusations of penny
penching (my Scottish ancestry) awkward.  I also have Hungarian
ancestry, but no inclination whatsoever towards using Hungarian
notation.  Is that significant?  I have been known to use Polish
notation without any (known) Polish genes, reversed or otherwise. 
How about Roman numerals? Arabic numbers? Greek letters?

-- 
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-01  4:09   ` White Wolf
                       ` (2 preceding siblings ...)
  2003-02-03  1:29     ` Mark McIntyre
@ 2003-02-03 16:31     ` Cedric LEMAIRE
  3 siblings, 0 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-02-03 16:31 UTC (permalink / raw)


"White Wolf" <wolof@freemail.hu> wrote in message news:<clcm-20030131-0001@plethora.net>...
> "apm" wrote:
> [SNIP]
> > Does this mean it can be used to implement a program that can add and
> > remove Hungarian warts? This would enable programmers that don't speak
> > Hungarian to observe corporate standards but still work with
> > maintainable code.
> 
> I would appreciate if people could stop here:
> 
> 1.) connecting the Hungarian notation to Hungarians
> 
> 2.) call Hungarians warts
> 
> I _am_ a Hungarian.  And I really do not like that tone.  Even if it is a
> joke, it is a bad joke.  Two facts:

Could you please read the 2 sentences of "apm" again? It has nothing
to do with Hungarian people. Convinced now? I'm a foreigner too: I
needed to read "Hungarian warts" twice to understand.

We were speaking about source-to-source translation, code generation
(sorry for ADA people, we spoke more about C++ up to now!) and E-BNF
grammars. Could we continue?

-- Cedric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-03  1:29     ` Mark McIntyre
  2003-02-03 16:31       ` CBFalconer
@ 2003-02-03 16:31       ` ozbear
  1 sibling, 0 replies; 40+ messages in thread
From: ozbear @ 2003-02-03 16:31 UTC (permalink / raw)


On 03 Feb 2003 01:29:03 GMT, Mark McIntyre <markmcintyre@spamcop.net>
wrote:

>On 01 Feb 2003 04:09:52 GMT, in comp.lang.c , "White Wolf"
><wolof@freemail.hu> wrote:
>
<snip>
>>
>>I _am_ a Hungarian.  And I really do not like that tone.  Even if it is a
>>joke, it is a bad joke.  
>
>You're too sensitive. Get a thicker skin. If I rose to it every time
>someone said that scotsmen were mean, I'd spend my entire life rising.
>
<snip>

I had never heard that scotsmen were mean...just cheap...

Oz
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-01-29  2:56   ` Cedric LEMAIRE
  2003-01-31  2:25     ` Cedric LEMAIRE
  2003-01-31  2:25     ` Anthony Williams
@ 2003-02-04 16:53     ` apm
  2003-02-06 20:35       ` Cedric LEMAIRE
  2003-02-06 20:36       ` Cedric LEMAIRE
  2 siblings, 2 replies; 40+ messages in thread
From: apm @ 2003-02-04 16:53 UTC (permalink / raw)


codeworker@free.fr (Cedric LEMAIRE) wrote in message news:<clcm-20030128-> > [snip]
> > Does this mean it can be used to implement a program that can add and
> > remove Hungarian warts? This would enable programmers that don't speak
> > Hungarian to observe corporate standards but still work with
> > maintainable code.
> 
> Exactly. This program will be a script interpreted by 'CodeWorker', or
> be a C++ program generated from the script automatically.

This is excellent news.

> The way to do it is to use the 'source-to-source translation'
> functionality of the software (an parse tree isn't necessary to
> process the language-to-same-language transformation).
> 
> You must write the Extended BNF of the language you use (I don't
> propose EBNF for languages yet) and to redefine some clauses
> (identifier of a variable that is being declared, lambda-expression,
> method identifier) to apply/remove the Hungary Notation on it.

I was thinking of its application to C++. There is a well-known form
of "the Transylvanian Heresy" which most developers will have seen
from time to time. It includes things like 'b' for boolean, 'p' for
pointer, 'h' for handle, 'sz' for null terminated string, and so on.
Will there be default rules for this? This would allow people to work
with the most common form of 'the heresy'.

BTW I heard that the rules for parsing C++ have been expressed in BNF
and this *is* downloadable (sorry I don't have the URL).

-apm
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-03 16:31       ` CBFalconer
@ 2003-02-04 16:53         ` Georg Bauhaus
  2003-02-06 20:36           ` Cedric LEMAIRE
  0 siblings, 1 reply; 40+ messages in thread
From: Georg Bauhaus @ 2003-02-04 16:53 UTC (permalink / raw)


In comp.lang.ada CBFalconer <cbfalconer@yahoo.com> wrote:
: How about Roman numerals? Arabic numbers? Greek letters?
 
Yes, how about them. Certainly Greek letters were use by the
greeks, while Polish notation is a misnomer surviving through
thoughtless imitation.

Likewise, it is C++ templates, not elaborate macro spit,
or Ada, a female name, not ADA.

(Until recently, we have been eating Americans here. Soft
sweet cakes, the name has vanished in a PC correctness effort,
in some bakeries.)


-- georg
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-04 16:53     ` apm
@ 2003-02-06 20:35       ` Cedric LEMAIRE
  2003-02-06 20:36       ` Cedric LEMAIRE
  1 sibling, 0 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-02-06 20:35 UTC (permalink / raw)


apm35@student.open.ac.uk (apm) wrote:
> BTW I heard that the rules for parsing C++ have been expressed in BNF
> and this *is* downloadable (sorry I don't have the URL).

I did the first step: scanning a C++ file with an E-BNF (including the
preprocessing), but some ambiguities might not have been resolved yet.
I'll tell you when the complete job will be available (hope half of
the month?).

So, it *isn't* downloadable yet but soon, sorry!

-- C�dric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-04 16:53         ` Georg Bauhaus
@ 2003-02-06 20:36           ` Cedric LEMAIRE
  2003-02-07 17:33             ` Hyman Rosen
                               ` (2 more replies)
  0 siblings, 3 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-02-06 20:36 UTC (permalink / raw)


Georg Bauhaus <sb463ba@uni-duisburg.de> wrote:
> Likewise, it is C++ templates, not elaborate macro spit,
> or Ada, a female name, not ADA.

I repeat what i wrote in the first posted message (after correcting
ADA to Ada):
> > The software doesn't care of parochialism about languages and can
> > generate JAVA code as well as C++ or Ada or LaTeX or your own output
> > file, whatever it is.

And C++ templates are too restricted to do generic programming and
code generation in a large scope. I'll give examples later if some
people react to this assertion.


-- C�dric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-04 16:53     ` apm
  2003-02-06 20:35       ` Cedric LEMAIRE
@ 2003-02-06 20:36       ` Cedric LEMAIRE
  1 sibling, 0 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-02-06 20:36 UTC (permalink / raw)


apm35@student.open.ac.uk (apm) wrote in message news:<clcm-20030204-0001@plethora.net>...
> codeworker@free.fr (Cedric LEMAIRE) wrote in message news:<clcm-20030128-> > [snip]
> > > Does this mean it can be used to implement a program that can add and
> > > remove Hungarian warts? This would enable programmers that don't speak
> > > Hungarian to observe corporate standards but still work with
> > > maintainable code.
> > 
> > Exactly. This program will be a script interpreted by 'CodeWorker', or
> > be a C++ program generated from the script automatically.
> 
> This is excellent news.
> 
> > The way to do it is to use the 'source-to-source translation'
> > functionality of the software (an parse tree isn't necessary to
> > process the language-to-same-language transformation).
> > 
> > You must write the Extended BNF of the language you use (I don't
> > propose EBNF for languages yet) and to redefine some clauses
> > (identifier of a variable that is being declared, lambda-expression,
> > method identifier) to apply/remove the Hungary Notation on it.
> 
> I was thinking of its application to C++. There is a well-known form
> of "the Transylvanian Heresy" which most developers will have seen
> from time to time. It includes things like 'b' for boolean, 'p' for
> pointer, 'h' for handle, 'sz' for null terminated string, and so on.
> Will there be default rules for this? This would allow people to work
> with the most common form of 'the heresy'.
> 
> BTW I heard that the rules for parsing C++ have been expressed in BNF
> and this *is* downloadable (sorry I don't have the URL).
> 
> -apm

I'm doubtful suddenly: are you really interested by source-to-source translation?

-- Cedric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-06 20:36           ` Cedric LEMAIRE
@ 2003-02-07 17:33             ` Hyman Rosen
  2003-02-08 18:22               ` Thant Tessman
  2003-02-07 17:33             ` Anthony Williams
  2003-02-07 17:33             ` Hyman Rosen
  2 siblings, 1 reply; 40+ messages in thread
From: Hyman Rosen @ 2003-02-07 17:33 UTC (permalink / raw)


Cedric LEMAIRE wrote:
> And C++ templates are too restricted to do generic programming and
> code generation in a large scope. I'll give examples later if some
> people react to this assertion.

This means me, right? OK, here goes -

What! Are you nuts? C++ templates can do anything!
Do have any examples to prove your claim?

Good enough? :-)
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-06 20:36           ` Cedric LEMAIRE
  2003-02-07 17:33             ` Hyman Rosen
@ 2003-02-07 17:33             ` Anthony Williams
  2003-02-11  6:15               ` Cedric LEMAIRE
  2003-02-07 17:33             ` Hyman Rosen
  2 siblings, 1 reply; 40+ messages in thread
From: Anthony Williams @ 2003-02-07 17:33 UTC (permalink / raw)


codeworker@free.fr (Cedric LEMAIRE) writes:

> And C++ templates are too restricted to do generic programming and
> code generation in a large scope. I'll give examples later if some
> people react to this assertion.

OK, I'll bite ... why do you think C++ templates are too restricted?

Anthony
-- 
Anthony Williams
Senior Software Engineer, Beran Instruments Ltd.
Remove NOSPAM when replying, for timely response.
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-06 20:36           ` Cedric LEMAIRE
  2003-02-07 17:33             ` Hyman Rosen
  2003-02-07 17:33             ` Anthony Williams
@ 2003-02-07 17:33             ` Hyman Rosen
  2 siblings, 0 replies; 40+ messages in thread
From: Hyman Rosen @ 2003-02-07 17:33 UTC (permalink / raw)


Cedric LEMAIRE wrote:
 > And C++ templates are too restricted to do generic programming and
 > code generation in a large scope. I'll give examples later if some
 > people react to this assertion.

This means me, right? OK, here goes -

What! Are you nuts? C++ templates can do anything!
Do have any examples to prove your claim?

Good enough? :-)


      [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-07 17:33             ` Hyman Rosen
@ 2003-02-08 18:22               ` Thant Tessman
  0 siblings, 0 replies; 40+ messages in thread
From: Thant Tessman @ 2003-02-08 18:22 UTC (permalink / raw)


Hyman Rosen wrote:
> Cedric LEMAIRE wrote:
> 
>> And C++ templates are too restricted to do generic programming and
>> code generation in a large scope. I'll give examples later if some
>> people react to this assertion.
> 
> 
> This means me, right? OK, here goes -
> 
> What! Are you nuts? C++ templates can do anything!
> Do have any examples to prove your claim?
> 
> Good enough? :-)

You've been challenged in the comp.lang.scheme and comp.lang.functional 
newsgroups. See the thread entitled:

	C++ templates vs. syntax-rules: a median challenge

-thant
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-07 17:33             ` Anthony Williams
@ 2003-02-11  6:15               ` Cedric LEMAIRE
  2003-02-12  1:30                 ` Hyman Rosen
                                   ` (2 more replies)
  0 siblings, 3 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-02-11  6:15 UTC (permalink / raw)


Anthony Williams <anthony.williamsNOSPAM@anthonyw.cjb.net> wrote in message news:<clcm-20030207-0005@plethora.net>...
> codeworker@free.fr (Cedric LEMAIRE) writes:
> 
> > And C++ templates are too restricted to do generic programming and
> > code generation in a large scope. I'll give examples later if some
> > people react to this assertion.
> 
> OK, I'll bite ... why do you think C++ templates are too restricted?

The C++ compiler doesn't give you introspection to implement C++
templates that
work on the composition of a class.

How to write with C++ templates an "Object Unmarshaller", for
instance? I mean, something that reads the serialized content of an
object and that builds the corresponding object in memory. Be careful!
No intervention must be done on these objects in C++ to facilitate
their integration into the "unmarshaller".

How to write an "Object Walker", something that enables to navigate
amongst the object attributes of the instances, for applying a task on
them (starting from a given object: to initialize all of them or to
serialize all of them or describing them in HTML to query the
application from a browser ...)?

I want to be able to write the generic code of these features as
easily as if I was implementing them by hand, for each object to
handle. But the 'coding pattern' must be written once only and must be
easy to support. And not to be an intellectual exercise for the
pleasure of the brain.

And it is why I said that C++ templates are too restricted (I could
have said: "... and not very readable on complex features" but I
haven't because it is a question of taste I imagine).

-- Cedric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-11  6:15               ` Cedric LEMAIRE
@ 2003-02-12  1:30                 ` Hyman Rosen
  2003-02-13 20:03                   ` Brian Inglis
  2003-02-15 20:14                   ` Cedric LEMAIRE
  2003-02-12  1:30                 ` Julián Albo
  2003-02-12  1:30                 ` Stephen Leake
  2 siblings, 2 replies; 40+ messages in thread
From: Hyman Rosen @ 2003-02-12  1:30 UTC (permalink / raw)


Cedric LEMAIRE wrote:
> The C++ compiler doesn't give you introspection to implement C++
> templates that work on the composition of a class.

Yes, this is true. To get this would require support from the
compiler, and I imagine would look something like this - the
result of introspect<T> for some type T would be a class with
informative members, some of which would be like Alexandrescu's
type lists that would carry member and base class information
and could be processed recursively by other templates. We would
also want an equivalent dynamic interface, so that we could take
a polymorphic pointer or reference and deal with its introspection
at runtime.
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-11  6:15               ` Cedric LEMAIRE
  2003-02-12  1:30                 ` Hyman Rosen
@ 2003-02-12  1:30                 ` Julián Albo
  2003-02-15 20:14                   ` Cedric LEMAIRE
  2003-02-12  1:30                 ` Stephen Leake
  2 siblings, 1 reply; 40+ messages in thread
From: Julián Albo @ 2003-02-12  1:30 UTC (permalink / raw)


Cedric LEMAIRE escribi�:

> > OK, I'll bite ... why do you think C++ templates are too restricted?

> The C++ compiler doesn't give you introspection to implement C++
> templates that work on the composition of a class.
> How to write with C++ templates an "Object Unmarshaller", for
> instance? I mean, something that reads the serialized content of an
> object and that builds the corresponding object in memory. Be careful!
> No intervention must be done on these objects in C++ to facilitate
> their integration into the "unmarshaller".

But here you talk about how are the classes in C++, not the templates.

Regards.
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-11  6:15               ` Cedric LEMAIRE
  2003-02-12  1:30                 ` Hyman Rosen
  2003-02-12  1:30                 ` Julián Albo
@ 2003-02-12  1:30                 ` Stephen Leake
  2003-02-12 18:22                   ` Hyman Rosen
  2003-02-15 20:14                   ` Cedric LEMAIRE
  2 siblings, 2 replies; 40+ messages in thread
From: Stephen Leake @ 2003-02-12  1:30 UTC (permalink / raw)


codeworker@free.fr (Cedric LEMAIRE) writes:

> How to write with C++ templates an "Object Unmarshaller", for
> instance? I mean, something that reads the serialized content of an
> object and that builds the corresponding object in memory. Be
> careful! No intervention must be done on these objects in C++ to
> facilitate their integration into the "unmarshaller".

C++ templates can't do this. Neither do Ada generics. But I could
easily write a code generator to do this with ASIS.

Is there any language whose generics do this? 

> How to write an "Object Walker", something that enables to navigate
> amongst the object attributes of the instances, for applying a task on
> them (starting from a given object: to initialize all of them or to
> serialize all of them or describing them in HTML to query the
> application from a browser ...)?

You've lost me here. If I need to navigate a tree, I first have to
build the tree, presumably using a tree class. Then the tree class
must provide a "walker" (aka "iterator"). Where do "generics" or
"templates" come into it?

-- 
-- Stephe
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-12  1:30                 ` Stephen Leake
@ 2003-02-12 18:22                   ` Hyman Rosen
  2003-02-12 19:39                     ` Stephen Leake
  2003-02-15 20:14                   ` Cedric LEMAIRE
  1 sibling, 1 reply; 40+ messages in thread
From: Hyman Rosen @ 2003-02-12 18:22 UTC (permalink / raw)


Stephen Leake wrote:
> Is there any language whose generics do this?

Not that I know of, except maybe for the lisp-like ones.
But Java is certainly able to do it at runtime.

> You've lost me here. If I need to navigate a tree, I first have to
> build the tree, presumably using a tree class. Then the tree class
> must provide a "walker" (aka "iterator"). Where do "generics" or
> "templates" come into it?

When things are known at compile time, they can be generated
at compile time. You need to read up on what's being done in
the world of C++ templates. Here's a cursory synopsis:

     struct Nil { };

     template <typename T1, typename T2>
     struct TList
     {
         typedef T1 first;
         typedef T2 rest;
     };

Now, given an arbitrary class, like

     struct A { int a; double c; char *p; };

I could reasonably ask the compiler to provide me with

     Introspect<A>::FieldTypes

which would be a typedef for

     TList<int, TList<double, TList<char *, Nil> > >

and then I could write "recursive" templates which would
work on this typelist. If I had a similar list of integers
that gave the offset of each field within A, I could then
use the pair of lists to build a serialization mechanism
as a generic function that would wotk for arbitrary classes.
(I'd need something similar for the base classes, but you
get the idea.) The actual code that would wind up being
generated by an instantiation for a particular type would
be a straightforward set of operations on each field, which
is why it's so desirable for this to be in templates.

So you see, this answers your question. The "tree" is built
by the compiler, and is represented by the TList<...> type.
The walker/iterator is done through template partial
specializations (which I realize I haven't shown, so here's
an example).

     // Get the Nth type of a typelist
     template <int N, typename T>
     struct Select;

     template <typename T1, typename T2>
     struct Select<0, TList<T1, T2> >
     { typedef T1 Type; };

     template <int N, typename T1, typename T2>
     struct Select<N, TList<T1, T2> >
     { typedef typename Select<N - 1, T2>::Type Type; };




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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-12 18:22                   ` Hyman Rosen
@ 2003-02-12 19:39                     ` Stephen Leake
  2003-02-12 21:16                       ` Hyman Rosen
  0 siblings, 1 reply; 40+ messages in thread
From: Stephen Leake @ 2003-02-12 19:39 UTC (permalink / raw)


Hyman Rosen <hyrosen@mail.com> writes:

> When things are known at compile time, they can be generated
> at compile time. You need to read up on what's being done in
> the world of C++ templates. Here's a cursory synopsis:
> 
>      struct Nil { };
> 
>      template <typename T1, typename T2>
>      struct TList
>      {
>          typedef T1 first;
>          typedef T2 rest;
>      };
> 
> Now, given an arbitrary class, like
> 
>      struct A { int a; double c; char *p; };
> 
> I could reasonably ask the compiler to provide me with
> 
>      Introspect<A>::FieldTypes
> 
> which would be a typedef for
> 
>      TList<int, TList<double, TList<char *, Nil> > >
> 

That makes sense, assuming "Introspect" and "FieldTypes" are new C++
keywords. Are there any C++ compilers that actually do this? I don't
think it's in the current ISO C++ standard.

Is there anything preventing the same techniques in Ada? (assuming we
allow new keywords).

How does this compare with an ASIS tool for Ada? Seems to me ASIS is a
more straight-forward, and more flexible, approach.

> <snip rest>

-- 
-- Stephe



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-12 19:39                     ` Stephen Leake
@ 2003-02-12 21:16                       ` Hyman Rosen
  2003-02-14 20:34                         ` Stephen Leake
  0 siblings, 1 reply; 40+ messages in thread
From: Hyman Rosen @ 2003-02-12 21:16 UTC (permalink / raw)


Stephen Leake wrote:
> That makes sense, assuming "Introspect" and "FieldTypes" are new C++
> keywords. Are there any C++ compilers that actually do this? I don't
> think it's in the current ISO C++ standard.

No, there aren't, which was the OP's point. I was describing an
outline of how it could potentially be added to C++. If it was,
Introspect (or something similar) could be made to look like a
class template in namespace std, so no new keywords would be
involved.

> Is there anything preventing the same techniques in Ada?

Ada doesn't have partial specialization of generics (that is,
allowing completely different generic contents based on subsets
of the parameters), so it can't do the recursive template stuff,
at least as far as I know, given how poorly I know Ada.

> How does this compare with an ASIS tool for Ada?
 > Seems to me ASIS is a more straight-forward,
 > and more flexible, approach.

I don't know enough about ASIS to say. Can an Ada program
use ASIS in order to inspect itself? Can it apply ASIS
within a generic to examine its generic parameters?




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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-12  1:30                 ` Hyman Rosen
@ 2003-02-13 20:03                   ` Brian Inglis
  2003-02-15 20:13                     ` Hyman Rosen
  2003-02-15 20:14                   ` Cedric LEMAIRE
  1 sibling, 1 reply; 40+ messages in thread
From: Brian Inglis @ 2003-02-13 20:03 UTC (permalink / raw)


On 12 Feb 2003 01:30:42 GMT in comp.lang.c.moderated, Hyman Rosen
<hyrosen@mail.com> wrote:

>Cedric LEMAIRE wrote:
>> The C++ compiler doesn't give you introspection to implement C++
>> templates that work on the composition of a class.
>
>Yes, this is true. To get this would require support from the
>compiler, and I imagine would look something like this - the
>result of introspect<T> for some type T would be a class with
>informative members, some of which would be like Alexandrescu's
>type lists that would carry member and base class information
>and could be processed recursively by other templates. We would
>also want an equivalent dynamic interface, so that we could take
>a polymorphic pointer or reference and deal with its introspection
>at runtime.

Macros have been used in C for years to generate generic
structures and code to process them. Define all the structure
member names and types as macro arguments calling a macro that is
a parameter of the structure definition macro, with a few extra
parameters in each level of macro for code gen arguments, e.g.

#define OBJ(B,M,E,X,Y,Z)\
B\
M(int,i,X,Y,Z)\
M(char,c,X,Y,Z)\
E

#define TD typedef struct s {
#define ETD } s
#define TN(t,n,X,Y,Z) t n;
#define O(t,n,X,Y,Z) << n

OBJ( TD, TN, ETD, , , );

OBJ( cout, O, , , , );

Extend as required. 

Thanks. Take care, Brian Inglis 	Calgary, Alberta, Canada
-- 
Brian.Inglis@CSi.com 	(Brian dot Inglis at SystematicSw dot ab dot ca)
    fake address		use address above to reply
abuse@aol.com tosspam@aol.com abuse@att.com abuse@earthlink.com 
abuse@hotmail.com abuse@mci.com abuse@msn.com abuse@sprint.com 
abuse@yahoo.com abuse@cadvision.com abuse@shaw.ca abuse@telus.com 
abuse@ibsystems.com uce@ftc.gov				spam traps
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-12 21:16                       ` Hyman Rosen
@ 2003-02-14 20:34                         ` Stephen Leake
  0 siblings, 0 replies; 40+ messages in thread
From: Stephen Leake @ 2003-02-14 20:34 UTC (permalink / raw)


Hyman Rosen <hyrosen@mail.com> writes:

> Stephen Leake wrote:
> > That makes sense, assuming "Introspect" and "FieldTypes" are new C++
> > keywords. Are there any C++ compilers that actually do this? I don't
> > think it's in the current ISO C++ standard.
> 
> No, there aren't, which was the OP's point. I was describing an
> outline of how it could potentially be added to C++. If it was,
> Introspect (or something similar) could be made to look like a
> class template in namespace std, so no new keywords would be
> involved.

Ok, that makes sense.

> > Is there anything preventing the same techniques in Ada?
> 
> Ada doesn't have partial specialization of generics (that is,
> allowing completely different generic contents based on subsets
> of the parameters), so it can't do the recursive template stuff,
> at least as far as I know, given how poorly I know Ada.

Right, that makes sense as well.

> > How does this compare with an ASIS tool for Ada?
>  > Seems to me ASIS is a more straight-forward,
>  > and more flexible, approach.
> 
> I don't know enough about ASIS to say. Can an Ada program
> use ASIS in order to inspect itself? 

Not at run time; ASIS is a compile time tool.

> Can it apply ASIS within a generic to examine its generic
> parameters?

Yes, at compile time.

ASIS allows you to inspect a program that has been compiled. In this
case, you would use it to generate code to do the object tree walking.

In general, I suspect an ASIS approach would yeild a smaller run-time,
since you don't need run-time support for introspection. 

-- 
-- Stephe



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-13 20:03                   ` Brian Inglis
@ 2003-02-15 20:13                     ` Hyman Rosen
  0 siblings, 0 replies; 40+ messages in thread
From: Hyman Rosen @ 2003-02-15 20:13 UTC (permalink / raw)


Brian Inglis wrote:
> Macros have been used in C for years to generate generic
> structures and code to process them.

In the C++ community macros are considered a generally
unacceptable solution except in very limited cases.
Indeed, C++ started off with a macro-based "generic.h"
which was used before templates became available.

In any case, we would require introspection to work for
arbitrary classes, not just those which had been built
in a special way to enable it. If we wished to limit
ourselves to that, there are tuple-based approaches
that we could use right now.
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-12  1:30                 ` Julián Albo
@ 2003-02-15 20:14                   ` Cedric LEMAIRE
  2003-02-19  6:10                     ` Alan Balmer
  0 siblings, 1 reply; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-02-15 20:14 UTC (permalink / raw)


Juli�n Albo <JULIANALBO@terra.es> wrote in message news:<clcm-20030211-0011@plethora.net>...
> Cedric LEMAIRE escribi�:
> 
> > > OK, I'll bite ... why do you think C++ templates are too restricted?
>  
> > The C++ compiler doesn't give you introspection to implement C++
> > templates that work on the composition of a class.
> > How to write with C++ templates an "Object Unmarshaller", for
> > instance? I mean, something that reads the serialized content of an
> > object and that builds the corresponding object in memory. Be careful!
> > No intervention must be done on these objects in C++ to facilitate
> > their integration into the "unmarshaller".
> 
> But here you talk about how are the classes in C++, not the templates.

I talk about how to do such a C++ class with templates if i don't have
introspection.

-- C�dric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-12  1:30                 ` Stephen Leake
  2003-02-12 18:22                   ` Hyman Rosen
@ 2003-02-15 20:14                   ` Cedric LEMAIRE
  1 sibling, 0 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-02-15 20:14 UTC (permalink / raw)


Stephen Leake <Stephen.A.Leake@nasa.gov> wrote in message news:<clcm-20030211-0012@plethora.net>...
> codeworker@free.fr (Cedric LEMAIRE) writes:
> 
> > How to write with C++ templates an "Object Unmarshaller", for
> > instance? I mean, something that reads the serialized content of an
> > object and that builds the corresponding object in memory. Be
> > careful! No intervention must be done on these objects in C++ to
> > facilitate their integration into the "unmarshaller".
> 
> C++ templates can't do this. Neither do Ada generics. But I could
> easily write a code generator to do this with ASIS.
> 
> Is there any language whose generics do this? 

Not a system programming language, but a scripting language: did you
try 'CodeWorker' at "http://codeworker.free.fr"? I implemented these
examples very easily in it.

> 
> > How to write an "Object Walker", something that enables to navigate
> > amongst the object attributes of the instances, for applying a task on
> > them (starting from a given object: to initialize all of them or to
> > serialize all of them or describing them in HTML to query the
> > application from a browser ...)?
> 
> You've lost me here.

I want to navigate amongst the object attributes of (an instance of) a
class, to apply a process on them.

  class A {
    ...
  public:
    virtual void accept(Visitor&);
  };

  class B {
    ...
    A* a;
  public:
    virtual void accept(Visitor&);
  };

  class C {
    ...
    A* a;
    std::vector<B*> list;
  public:
    virtual void accept(Visitor&);
  };

And now:
  void f(C& c) {
    HTMLVisitor processToApplyRecursivelyOnObjects;
    ObjectWalker walker(processToApplyRecursivelyOnObjects);
    walker.navigate(c);
  }

where the instance c and all its associations/aggregations (attributes
'a' and 'list') will be written in HTML, propagating the process on
object attributes (c.a and c.list[i] and c.list[i].a ...) recursively.

'HTMLVisitor' is a visitor that knows how to serialize in HTML all
instances of A, B and C. It cannot be written with C++ templates. By
hand? I'm used to work on Business applications of a few hundred
classes and a few thousand attributes (associations and other).

'ObjectWalker' cannot be written with C++ templates. It has to know
the composition of each class.

However, these classes can be written with 'CodeWorker' very easily.

> If I need to navigate a tree, I first have to
> build the tree, presumably using a tree class. Then the tree class
> must provide a "walker" (aka "iterator"). Where do "generics" or
> "templates" come into it?
> 
Your tree is an kind of 'abstract tree of object dependencies'. It is
an instance and its associations/aggregations. I don't want to build a
structure for it: it is already present as the representation of the
instance in memory.

Templates and generics aren't helpful here.

-- C�dric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-12  1:30                 ` Hyman Rosen
  2003-02-13 20:03                   ` Brian Inglis
@ 2003-02-15 20:14                   ` Cedric LEMAIRE
  1 sibling, 0 replies; 40+ messages in thread
From: Cedric LEMAIRE @ 2003-02-15 20:14 UTC (permalink / raw)


Hyman Rosen <hyrosen@mail.com> wrote in message news:<clcm-20030211-0009@plethora.net>...
> Cedric LEMAIRE wrote:
> > The C++ compiler doesn't give you introspection to implement C++
> > templates that work on the composition of a class.
> 
> Yes, this is true. To get this would require support from the
> compiler, and I imagine would look something like this - the
> result of introspect<T> for some type T would be a class with
> informative members, some of which would be like Alexandrescu's
> type lists that would carry member and base class information
> and could be processed recursively by other templates. We would
> also want an equivalent dynamic interface, so that we could take
> a polymorphic pointer or reference and deal with its introspection
> at runtime.

I did it too with 'CodeWorker' (but it isn't my intellectual property,
i have to change it before publishing the pattern scripts): a dynamic
introspector that handles 'MetaClass' composed of 'MetaAttribute's.
'MetaAttribute' is composed of 'MetaType'... and a lot of interesting
information about reflectivity in fact. A little as in JAVA, but in
C++. It allows writing very efficient dynamic GUI for example (with
smart tool tips that explain the constraints held by the attribute you
are populating - if you starts from an Object Design such as an
extended UML). Interesting when you have a few hundred Business
classes and a dialog window not too stupid to implement for each of
them.

It is very trivial to implement with 'CodeWorker'.

-- C�dric
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

* Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
  2003-02-15 20:14                   ` Cedric LEMAIRE
@ 2003-02-19  6:10                     ` Alan Balmer
  0 siblings, 0 replies; 40+ messages in thread
From: Alan Balmer @ 2003-02-19  6:10 UTC (permalink / raw)


On 15 Feb 2003 20:14:02 GMT, codeworker@free.fr (Cedric LEMAIRE)
wrote:

>Juli�n Albo <JULIANALBO@terra.es> wrote in message news:<clcm-20030211-0011@plethora.net>...
>> Cedric LEMAIRE escribi�:
>> 
>> > > OK, I'll bite ... why do you think C++ templates are too restricted?
>>  
>> > The C++ compiler doesn't give you introspection to implement C++
>> > templates that work on the composition of a class.
>> > How to write with C++ templates an "Object Unmarshaller", for
>> > instance? I mean, something that reads the serialized content of an
>> > object and that builds the corresponding object in memory. Be careful!
>> > No intervention must be done on these objects in C++ to facilitate
>> > their integration into the "unmarshaller".
>> 
>> But here you talk about how are the classes in C++, not the templates.
>
>I talk about how to do such a C++ class with templates if i don't have
>introspection.
>
>-- C�dric
Please stop cross-posting this to comp.lang.c
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net



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

end of thread, other threads:[~2003-02-19  6:10 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-24  3:36 [ANN] an EBNF parser and coding pattern tool (LGPL) Cedric LEMAIRE
2003-01-24 16:40 ` Victor Porton
2003-01-25  0:33   ` llewelly
2003-01-29  2:55   ` Cedric LEMAIRE
2003-01-24 16:40 ` apm
2003-01-29  2:56   ` Cedric LEMAIRE
2003-01-31  2:25     ` Cedric LEMAIRE
2003-01-31  2:25     ` Anthony Williams
2003-02-01  4:10       ` Cedric LEMAIRE
2003-02-04 16:53     ` apm
2003-02-06 20:35       ` Cedric LEMAIRE
2003-02-06 20:36       ` Cedric LEMAIRE
2003-02-01  4:09   ` White Wolf
2003-02-03  1:28     ` Martin Ambuhl
2003-02-03  1:28     ` Hillel Y. Sims
2003-02-03 16:31       ` Tars_Tarkas
2003-02-03  1:29     ` Mark McIntyre
2003-02-03 16:31       ` CBFalconer
2003-02-04 16:53         ` Georg Bauhaus
2003-02-06 20:36           ` Cedric LEMAIRE
2003-02-07 17:33             ` Hyman Rosen
2003-02-08 18:22               ` Thant Tessman
2003-02-07 17:33             ` Anthony Williams
2003-02-11  6:15               ` Cedric LEMAIRE
2003-02-12  1:30                 ` Hyman Rosen
2003-02-13 20:03                   ` Brian Inglis
2003-02-15 20:13                     ` Hyman Rosen
2003-02-15 20:14                   ` Cedric LEMAIRE
2003-02-12  1:30                 ` Julián Albo
2003-02-15 20:14                   ` Cedric LEMAIRE
2003-02-19  6:10                     ` Alan Balmer
2003-02-12  1:30                 ` Stephen Leake
2003-02-12 18:22                   ` Hyman Rosen
2003-02-12 19:39                     ` Stephen Leake
2003-02-12 21:16                       ` Hyman Rosen
2003-02-14 20:34                         ` Stephen Leake
2003-02-15 20:14                   ` Cedric LEMAIRE
2003-02-07 17:33             ` Hyman Rosen
2003-02-03 16:31       ` ozbear
2003-02-03 16:31     ` Cedric LEMAIRE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox