ITWissen.info - Tech know how online

CDuce

CDuce is a functional programming language that builds on the XDuce language. CDuce is an application-specific language for processing XML documents and can be classified on the same level as XQuery, XLST or YATL. XML types have a central position within CDuce. Furthermore, higher- order functions, pattern matching and an extensive type system are among the features of CDuce. While XDuce can only be used in connection with XML documents, CDuce on the other hand is a language designed for universal use, which supports not only the transformation of XML documents. For this purpose, static typing and supplementary language elements have been integrated into CDuce. In addition, CDuce is significantly more performant than comparable languages for the manipulation of XML documents, based on benchmarks performed by the developers.

The development of CDuce is based on the work of the Centre National de la Recherche Scientifique (CNRS) and the Institut National de Recherche en Informatique et en Automatique (INRIA) in France, which will continue. CDuce supports the basic standards like Unicode, XML, Document Type Definition( DTD) as well as namespaces but XML Schema only limited.

Already the motivation of XDuce was to support the dynamic validation of XML documents. A new approach was introduced with static type validation and validation during compile-time. Static type validation" means that invalid data types - i.e. data types that do not correspond to the respective document type - are recognized and rejected when they are read in with the help of CDuce. Thus, it is also not possible to generate invalid XML documents, since their processing has already been aborted beforehand. The syntax of CDuce is similar to that of XML and therefore requires a corresponding orientation effort before use.

The processing of XML data in CDuce

The functions and variables defined for processing XML data in CDuce are statically typed. Due to this static typing, the data types and also the structure of the XML document are known during execution - the "compile time" - so that efficient handling and processing of the data is also possible. In this regard, CDuce's type system builds on the definition of types as sets of values, whose formal structure is similar to that of the definition of types in DTDs. Specifically, CDuce declares four types of scalar data types with Large Integers, Characters, Floats, and atomic types. Thus, in CDuce, all XML data belongs to its own data type. This concept is also offered by the not so well known language XMLambda. Other programming languages in this environment map XML data predominantly to non-XML types.

In the following the further characteristics are summarized by the language CDuce:

  • XML objects are like full-fledged language objects (also called first- class-citizen), processed for example elements, sequences, tags, characters and strings, and sets of attributes. Certain sequences of these XML elements can be specified as regular expressions, which also apply to character strings.
  • Functions are so-called "first-class-values" that can be processed, stored in data structures or returned by a function.
  • Pattern matching allows complex extractions from sequences of XML elements.
  • Polymorphism through subtyping and overloaded functions.
  • A type algebra supports recursive types as well as Boolean operations for declaring data structures.
  • Higher order functions, where a second function can be defined as the result or parameter of a function.

Based on benchmarking based on the XLST processor xsltproc designed in the C programming language, CDuce is said to be more performant than XSLT in comparison. This is remarkable because XLST is an untyped language for the transformation of XML documents and CDuce, on the other hand, initially implements its own and costly type checking in the same application. The possible application areas of CDuce are the linking of XML programs in the form of CDuce adapterscripts, applications on the Web and in connection with Web services.

Informations:
Englisch: CDuce
Updated at: 09.11.2013
#Words: 634
Links: functional programming, application (app), level, order, system
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024