Candle Overview
Version |
: Candle 0.10 |
Published date |
: Nov 12, 2011 |
1. The Candle Language
Candle
(Common ApplicatioN Development LanguagE)
is designed to be a
new general-purpose scripting language capable of developing
both
desktop and Internet applications.
Besides the common features found in many scripting languages, like
cross-platform, interpreted execution, auto garbage collection, dynamic
typed, built-in list and map support, Candle also supports some unique
features that are not common in today's general-purpose programming
languages:
- Built-in hierarchical data
processing: hierarchical data
(whether from XML, HTML, XHTML,
JSON, CSV, RDB or MIME Message) can be
as easily constructed, selected (like XPath), queried (like XQuery),
transformed (like XSLT) and serialized as
any primitive data in Candle.
- Set-oriented expressions:
the expressions in Candle can handle not only a single item, but
also a sequence of items - making the language more expressive and
convenient.
- Unified pattern language:
Candle unifies several pattern related DSLs (including RegEx, BNF,
RELAX NG, XQuery Sequence Type) into one consistent pattern language
that can apply to sequence of items, nodes and string characters.
- Unification of functional
and procedural programming:
Some multi-paradigm programming languages, like Python, already have a
mixture of features from both worlds. But by introducing a mechanism, I
called separation-of-side-effects,
Candle unifies two worlds in a more orderly manner. In Candle, routines
are divided into functions and methods. Functions are routines without
side-effects and methods are routines with side-effects. The rule of separation-of-side-effects
is that methods can call functions, but not
vice versa. In this way, pure functional islands are
well-preserved in the vast sea of procedural program.
Currently, the default character encoding (also the only supported
encoding) of Candle is UTF8.
There are two types of documents in Candle - Candle Markup and Candle
Script:
- Candle Markup is for storing
static markup data. It starts with
opening signature
<?cmk1.0?>
.
It is normally stored
with file extension '.cmk
'.
The letters 'cmk
'
stands for Candle
MarKup.
Candle Markup is a strict
subset of Candle script in syntax. And you can use 'text/x-candle
'
as the MIME type for Candle Markup.
- Candle Script is for storing
code. Its opening signature is
<?csp1.0?>
.
It is normally stored with two file extensions '.csp
'
and '.run
'.
The letters 'csp
'
stands for Candle
ScriPt.
The former for general scripts
and the latter for procedural
main
program. And you can use 'application/x-candle
'
as the
MIME type for Candle Script.
In the opening signature, '1.0
'
is the
version of the Candle language. As the language
evolves, more version numbers would be expected to appear in the
opening signature. Only whitespace characters are allowed to precede
the opening signature.
As Candle is closely based on some XML technologies, including XPath,
XSLT and XQuery, it will be easier for you to understand
Candle,
if you
already have knowledge of these languages.
Two blog articles may also help you understand the design rationales
behind Candle: Blog
- Why I Invented Candle (I) and
Blog
- Why I Invented Candle (II).
2. The Candle App Platform
The Candle App Platform is the runtime environment to support the
execution of Candle scripts on various operations systems. It is being
developed in C/C++. Currently, Candle runs on Windows (2000 and
above) and Linux (only tested with Ubuntu, but as Candle has very few
dependencies, it should be easy to port to other
Linux and UNIX distros).
Below is the architecture diagram of Candle App Platform:
Candle Runtime is very lightweight.
With current beta
release, the entire zipped binary package is only 2.1M
on Windows and 1.2M on Linux.
So besides running as standalone application, it can also be used as
embedded scripting language in large applications.
The entire Candle Runtime implementation is open-sourced
at
SourceForge, so there's nothing
that hinders you from porting it,
customizing it and patching it. Workspace files for Microsoft Visual
C++ (Express) and CodeLite are provided.
3. Candle Reference Documents
Here's a quick overview of the list of more detailed reference
documents in Candle:
- Candle Markup
Reference: specifies the
syntax and semantics for Candle markup document;
- Candle Data
Model
Reference: specifies
the type hierarchy and data model in
Candle, which is essential to understanding the semantics of Candle
script;
- Candle Query
Reference: specifies
the scripting features in Candle;
- Candle Pattern
Reference:
is dedicated to the pattern language in Candle, which can be used to
specify patterns on sequence of items, nodes and strings.
- Candle Routine
Reference: documents
the built-in routines in Candle;
- Candle Style
Reference:
documents the style markup elements and attributes in Candle. This
module is still being developed.
- Candle Runtime
Reference:
documents the steps to install Candle, and run it in 3 slightly
different ways, as a command line program, a desktop GUI program and a
web application server.
If you encountered any problem with the program or the documentation,
you
can always email me at henryluo@candlescript.org
.