Skip to main content

A Portable Module Programming Language

Project description

C’Dent - A Portable Module Programming Language

C’Dent is a programming language that:

  1. Is primarily intended to write portable OO modules. C’Dent modules are written once, and then compiled to equivalent port modules in any number of supported programming languages.

  2. Has multiple input syntaxes. Including defined subsets of: - Perl and Perl 6 - Python and Python 3000 - Ruby - JavaScript - Java

  3. Compiles to a Common’DENominaTor tree form known as C’Dent. C’Dent is an OO model that has the notions of modules, classes, methods, and expressions.

  4. Emits C’Dent trees to several existing programming languages, including: - C’Dent - the compiled tree form serialized as YAML or XML - Perl and Perl 6 - Python and Python 3000 - Ruby - JavaScript - PHP - Java - Scala - C and C++ - CIL (.NET Common Intermediate Language) - PIR (Parrot Intermediate Runtime)

  5. Uses static implicit typing to assign types to all objects at compile time, and throw syntax errors for type conflicts. Strong typing is required to generate equivalent code in the various emitted port languages.

INSTALLATION

Currently the best way to install C’Dent is to get the source code and install it like so:

> git clone git://github.com/ingydotnet/cdent.git
> cd cdent
> sudo setup.py install

USAGE

After you install C’Dent, you will have a cdent compiler in your Unix path. Try running this command:

cdent --help

You’ll need a program written in C’Dent. There are some in your C’Dent repository clone. One example is tests/modules/world.cd.py which looks like this:

"""\
This is World class :)
"""

class World():
    def greet(self):
        print "Hello, world"

You can compile to Ruby with this command:

cdent --compile --in=tests/modules/world.cd.py --to=rb

Which produces:

# *** DO NOT EDIT ***  This is a C'Dent generated Ruby module.
###
# This is World class :)
###

class World
    def greet
        puts("Hello, world")
    end
end

You can compile it to many other languages by changing the value of –to=.

DEVELOPMENT STATUS

C’Dent can currently parse modules with a simplistic grammar of Module/Classes/Methods/Print/Comments to an AST form and generate equivalent output modules in many languages:

C’Dent can currently parse:

  • Python

  • JavaScript

  • Perl 6

  • C’Dent/YAML (a C’Dent AST in YAML form)

C’Dent can currently produce:

  • Perl

  • Perl 6

  • Python

  • Python 3

  • PHP

  • Ruby

  • Java

  • JavaScript

  • C’Dent/YAML

Next Steps:

  • Add variables and assignments

  • Add type detection

  • Add Ruby and Perl as input

  • Add Scala and C++ as output

  • Lots of other stuff

COMMUNITY

Join #cdent on irc.freenode.net.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdent-0.5.5.tar.gz (21.5 kB view details)

Uploaded Source

File details

Details for the file cdent-0.5.5.tar.gz.

File metadata

  • Download URL: cdent-0.5.5.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cdent-0.5.5.tar.gz
Algorithm Hash digest
SHA256 c2a38534dfd904511877fd0bec79546977d1c29e3a21ca9d5b88439773d8f47c
MD5 e3f8f7b5396840dce67cc0e3dc80cf83
BLAKE2b-256 9313a7aff6eda0af4778e01cbbb310ce17d250ac08d66c326a1fc0d12acaa982

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page