July 17th, 2024

Railroading the Pascal Language

The text delves into Pascal language's lexical structure and programming elements, emphasizing Free Pascal. It explains symbols, operators, literals, constants, program structures, declarations, control structures, functions, procedures, generics, expressions, identifiers, data types. Comprehensive guide for developers.

Read original articleLink Icon
Railroading the Pascal Language

The text discusses the lexical structure and programming elements of the Pascal language, focusing on Free Pascal. It covers topics such as symbols, operators, literals, constants, program and unit structures, declarations, implementations, and control structures like if statements, loops, and assignments. The document details the syntax and rules for various elements like functions, procedures, generics, and expressions. It also explains the use of identifiers, constants, and data types within the language. The information provided serves as a comprehensive guide for developers working with Pascal, offering insights into the language's structure and functionality.

Link Icon 11 comments
By @leejoramo - 9 months
I immediately remember the Apple Pascal poster from the late 1970s:

https://archive.org/details/pascal-poster-v-3-a-1

By @moefh - 9 months
The use of "mantissa"[1] in this document is not right. What's being called mantissa here should be "exponent".

There's some ambiguity about what exactly "mantissa" means in the representation of a floating point number, to the point where some people recommend avoiding it[2] (for example, the IEEE standard for floating point uses "significand" instead).

But whatever mantissa means, it's exactly not (like the page says[1]) what's "used to raise or lower a floating point literal numbers by factors of 10", that's the exponent. The mantissa, if anything, is the other part of the number, that is, what's being multiplied by the factors of 10 (but it's complicated, the wikipedia[2] page explains it).

[1] https://www.getlazarus.org/learn/language/lexical/#float_lit...

[2] https://en.wikipedia.org/wiki/Significand (section "Floating-point mantissa")

By @01HNNWZ0MV43FF - 9 months
Railroad syntax diagrams, not railroad error handling
By @nu11ptr - 9 months
I love railroad syntax diagrams. Not sure why, but I guess it is because they work in my brain. Grammars just seem to be shown in a way that makes it easier for my visual brain to comprehend.
By @mark_l_watson - 9 months
Memory lane. This made me remember Ken Bowles, one of the key figures in development of UCSD Pascal. Ken always seemed to be on a mission. Last time I talked with him, many decades ago, we were at a party and he and his wife were headed off somewhere exotic to go SCUBA diving.

I used UCSD Pascal on one very large project: my Go playing program Honnibo Warrior.

By @LeFantome - 9 months
I had to read through this more than once to realize that Free Pascal has classes.

They are buried under “Generic Constaints”.

https://www.getlazarus.org/learn/language/lexical/#generic_c...

For me, a BNF would be so much easier. It looks like a fairly easy syntax to parse.

Maybe I will try to create a toy compiler sometime.

By @katzenversteher - 9 months
I like. Quite a bit easier to read than EBNF and the like
By @mosburger - 9 months
Brings me back to a time early in my career where I had to write Cognos QTP, QUIZ, and QUICK programs (blech!) ... their documentation used this format, I didn't know there was a name for it. It was the only nice thing about working with those languages.
By @signaru - 9 months
It might be fun to look at the last few chapter's of Wirth's "Algorithms + Data Structures = Programs" for a deep dive and similar looking diagrams.