Re: counted characters in strings

Martin Ward <martin@gkc.org.uk>
Sat, 11 Jun 2022 10:52:08 +0100

          From comp.compilers

Related articles
[2 earlier articles]
Re: State-of-the-art algorithms for lexical analysis? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2022-06-06)
State-of-the-art algorithms for lexical analysis? christopher.f.clark@compiler-resources.com (Christopher F Clark) (2022-06-06)
Re: State-of-the-art algorithms for lexical analysis? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2022-06-07)
Re: State-of-the-art algorithms for lexical analysis? christopher.f.clark@compiler-resources.com (Christopher F Clark) (2022-06-07)
Re: State-of-the-art algorithms for lexical analysis? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2022-06-08)
Re: counted characters in strings robin51@dodo.com.au (Robin Vowels) (2022-06-10)
Re: counted characters in strings martin@gkc.org.uk (Martin Ward) (2022-06-11)
Re: counted characters in strings drb@msu.edu (2022-06-11)
| List of all articles for this month |
From: Martin Ward <martin@gkc.org.uk>
Newsgroups: comp.compilers
Date: Sat, 11 Jun 2022 10:52:08 +0100
Organization: Compilers Central
References: 22-06-006 22-06-007 22-06-008 22-06-013 22-06-015 22-06-019 22-06-021 22-06-025 22-06-029
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="43659"; mail-complaints-to="abuse@iecc.com"
Keywords: lex, history
Posted-Date: 11 Jun 2022 09:58:50 EDT
In-Reply-To: 22-06-029
Content-Language: en-GB

On 10/06/2022 03:21, Robin Vowels wrote:
> Nevertheless, counting the number of characters was a constant source
> of error. It was easy enough to include the letter 'H' in the
> character count, sp that the following character became gobbled up in
> the Hollerith constant, and resulting in weird error messages. When a
> Hollerith constant was long enough to require a continuation card, it
> was even easier to lose count; the continuation character in column
> 6 sometimes being included. And when the Hollerith constant required
> 133 characters, how many coud reliably count all of them?


The point about coding forms was that each column of characters
was numbered, so you just had to take the first column and the last
and compute last - first + 1 to get the number of characters
in the string. You don't have to count each one individually.
If there is a continuation then you just compute last + 66 - first + 1
For 133 characters, there would be two continuation cards
and the last column would be the same as the first:
so quite easy to count reliably in fact!


Back in the days before pocket calculators, many people could
do simple arithmetic sums in their heads! :-)


--
Martin


Dr Martin Ward | Email: martin@gkc.org.uk | http://www.gkc.org.uk
G.K.Chesterton site: http://www.gkc.org.uk/gkc | Erdos number: 4


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.