BartC said:
An assembly-like language you mean? Just google for lots of examples of
assembly source code.
Generally this kind of code doesn't use indentation, except for
perhaps a single level to help distinguish instructions from labels.
This is because the language isn't structured into blocks;
it's linear, while the labels are all mixed up, and no label-end
is needed because a label doesn't define a block, only a point.
With many assemblers, there is no rule against indenting.
When I first wrote OS/360 assembly code, I indented lines without
labels one space, and one space between opcode and operands. Not so
readable, but then the programs were small.
I don't know of any reason not to indent the instructions inside
a loop. The fact that a label may be at the beginning or end,
(or both) doesn't change the visual aid of indentation.
You can make your language more elaborate, but in practice people
make use of languages such as C instead, which will generate
this target code.
Well, there is another choice, which is to make an assembler
language that looks like a high-level language, such as PL/360.
PL/360 looks like PL/I, but each statment directly translates
into machine instructions, possibly with side-effects that a
normal HLL wouldn't have. Consider:
R1=R1+R1+R1;
First, note that R1 is machine general register 1. Then note that
the generated code looks like:
LR R1,R1
AR R1,R1
AR R1,R1
(Maybe the initial LR isn't generated, I haven't looked at the
actual rules in a long time.)
The result is that the value in R1 is multiplied by 4.
(Those used to C sequence points and side effects won't be
at all surprised.)
Still, I believe such languages can be more readable than the usual
assembly format.
-- glen