lotus



previous page: F07) Why doesn't the compiler complain about a missing inner in a body fragment?
  
page up: BETA Programming Language FAQ
  
next page: X01) Why does my label widget sometimes get the attribute name as label-string, and sometimes not?

F08) Can <> be used instead of <>?




Description

This article is from the FAQ, by with numerous contributions by others.

F08) Can <> be used instead of <>?

The fragment system has a pragmatic treatment of the syntactic categories
<<AttributeDecl>> and <<Attributes>>. In general one may want to leave slots
in a delaration list for inserting declarations as in:

   (# a: @integer;
      <<SLOT lib1: attributes>>;
      b: ^ text;
      <<SLOT lib2: attributes>>;
      c: (# ... #)
   #)

It is, however, not possible to generate the above form from the BETA
grammar, since the nonterminal <attributes> cannot generate itself. It is
possible to make a grammar that can do this, but such a grammar is very
likely to be ambiguous. The following fragment can, however, be generated
from the grammar:

   (# a: @integer;
      <<SLOT lib1: attributeDecl>>;
      b: ^ text;
      <<SLOT lib2: attributeDecl>>;
      c: (# ... #)
   #)

This will, however, only allow one fragment-form to be inserted in a each
library slot. To handle this, the fragment system allows a fragment form of
category <attributes> to be inserted for an <attributeDecl>. This aliasing
between <attributeDecl> and <attributes> is handled by the alias mechanism
for the BOBS parser used by the meta programming system. See
$(BETALIB)/bobs/vx.y/bobs.bet, nontAlias. The alias mechanism also makes it
possible to use <descriptor> as a shorthand for <objectDescriptor>. The use
of syntac alias's is pragmatic and does not strictly follow the principles
of the fragment system, but it is considered a minor but practical
mechanism.


 

Continue to:















TOP
previous page: F07) Why doesn't the compiler complain about a missing inner in a body fragment?
  
page up: BETA Programming Language FAQ
  
next page: X01) Why does my label widget sometimes get the attribute name as label-string, and sometimes not?