During the lifetime of NyktOP, we have now got very different source file formats:
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.
CLASSERVERSION 3
CLASS FooBar
SCHEMA fb
ATTRIBUTE name String
CLASS Foo
# since this class occurs inside the class FooBar,
# it is automatically defined as its subclass.
# in CLASSERVERSION 2 we would have to omit the
# END directives and instead use the PARENT
# or SUPER directive, which are synonym.
# PARENT FooBar
SCHEMA fb
ATTRIBUTE any String
CONNECTION bar Bar barOf single
END
END
CLASS Bar
SUPER FooBar
SCHEMA fb
ATTRIBUTE thing String
CONNECTION barOf Foor bar multiple
END
.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
(the old generator only reads the conents of certain #ifdef-blocks
to support .pre source be embedded in C/C++ sources.)
#ifdef CLASSER
// comments inside the parsed blocks are C++-style
class FooBar = {
schema = fb;
attribute name = { _type = String; };
};
class Foo = {
schema = fb;
parent = FooBar;
attribute any = { type = String; };
connection bar = { partner = Foo; partnername = barOf; single; };
// attribute names like schema, attribute, connection etc.
// would cause havoc
};
class Bar = {
schema = fb;
parent = FooBar;
attribute thing = { type = String; };
connection barOf = { partner = Foo; partnername = bar; multiple; };
};
#endif
(Btw: I have found an elder document describing input for the old C++ generator, I'm sorry, but its only German)
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
#ifdef CLASSER
_class FooBar = {
_schema = fb;
_slots = { __types = { _attribute; _reference; _connection; };
_attribute name = { _type = String; };
};
};
_class Foo = {
_schema = fb;
_parents = { FooBar; };
_slots = { __types = { _attribute; _reference; _connection; };
_attribute any = { _type = String; };
_connection bar = { _target = Foo; _partnername = barOf; _single; };
// attribute names must not be of
// _attribute,_connection,_reference
};
};
_class Bar = {
_schema = fb;
_parents = { FooBar; };
_slots = { __types = { _attribute; _reference; _connection; };
_attribute thing = { _type = String; };
_connection barOf = { _target = Foo; _partnername = bar; _multiple; };
};
};
#endif
(Unfortunately a simple incompability in our parser forces us to repeat the type definitions in subslots.)
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 ;))
# just a mere perl file
class( FooBar );
schema( fb );
attribute( name, String );
class( Foo );
schema( fb );
parent( FooBar );
attribute( any, String );
connection( bar, Bar, barOf, single );
class( Bar );
schema( fb );
parent( FooBar );
attribute( 'thing', 'Integer' );
connection('barOf', 'Foo', 'bar', 'multiple' );
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.
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.
The following main elements are most often used parts of the different input languages: