[Oberon] SyntaxConstrainedEditor: howto

Patrick.Hunziker at unibas.ch Patrick.Hunziker at unibas.ch
Mon Mar 7 19:59:23 CET 2005


MODULE SyntaxConstrainedEditor;

PROCEDURE Initialize;
BEGIN
  FeedCOCOPackageWith(ActiveOberonGrammar);
    (*COCO takes a grammar and builds a parser*);
  AddActivityToCOCO(ForEachLeafDefineTextpopupsWithAllowedKeywords);
END Initialize;

PROCEDURE NewModule;
BEGIN
  NEW(TextWindow);
  WHILE ~finished DO
    ModifyTextPopupsWithCOCOsPossibleKeywords;
    AcceptInputFromKeyboardOrFromTextpopup;
    (*ev. use Coco to add syntax/error color here (extra goodie)*)
  END;
END NewModule;

BEGIN
  Initialize;
END SyntaxConstrainedEditor.

Coco is a compiler compiler (is in the release or in the contributions) that
takes a formal grammer to build a parser & a backend for this grammar.
A language definition similar to EBNF is needed (is in the Oberon Report).
Worked out examples for using Oberon like grammars in Coco are in the package.
This will probably cost you a day (if I had one, I would do it...),
but I believe this "sugar for programmers" could ease the learning curve for
Oberon novices significantly.

Greetings to all
Patrick

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the Oberon mailing list