NyktOP Project - Source Languages

During the lifetime of NyktOP, we have now got very different source file formats:


Oldfashioned awk-inputs

(introduced around 1995)

The very first file format was a line-oriented format, that could be very easily be parsed by AWK. there is an exporter-template from .pre (no-underlines) to that file format, since there is still one awk-application to use it: the generator to produce a graphical representation of the class hierarchy.

Below should be an example of a .awkinput file.


First .pre file format

(used 1995 - 1998)

.pre files are the input file format of the template-expander.

The first form was used in connection with most of the the templates, that were created for the C++ generator, used e.g. in RODEO/II or 0stat.

In this form of .pre files, syntactic keywords (class, attribute, connection et c.) have no certain specifica. For this reason they can conflict with the names for types or attributes.

Below is an example of a .pre file

(Btw: I have found an elder document describing input for the old C++ generator, I'm sorry, but its only German)


.pre file format w/ underlined keywords

This is the - in fact never used - successor of the prior form.

It is used with the same template expander; the only difference is, that we have prepended all syntactic keywords with underlines; that way we try to reduce possible conflict with names inside the data.

The bad thing of this modifiction is, that we cannot reuse any of the elder templates for newer .pre files, since syntactic keywords are also used inside the templates. So we would have to convert all elder templates to that newer format (and template-coding is, I must admit, a true pain).

Below is an example of a .pre-ul file

(Unfortunately a simple incompability in our parser forces us to repeat the type definitions in subslots.)


New .input file format

(1999 - today)

In the recent past we have started writing our generators as perl modules; this has the advantages, that the painful template-coding can be stopped. (Hmmm, I could try to build a syntax-highlighting modue for nedit, that comes around with .tplt - perhaps that way I can read those things better then)

Since there is currently no perl-parser for .pre files, the perl based generator currently uses a very reduced file format: .input files these are in fact just simple perl files consisting of commands to build up a class hierarchy.

Below is an example of a .input file (The similarity to .awkinput files is astonishing ;))


Notes

The fragments above do not show the complete language of the differet file formats; they are meant just as very simple examples.

Each one has certain characteristica, some better, some worse. As long, (or: as soon) as there are exporters from one format to the other, every user can select his preferred notation.


.slang file format of editors

(1999 - today)

This file format is quite different from the generator input file formats. It is the common file format file format of all nyktop-generated applications. (i.e. a std slang-io-component is part of the support libraries)

Thus this file format is the native file format of the nyktop-based Nykditor, and so all models drawn with Nykditor's 'MiniMoose' configuration are stored in this file format.

There is a converter in the perlbased generators Archive to convert a slang based model into .input format. However with the supported installation scripts, the neccessary perl model directory for MiniMoose is currently not yet generated. (Something like $NYKTOP_GEN/generator.pl inputs/editor.input inputs/minimoose.input -l perl would do the thing, but since the inputs files are part of Nykditor archive while the perl generator is part of the perlbased generator archive, this action cannot be performed with any single of the archives alone.)

Please note, that there is another, very similar .slang file format: the files of the original MOOSE Editor. While there is a converter of those files to .pre there is no direct converter into .input

An model similar to the .input example above can be found in fb.slang; it's graphical representation in NyktOP's MiniMoose editor looks like shown in fb.gif.


Elements

The following main elements are most often used parts of the different input languages:

schema
(only in .pre; implicite in other generators) used as a form of directories to give a better overview of the different classes. Has its roots in Smalltalk categories. Used in C++ generator to make smaller source dirs.(In MOOSE they can be connected and thus U can decide) to generate certain components)
basetype / simpletype
(not in awkinput) Used to define another type for non-structured attributes. Basetypes should be builtin to the generators (Boolean, String), Simpletypes user defined.
enumerator
(not in awkinput) Used to define an enumeration type (relevant mainly for C++, but very usable also in TCL)
foreignclass
(only in .pre) Used to define a class, that must not be generated - e.g. from an external class library used as a type for attributes.
record
(only in .pre) very similar to class, but can't define connections; used as a type for structured attributes.
array / dynarray
(only in .pre) very similar to record, except that it contains an additional array functionality: U can access an indexed value.
class
the most relevant structure for the generators. Thus we show a list of its most common subcomponents:
parent / parents
name(s) of the supertype(s) (multiple only in .pre-ul)
schema
name of the schema, this class resides in.
attribute
(slottype) define an attribute.
reference
(slottype) define an single-sided reference (no support on target side needed).
connection
(slottype) define an double-sided connection (the partner/target-object needs to support a responding slot).
method
(slottype, only in .pre) define a new method in the class (used only for the C++ generator).
module
(only in .pre) define a module; may e.g. be used to include components, that do not fit into NyktOP class hierarchies, like old (ansi) C libraries.