Company News Products Projects Texts Museum Download Contact Map RSS Polski
YAC Software Texts YAC Data Language YAC Data Language Trybiks' Dive
  Back

List

Data

Excel

Media research

Market research

Respondent quotas

SPSS

VBA

YAC Data Language

YAC Data Language
Since I would like to write several texts based on YDL, I guess that the first of these should describe the language itself, at least briefly. So here it goes...

YDL stands for YAC Data Language, although sometimes, instead of Data, other words seem more fitting, such as Definition or Description. I often use them interchangeably... ;-)

YDL is an XML like language where you can define values assigned to keys (like attributes in XML) and group definitions inside larger definitions (like nodes in XML). However, it was designed to omit several problems that I has with XML (mentioned at the bottom of the page).

While introduction of this language is not necessary, it was fun to work on it, especially on:
  • domain specific extensions to the language (like action instructions or preconditions in YIK or value ranges in YDK),
  • see how it works with new applications that were not there yet when "designing" and implementing YDL,
  • work with Delphi's RTTI to automate reading of YDL files and to automate checking of the basic syntax rules in YDL documents (more about this in an upcoming sequel).
File Format

YDL files are standard ASCII text files.

Comments

Comments are taken from C-like languages:
  • single-line comment, starting with // and ending with the end of the line,
  • multiple-line comment: all text between /* . . . */
Multiple-line comments cannot be nested.

Strings

There are two types of strings in YDL:
  • single-line strings, delimited by quotation marks: "This is a single-line string.",
  • multiple-line strings, delimited by guillemets written using < and > characters:
    <<This is a multiple-line string written on a single line.>>
    <<And this is a multiple-line string
      written on two lines.<<
Multi-line strings are allowed only in certain situations, but single-line strings can be written using any of these two notations.

Identifiers

Identifiers start with a letter a..z and may contain letters, the underscore character, digits, and the dot character.

Boolean Values

The digits 0 and 1 are used to represent FALSE and TRUE respectively.

Numbers

Integers are written using decimal digits; floating-point values use the dot character as the fraction delimiter. Floating-point values may be written in scientific notation. All numbers may be preceded by the minus sign or the plus sign.

Definitions

Up till now we were talking about the tokens (or lexemes) of the language - the smallest elements that the parser recognizes (plus comments that the scanner omits). Below, definitions are described that form that semantic elements of YDL documents.

Simple Definitions

A simple definition is a key identifier, followed by the equals sign, followed by a value or a list of values, and ends with a semicolon. For instance:
  language = enu;
  page = 9;
  demo = 1;
  name = "YAC Data Language";
The above were single-value definitions. But we can also have lists of values:
  attr = nocls, noresp, horiz;
  pages = 1, 2, 3, 10;
Complex Definitions

Complex definitions group other definitions (simple and complex). A complex definitions starts with the def reserved word followed by the key identifier. Next come single and complex definitions belonging to this definition. A complex definition ends with the end reserved word followed by a semicolon. For instance:
  def question
    id = color;
    text = <<What color is your favorite?\n
             Please select one of the following responses:>>;
    def response id = blue; text = "Blue"; end;
    def response id = green; text = "Green"; end;
    def response id = other; text = "other (which?)"; attr = alpha; end;
  end;
Note that complex definitions are usually written in a single line (if short, such as responses above), or def and end are placed in the same column, while definitions inside are indented by one or more blanks (so that def and end "see" each other).

And these are almost all the rules that are the basis of YDL documents.

So, why not XML?

Well, I could be accused of the "not invented here" syndrome, but OTOH, designing and implementing your own language (and for it to be as little domain specific as possible) is just fun. Not only working on the language, but also creating libraries for easy handling of documents written in that language... Plus, I really hate XML; and I use the word "hate" only when speaking of two languages: XML and Perl. :-)

But actually, there are several reasons, maybe not blocking the use of XML, but each of which adds a little to the decision to go with a different solution:
  • Writabilty and readability

    Since YDL is intended to be actually written and read by real people, it should have less squiggly characters that hinder readability and slow down writing definitions. OTOH, XML is almost readable using an editor that has syntax highlighting...

  • Extensibility

    And we're not talking about adding tags here, but about new language constructs. For instance, in most applications that I use YDL in, number lists and ranges can be defined, for instance, as follows:
      age = 15 : 75, 99;
      valid.codes = 1 : 5;
      missing.codes = min : 0, 6 : max;
  • Better type control

    Obviously, you can control value types by checking texts entered in strings, but, for instance, syntax highlighting in an editor is so much better if these types are available to the scanner.

  • Ampersand tax

    Man, how I hate writing something in XML! For instance, when writing this article... :-) Since YDL uses LT and GT signs to delimit strings, and then XML is translated into HTML, embedded YDL strings look really awful...

    &amp;lt;&amp;lt;This is a multiple-line string written on a single line.&amp;gt;&amp;gt;

    What is that?!? And XSLT is even worse...
But, all in all, and not trying to convince anyone, the languages are not really THAT different...

Applications

I use YDL in most of my applications, although I must admit that, because of XML ubiquity, files that are produced by programs to be consumed by programs (the same one or other ones) are better handled by XML. OTOH, if a real person wants to look at the code, and (gasp!) write some code, I tend to use YDL. And especially if new language constructs are going to be needed.

So, which applications already use YDL? As you can see, it's pretty popular in my company... ;-)

Top

Comments
Alas!
No comments yet...

Top

Add a comment (fields with an asterisk are required)
Name / nick *
Mail (will remain hidden) *
Your website
Comment (no tags) *
Enter the text displayed below *
 

Top

Tags

YAC Data Language


Related pages

Single- and multi-choice responses (not questions)

Nested randomized blocks

Example of quota checking

Quotas in YAC Interview Kit

Handling missing data in filter expressions

noback vs. noret