[CMake] CMake and Lua

Brandon Van Every bvanevery at gmail.com
Thu Feb 28 21:06:39 EST 2008


On Thu, Feb 28, 2008 at 5:54 PM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> Brandon Van Every wrote:
>
>  >
>  >>  Just suppose I am correct and it is
>  >>  not possible to write a good enough translator.  Would you then still
>  >>  advocate dropping the cmake language?
>  >
>  > Of course not.  That's why I said the translator would have to prove
>  > itself for 2 years.
>
>  So, I guess I will wait until then, and you can prove me wrong...  Until
>  then, can you give it a break?

Sure.  Long as you realize that not everybody shares your pessimism
about translators, and that if you do implement Lua support, people
will attempt it.

>  Actually I pointed out that you did metaprogram in CMake (in a sarcastic
>  way).

Actually, if metaprogramming means generating CMake script dynamically
and then executing it, I didn't do that.  I just used CMake script as
the implementation language for my translator.  It could be translated
to Lua no problemo.  It would still only be an Autoconf + GMake -->
CMake translator.

> I just don't have the time to think about it.

I've had 6 months of active work to think about it.

>  Here is one case you have not considered.  There exist some IDE projects
>  that generate CMake code like KDevelop.  The translator would not help
>  them at all as the CMake code is embedded in C++ or java.   There exist
>  cmake code generators.  I guess you would say generate, then translate?
>   Sounds like a mess.

If CMake went to Lua, presumably these IDEs would want to do the same
things in Lua.  If not, if the IDE developers don't have energy to
bother, then that's an example of 2 languages splitting the community.
 That's why I think it's important to establish Lua as the primary
language, if it is to be done at all.  Automatic translation is
essential to making Lua primary, otherwise people simply won't do it.

> >>  You are not willing to accept that I have a different point of view.  A
>  >>  good enough translator is not possible.
>  >
>  > You have provided no firm evidence for your point of view, so I will
>  > continue to challenge it.
>
>  You have provided no evidence that such a thing is possible.   Other
>  than you claim that it will be simple.

I've written 1/2 of a translator for a much harder problem.  There's
no conceptual barrier to completing the work, it's only a matter of
people's will.  Mozilla was just too big a guinea pig for me to finish
within the bounds of the contract.  No I haven't provided strict
evidence of CMake --> Lua translatability, but I've proven the
viability of large scale translation in general, even using extremely
crude methods.  The primary barriers I see to actually realizing a
translator are (1) what technical basis should it have?  regexes are
not ideal.  Some in the Lua crowd talk about Lua PEGs.  (2) Show me
the money.  It's a lot of work to provide a 100% translator.

>  I have never seen a perfect
>  translation from one language to another.  Can you give me an example of
>  one that exists?

I will put it on the backburner as something to inquire about.

>  BTW, You have no idea if you were 1/2 there or not,
>  because you quit.

I did not quit.  Rather, the contract terminated.  I have a pretty
solid idea of how much more work needed to be done.

> You might only be 10% of the way there.  The last 10%
>  often takes 90% of the time with software projects.  Unless you finish
>  the mozilla translator and build mozilla we will never know.

CMake script --> Lua is merely a mapping of syntax.  Nothing more.
When the contract ended, I had a 95% translation of Mozilla's huge
monolithic configure.in to CMakeLists.txt syntax.  Semantics are
another matter.  In the case of Mozilla, a lot more semantic work
remained to be done.  Autoconf + GMake do not have exactly the same
semantic model as CMake.  So yes, I cannot be certain how much longer
the Mozilla translation really would have taken, but conservatively I
estimated I was 1/2 there.  I actually believe I was 2/3 there, but as
you say, unless someone else picks up the work or decides to pay me to
continue, we'll never know.  This is irrelevant to the simple problem
of translating CMake script syntax to Lua syntax.

I don't think you can show me any irreconcilable semantic difference
between CMake script and Lua.  Given that, in principle, perfect
translation is possible.  In practice, someone has to do it and it's a
lot of work.


Cheers,
Brandon Van Every


More information about the CMake mailing list