Re: [Oberon] Syntax-directed program editing
-----Original Message----- From: eas lab [mailto:lab.eas@gmail.com] Sent: Sunday, 17 January 2016 4:58 PM To: chris@cfbsoftware.com; ETH Oberon and related systems Subject: Re: [Oberon] CapsLock
What about a syntax-directed editor/system, where you initially see:- Module #ModID; ConstDecls; .... ProcDecls; BEGIN Stmts END.
I have occasionally tried the sorts of systems that use shortcut keys to insert code templates / snippets for different constructs e.g. using Visual Studio's 'IntelliSense > Insert Snippet' feature you can type CTRL-KXF<Enter> and you will get for (int i = 0; i < length; i++) { } You then edit the variables and fill in the blanks. However, I haven't got into the habit of using that. I find it awkward if my flow of typing does not follow my train of thought. Also, the slower I type the more time I spend thinking about what I am typing which is usually not such a bad thing :) My best experience with smart typing was in the 1980s when I was developing Pascal software for a couple of years on an HP64000 Microprocessor Development System. They had a neat system where each function key was mapped to a label just above the key at the bottom of the screen. The labels changed according to the context. However, I can't remember exactly, but I think it was probably used when entering command-lines rather than program text. In the HP64000 documentation (which can be downloaded from bitsavers.org) it is described as follows: "Directed syntax, softkey operation makes the Development Stations friendly. Syntax errors are virtually eliminated as the software-driven softkeys present selections of appropriate commands at each decision point. Commands are entered by a keystroke rather than by typing cryptic code words, letter by letter. New users of the 64000 Logic Development System become proficient quickly, and experienced users work more effectively." Regards, Chris Chris Burrows CFB Software http://www.cfbsoftware.com
I had a great experience writing an OS prototype back in the '80s (in Modula 2, as it happened) using DEC's EVE (extensible Vax Editor, IIRC) with macros which I wrote for each of the statement types. Much code, almost bug-free, leading to a successful (albeit without any follow-on work) demo after about 6 months. On 1/16/16, Chris Burrows <chris@cfbsoftware.com> wrote:
-----Original Message----- From: eas lab [mailto:lab.eas@gmail.com] Sent: Sunday, 17 January 2016 4:58 PM To: chris@cfbsoftware.com; ETH Oberon and related systems Subject: Re: [Oberon] CapsLock
What about a syntax-directed editor/system, where you initially see:- Module #ModID; ConstDecls; .... ProcDecls; BEGIN Stmts END.
I have occasionally tried the sorts of systems that use shortcut keys to insert code templates / snippets for different constructs e.g. using Visual Studio's 'IntelliSense > Insert Snippet' feature you can type CTRL-KXF<Enter> and you will get
for (int i = 0; i < length; i++) {
}
You then edit the variables and fill in the blanks. However, I haven't got into the habit of using that. I find it awkward if my flow of typing does not follow my train of thought. Also, the slower I type the more time I spend thinking about what I am typing which is usually not such a bad thing :)
My best experience with smart typing was in the 1980s when I was developing Pascal software for a couple of years on an HP64000 Microprocessor Development System. They had a neat system where each function key was mapped to a label just above the key at the bottom of the screen. The labels changed according to the context. However, I can't remember exactly, but I think it was probably used when entering command-lines rather than program text. In the HP64000 documentation (which can be downloaded from bitsavers.org) it is described as follows:
"Directed syntax, softkey operation makes the Development Stations friendly. Syntax errors are virtually eliminated as the software-driven softkeys present selections of appropriate commands at each decision point. Commands are entered by a keystroke rather than by typing cryptic code words, letter by letter. New users of the 64000 Logic Development System become proficient quickly, and experienced users work more effectively."
Regards, Chris
Chris Burrows CFB Software http://www.cfbsoftware.com
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
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.
If you need to manually-craft the syntax-editor for each new language, it has little value. It must be able to handle any new language after just being fed the valid syntax data of that language. Perhaps this depends on the <L, ? LR>-ity of the language's grammar? I lack knowledge of the theory of language-classes. --- Looking at Oberon's official syntax, showed me that <StmLst> is at the top and in the middle of the tree <implied by "recursive descent">. Ie: Module = MODULE ident ";" [ImportList] DeclSeq [BEGIN StatementSeq] END ident ".". ProcDecl = PROCEDURE [Receiver] IdentDef [FormalPars] ";" DeclSeq [BEGIN StatementSeq] END ident. ------ My simplistic use of <sed in place> to replace ALL instances of the selected HotNode by it's expansion is bad. Better that HotNodes are expanded individually . And on the DISPLAY [Oberon: TextFrame] and then <Edit.Store>-ed, incrementally. --- Just look at this by wily. With the 12-line <source>Display:---------- (* Delete new nodes not needed *) MODULE ModId; CONST ConstDcl; VAR VarDecl; PROCEDURE ProcId(ArgLst); BEGIN |StmLst2 END ProcId; BEGIN |StmLst2 END ModId. ------------------ If I select the 2nd "|StmLst2" token and midMouse it, the display changes to:- (* Delete new nodes not needed *) MODULE ModId; CONST ConstDcl; VAR VarDecl; PROCEDURE ProcId(ArgLst); BEGIN |StmLst2 END ProcId; BEGIN Asgn V:=X; While Bool Do; IfThenElse; END ModId. wily's script-file named "StmLst2" is the 3 lines:--- echo -n " Asgn V:=X; While Bool Do; IfThenElse;" The auto-indent editor's facility of wily & ETHO should improve the formatting. --- This should be easy to translate/implement in ETHO. NB. KybrdMacros are of little value, without menues. It's not about resting the fingers. It is about amplifying your (eyes, brain, memory)system. == Chris Glur. ! Screw this amerikan gmail system, which like macdonald's foods has the <To:> parameter pre-determined/locked !
Chris Burrows wrote:
-----Original Message----- From: eas lab [mailto:lab.eas@gmail.com] Sent: Sunday, 17 January 2016 4:58 PM To: chris@cfbsoftware.com; ETH Oberon and related systems Subject: Re: [Oberon] CapsLock
What about a syntax-directed editor/system, where you initially see:- Module #ModID; ConstDecls; .... ProcDecls; BEGIN Stmts END.
I have occasionally tried the sorts of systems that use shortcut keys to insert code templates / snippets for different constructs e.g. using Visual Studio's 'IntelliSense > Insert Snippet' feature you can type CTRL-KXF<Enter> and you will get
This is similar to how some FreePascal programmers use CTRL-B and CTRL-E to type out begin and end. The problem with this is the annoying shift key strokes and strains required to hit the ctrl key. Programmers have been hospitalized from using keyboard driven editors like emacs... i.e. it's not a myth but an actual recorded incident that people have literally been hospitalized from shift key strains. PROG MeaningOfLife; PRO SomeCode; B out('hello'); E; FUN Interesting: int; B result := 42; E; B SomeCode; out(' ...The answer to life is ', Interesting); E.
participants (4)
-
Chris Burrows -
eas lab -
Lars O -
Mayson Lancaster