comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Eachus <rieachus@comcast.net>
Subject: Re: stopping a loop iteration without exiting it
Date: Mon, 22 Jan 2018 19:49:43 -0800 (PST)
Date: 2018-01-22T19:49:43-08:00	[thread overview]
Message-ID: <f93898d8-fcde-4f65-8ac6-74e81c5c80f5@googlegroups.com> (raw)
In-Reply-To: <bc57c2d8-ed05-4e8b-b7db-440984976364@googlegroups.com>

I probably shouldn't wake up this topic, and that is not my intent.  Just to bring up some history.  When the original ANSI standarization was going on, Pat Prange and I were supporting/maintaining a program called LALR on Multics. LALR would generate LALR(k)--look ahead left-to-right with k symbol lookahead--grammars.  It would generate a (very compact) set of tables, and (from source with embedded CFG (context free grammar) productions which defined the LALR(k) grammar.  We used it for a compiler that started out as GREEN, and evolved into a subset of Ada. (No tasking, and restrictions on generics.)

Robert Dewar preferred LL(1) grammars for Ada compilers since they allowed for better syntax error recovery.   LALR had a neat recovery method which required some fairly tiny tables (less than a hundred 32 or 36 bit words long).  The tables were generated along with the rest of the grammar tables, and were used for several Multics compilers, including the PL/I compiler and MRDS the Multics relational database. Anyway...

If you are going to use a program that needs to generate code containing and using finite state machine (FSM)* tables, you need to have gotos.  So they are necessary in Ada. Neither Robert Dewar or I ever found a use other than implementing FSMs and PDAs that required gotos--all the logic constructs argued above, whether simple or complex, can be turned into FSMs and implemented by a FSM tool.  Not that I recommend it for the simple cases.  For a lexical scanner?  Your choice. For complex flight control software?  The time spent by the avionics designers working over those tables will make the coding effort seem trivial.

* Technically, a parser generator tool generates a pushdown automaton PDA).  This is an FSM with a stack, and certain inputs cause pushing the current state on the stack, or processing the current CFG production then popping the stack. Pushdown automata can recognize any deterministic language with a context free grammar, but most tools are restricted to produce smaller and faster compilers.  (Doesn't cause any grief for language designers.  As long as the language is deterministic (not ambiguous) you can choose your tool.  Early's Algorithm will parse any CFG, but it sometimes takes time O(n^3) where n is the length of the input.  Most good grammars result in parsers which run in O(n log2 n) time or some such.  LL(1) grammars are also known as recursive descent grammars.  Most compiler programmers don't think about what they are writing as a PDA.

Oh, and regular expressions (RE), which are often used to describe the lexical symbols can be parsed without a stack--and again specialized tools make things much faster.



      parent reply	other threads:[~2018-01-23  3:49 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 16:54 stopping a loop iteration without exiting it Mehdi Saada
2018-01-03 17:23 ` Lucretia
2018-01-03 21:19   ` Randy Brukardt
2018-01-03 23:17     ` Robert A Duff
2018-01-04  8:47       ` Niklas Holsti
2018-01-05  1:31         ` Randy Brukardt
2018-01-04 10:08       ` Jeffrey R. Carter
2018-01-04 11:02         ` Dmitry A. Kazakov
2018-01-04 19:46           ` Robert A Duff
2018-01-04 20:47             ` Mehdi Saada
2018-01-04 21:17             ` Dmitry A. Kazakov
2018-01-04 23:08               ` Niklas Holsti
2018-01-05  8:38                 ` Dmitry A. Kazakov
2018-01-06 16:50                   ` Niklas Holsti
2018-01-06 17:20                     ` Dmitry A. Kazakov
2018-01-07 11:36                       ` Niklas Holsti
2018-01-07 12:05                         ` Dmitry A. Kazakov
2018-01-07 21:22                           ` Niklas Holsti
2018-01-08  8:35                             ` Dmitry A. Kazakov
2018-01-08 20:57                       ` Randy Brukardt
2018-01-08 21:19                         ` Dmitry A. Kazakov
2018-01-08 21:48                           ` Submitting requests to the ARG, was: " Simon Clubley
2018-01-09  9:45                             ` Dmitry A. Kazakov
2018-01-08 22:35                         ` Jeffrey R. Carter
2018-01-05 16:34               ` Robert A Duff
2018-01-05 19:09                 ` G. B.
2018-01-07 11:52               ` Niklas Holsti
2018-01-07 12:27                 ` Dmitry A. Kazakov
2018-01-06  0:53           ` Keith Thompson
2018-01-06  8:36             ` Dmitry A. Kazakov
2018-01-06  8:49               ` gautier_niouzes
2018-01-06  9:26                 ` Dmitry A. Kazakov
2018-01-08 11:05                 ` mockturtle
2018-01-09 11:05               ` AdaMagica
2018-01-09 11:26                 ` Dmitry A. Kazakov
2018-01-09 12:50                   ` Simon Wright
2018-01-09 13:07                     ` Dmitry A. Kazakov
2018-01-09 13:47                       ` Dennis Lee Bieber
2018-01-09 14:53                         ` Dmitry A. Kazakov
2018-01-09 20:07                           ` G. B.
2018-01-10  8:13                             ` Dmitry A. Kazakov
2018-01-10 21:14                               ` G. B.
2018-01-11 12:48                                 ` AdaMagica
2018-01-11 20:54                                   ` G. B.
2018-01-11 13:06                                 ` Dmitry A. Kazakov
2018-01-11 17:11                                   ` Simon Wright
2018-01-11 17:30                                     ` Dmitry A. Kazakov
2018-01-11 18:09                                       ` Simon Wright
2018-01-11 20:54                                   ` G. B.
2018-01-12  8:20                                     ` Dmitry A. Kazakov
2018-01-12  9:22                                       ` G. B.
2018-01-12  9:42                                         ` Dmitry A. Kazakov
2018-01-10 10:52                       ` AdaMagica
2018-01-10 11:14                         ` Dmitry A. Kazakov
2018-01-10 11:21                           ` AdaMagica
2018-01-10 13:47                             ` Dmitry A. Kazakov
2018-01-04 21:52         ` Mart van de Wege
2018-01-05 13:17           ` Jeffrey R. Carter
2018-01-05 14:35             ` Mart van de Wege
2018-01-05 15:21               ` Jeffrey R. Carter
2018-01-05 19:13                 ` Paul Rubin
2018-01-05 23:50                   ` Randy Brukardt
2018-01-06  1:19                   ` G. B.
2018-01-06  9:59                   ` Jeffrey R. Carter
2018-01-05  1:17         ` Randy Brukardt
2018-01-05 14:05           ` Jeffrey R. Carter
2018-01-05 23:58             ` Randy Brukardt
2018-01-04 12:43     ` gautier_niouzes
2018-01-03 17:28 ` Jeffrey R. Carter
2018-01-03 18:27 ` Mehdi Saada
2018-01-06  0:26 ` Matt Borchers
2018-01-06 22:04   ` J-P. Rosen
2018-01-07  2:05     ` Matt Borchers
2018-01-08 20:49   ` Randy Brukardt
2018-01-07 11:33 ` Mehdi Saada
2018-01-07 11:45   ` Simon Wright
2018-01-08  0:58   ` Matt Borchers
2018-01-07 17:47 ` Micah Waddoups
2018-01-07 21:04   ` Simon Wright
2018-01-23  3:49 ` Robert Eachus [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox