Mailinglist Archive: yast-devel (85 mails)
| < Previous | Next > |
[yast-devel] Next hackweek project done ... ycp-to-ruby-translator
- From: Klaus Kaempf <kkaempf@xxxxxxx>
- Date: Wed, 18 Jul 2007 12:15:05 +0200
- Message-id: <20070718101505.GA7905@xxxxxxxxxxxxx>
Hi,
Cornelius hackweek proposal of a ycp-to-ruby-translator
(see http://idea.opensuse.org/content/ideas/ycp-to-ruby-translator)
was an itch I had to scratch sooner or later.
So I spent some spare time and did a couple of late night hacks
to make the translator real.
It is based on an XML representation of the abstract syntax
tree produces by the YCP scanner and parser within libycp.
So its a pure syntax translator with only very, very limited
knowledge of the semantics. The resulting Ruby code does pass
the Ruby syntax checker, though.
Combined with Duncans Ruby-YCP bindings, translating ycp to
Ruby should be quite useful as we try to provide support for
more widespread scripting languages.
The translator is available at
http://svn.opensuse.org/svn/yast/trunk/yxmlconv
You need a recent version of yast2-core, which supports
XML output and the '-x' parameter of ycpc.
Then run
ycpc -c -x file.ycp -o file.xml
to convert YCP code to XML.
Now use the xml-ruby translator as
cd yxmlconv
ruby src/converter.rb file.xml > file.rb
Klaus
P.S.: It's fairly straightforward to change the translator to
output e.g. Python or Java or C# or ...
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx
Cornelius hackweek proposal of a ycp-to-ruby-translator
(see http://idea.opensuse.org/content/ideas/ycp-to-ruby-translator)
was an itch I had to scratch sooner or later.
So I spent some spare time and did a couple of late night hacks
to make the translator real.
It is based on an XML representation of the abstract syntax
tree produces by the YCP scanner and parser within libycp.
So its a pure syntax translator with only very, very limited
knowledge of the semantics. The resulting Ruby code does pass
the Ruby syntax checker, though.
Combined with Duncans Ruby-YCP bindings, translating ycp to
Ruby should be quite useful as we try to provide support for
more widespread scripting languages.
The translator is available at
http://svn.opensuse.org/svn/yast/trunk/yxmlconv
You need a recent version of yast2-core, which supports
XML output and the '-x' parameter of ycpc.
Then run
ycpc -c -x file.ycp -o file.xml
to convert YCP code to XML.
Now use the xml-ruby translator as
cd yxmlconv
ruby src/converter.rb file.xml > file.rb
Klaus
P.S.: It's fairly straightforward to change the translator to
output e.g. Python or Java or C# or ...
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx
| < Previous | Next > |