[Oberon] Syntax-directed program editing

eas lab lab.eas at gmail.com
Sun Jan 17 19:26:35 CET 2016


If you repeat the same old jobs, you learn the actions by reflex.
If I want to experiment with new ideas, I need a record-trail, to not lose
memory of the path through the forest, to be able to advance at the next
session.

ETHO's live text frames give us a live-work-bench & a Log/memory.
IMO the key elements of the visual-device/menu are:
1 = see and recognise, eliminates the need to remember;
2 = easy/quick selection of the recognised element = mouse.

Often it's more economical to spend resources on a vehicle than on
the direct/single journey, if the vehicle/subroutine can be used for
other journeys/tasks.

Instead of familiarising/refreshing yourself with other languages,
building a general purpose syntax-editor may be more economical.
Then you can hear what a piano or trumpet feels and sounds like,
without spending time building fluency with each instrument.

When I get back to experimenting with Haskel ...etc, I don't want
to be a 'manual-worker' concerned with the trivialities of syntax
details. I want to 'direct' from a higher level.

Perhaps the syntax editor will provide me a easy vehicle, instead
of a painfull climb up the mountain.

Let's use successive refinement, to show what wily does NOW, to
extrapolate how easy it will be to translate it to ETHO.

Part way in the journey, I've got this 12-line file called SIP :---
(* Delete new nodes not needed *)
MODULE ModId;
CONST ConstDcl;
VAR VarDecl;

PROCEDURE ProcId(ArgLst);
  BEGIN StmLst
  END ProcId;

BEGIN
 StmLst
END ModId.
--------------------
At this stage the 2 tokens "StmLst" would be Hi-Lit in ETHO, being
new-nodes created from the previous expansion.

In wily, when I mid-mouse on either, I see:--
(* Delete new nodes not needed *)
MODULE ModId;
CONST ConstDcl;
VAR VarDecl;

PROCEDURE ProcId(ArgLst);
  BEGIN
 Asgn V:=X;
 While Bool Do;
 IfThenElse
  END ProcId;

BEGIN

 Asgn V:=X;
 While Bool Do;
 IfThenElse
END ModId.
--------------------------
These 17 lines are created by the 3 line script named StmLst:--
sed -i 's/StmLst/\n Asgn V:=X;\n While Bool Do;\n IfThenElse/'  SIP
cp SIP SIP2
cat SIP2
-----
This script, which is run when any StmLst is mid-moused does,
in <Algol> terminology: Replace(SIP: File, StmLst: String,
 Asgn V:=X;
 While Bool Do;
 IfThenElse: String);
----
System.CopyFiles SIP => SIP2
<PrintFile SIP2>
------------
If you wrote this in ETHO, you'd want the DISPLAY of SIP
to be updated by the expansions of the 2 tokens: StmLst .

So far, I've got a problem doing that with wily.
The FILE:SIP is updated. So I just copy that to SIP2,
for the next-round of expansions, and dispaly SIP2.

If I <Edit.Store> SIP I restore the original/previous SIP file.
-------------
A simplistic translation to ETHO could perhaps be:
x.StmLst  does:
 In the TextFrame which received the Mid-Mouse: replace "x.StmLst" by
 "Asgn V:=X;
  While Bool Do;
  IfThenElse"

Can someone test that?

Why did I get an extra <newLine> after the <main block> "BEGIN"?

== Chris Glur.


More information about the Oberon mailing list