100% found this document useful (4 votes)
112 views49 pages

Writing A C Compiler Early Access Nora Sandler 2024 Scribd Download

ebook

Uploaded by

mrzykatabe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
112 views49 pages

Writing A C Compiler Early Access Nora Sandler 2024 Scribd Download

ebook

Uploaded by

mrzykatabe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Full download ebooks at https://ebookmeta.

com

Writing a C Compiler Early Access Nora Sandler

For dowload this book click link below


https://ebookmeta.com/product/writing-a-c-compiler-early-
access-nora-sandler/

OR CLICK BUTTON

DOWLOAD NOW
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Engineering a Compiler 3rd Edition Keith D. Cooper

https://ebookmeta.com/product/engineering-a-compiler-3rd-edition-
keith-d-cooper/

Osteopathy and Obstetrics Stephen Sandler

https://ebookmeta.com/product/osteopathy-and-obstetrics-stephen-
sandler/

Windows Security Internals with PowerShell EARLY ACCESS


James Forshaw

https://ebookmeta.com/product/windows-security-internals-with-
powershell-early-access-james-forshaw/

DevOps for the Desperate A Hands On Survival Guide


EARLY ACCESS 1st Edition Bradley Smith

https://ebookmeta.com/product/devops-for-the-desperate-a-hands-
on-survival-guide-early-access-1st-edition-bradley-smith/
Grokking Concurrency (Manning Early Access Program
Version 3) MEAP Kirill Bobrov

https://ebookmeta.com/product/grokking-concurrency-manning-early-
access-program-version-3-meap-kirill-bobrov/

Nora Heysen A Portrait Anne Louise Willoughby

https://ebookmeta.com/product/nora-heysen-a-portrait-anne-louise-
willoughby-2/

Nora Heysen A Portrait Anne Louise Willoughby

https://ebookmeta.com/product/nora-heysen-a-portrait-anne-louise-
willoughby/

React 18 Design Patterns and Best Practices, Fourth


Edition (Early Access) Anonymous

https://ebookmeta.com/product/react-18-design-patterns-and-best-
practices-fourth-edition-early-access-anonymous/

The Machine Learning Solutions Architect Handbook - 2nd


Edition (Early Access) David Ping

https://ebookmeta.com/product/the-machine-learning-solutions-
architect-handbook-2nd-edition-early-access-david-ping/
R L Y
E A S S
C E
AC
NO S TA RCH PRE SS
E A R LY A C C E S S P R O G R A M :
FEEDBACK WELCOME!

The Early Access program lets you read significant portions of an


upcoming book while it’s still in the editing and production phases, so you
may come across errors or other issues you want to comment on. But while
we sincerely appreciate your feedback during a book’s EA phase, please use
your best discretion when deciding what to report.
At the EA stage, we’re most interested in feedback related to content—
general comments to the writer, technical errors, versioning concerns, or
other high-level issues and observations. As these titles are still in draft form,
we already know there may be typos, grammatical mistakes, missing images
or captions, layout issues, and instances of placeholder text. No need to
report these—they will all be corrected later, during the copyediting, proof-
reading, and typesetting processes.
If you encounter any errors (“errata”) you’d like to report, please fill out
this Google form so we can review your comments.
WRITING A C COMPILER
NOR A SANDLER
Early Access edition, 3/25/22

Copyright © 2022 by Nora Sandler.

ISBN 13: 978-1-7185-0042-6 (print)


ISBN 13: 978-1-7185-0043-3 (ebook)

Publisher: William Pollock


Managing Editor: Jill Franklin
Production Manager: Rachel Monaghan
Developmental Editor: Alex Freed
Production Editor: Paula Williamson
Cover Illustrator: James L. Barry
Interior Design: Octopod Studios
Compositor: Happenstance Type-O-Rama

No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press,
Inc. Other product and company names mentioned herein may be the trademarks of their
respective owners. Rather than use a trademark symbol with every occurrence of a trade-
marked name, we are using the names only in an editorial fashion and to the benefit of the
trademark owner, with no intention of infringement of the trademark.

All rights reserved. No part of this work may be reproduced or transmitted in any form or by
any means, electronic or mechanical, including photocopying, recording, or by any informa-
tion storage or retrieval system, without the prior written permission of the copyright owner
and the publisher.

The information in this book is distributed on an “As Is” basis, without warranty. While every
precaution has been taken in the preparation of this work, neither the author nor No Starch
Press, Inc. shall have any liability to any person or entity with respect to any loss or damage
caused or alleged to be caused directly or indirectly by the information contained in it.
CONTENTS

Introduction

PART I: THE BASICS


Chapter 1: Introduction to Compilers
Chapter 2: Returning an Integer
Chapter 3: Unary Operators
Chapter 4: Binary Operators
Chapter 5: Logical and Relational Operators
Chapter 6: Local Variables
Chapter 7: If Statements and Conditional Expressions
Chapter 8: Compound Statements
Chapter 9: Loops
Chapter 10: Functions
Chapter 11: Static Variables

PART II: IMPLEMENTING TYPES


Chapter 12: Long Integers
Chapter 13: Unsigned Integers
Chapter 14: Floating-Point Numbers
Chapter 15: Pointers
Chapter 16: Arrays and Pointer Arithmetic
Chapter 17: Characters and Strings
Chapter 18: Supporting Dynamic Memory Allocation
Chapter 19: Structures

PART III: OPTIMIZATIONS


Chapter 20: Optimizing TACKY Programs
Chapter 21: Register Allocation

Conclusion: Next Steps

The chapters in red are included in this Early Access PDF.


Writing a C Compiler (Early Access) © 2022 by Nora Sandler

2
RETURNING AN INTEGER

In this chapter, you’ll write a tiny compiler that can


only handle the simplest possible C programs. You’ll
learn how to read a simple assembly program, and
you’ll implement four basic compiler passes that
you’ll keep building on for the rest of the book. Let’s
start by looking at the four compiler passes you’ll
build in this chapter.
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

Figure 2-1: Stages of the compiler

The Four Compiler Passes


The compiler you write in this chapter will process source code in four
stages:
The lexer breaks up the source code into a list of tokens. Tokens are the
smallest syntactic units of a program, and include things like delimiters,
arithmetic symbols, keywords, and identifiers. If a program is like a
book, tokens are like individual words.
The parser converts the list of tokens into an abstract syntax tree (AST),
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

which represents the program in a form that we can easily traverse and
analyze.
The code generation pass converts the AST into assembly. At this
stage, we still represent the assembly instructions in a data structure that
the compiler can understand, not as text.
The code emission pass writes the assembly to a file so the assembler
and linker can turn it into an executable.
This is a pretty normal way of structuring a compiler, although the
exact stages and intermediate representations vary. It’s also overkill for this
chapter; the programs you’ll handle here could be compiled in just one pass!
But setting up this structure now will make it easier to expand your compiler
in future chapters. As you implement more language features, you’ll extend
these compiler stages and add a few new ones. Each chapter in the book
starts with a diagram of the compiler's architecture in that chapter, including
the stages you've already implemented and any you'll need to add. Figure 2-
1 shows the four stages you'll implement in this chapter.
Before you start coding, let’s take a quick look at how to compile C to
assembly with GCC, and how to read assembly programs.

Hello, Assembly!
The simplest possible C program looks like this:
1 int main() {
2 return 32;
}

Listing 2-1 A simple program that returns the number 2.

This program consists of a single function 1, main, containing a single


return statement 2, which returns an integer—in this case, 2 3. Let’s
translate the code in Listing 2-1 into assembly using GCC:
$ gcc -S -O -fno-asynchronous-unwind-tables -fcf-
protection=none return_2.c

These GCC options produce fairly readable assembly:


-S Don’t run the assembler or linker. This makes GCC emit assembly
instead of a binary file.
-O Optimize the code. This eliminates some instructions we don’t care
about right now. When you inspect GCC output in later chapters, you’ll
usually want to turn optimization off so you can more clearly see how
code generation works.
-fno-asynchronous-unwind-tables Don’t generate the unwind table,
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

which is used for debugging. We don’t care about it.


-fcf-protection=none Disable control-flow protection. This is a
security feature that adds extra instructions that we don’t care about.
Control-flow protection might already be disabled by default on your
system, in which case this option won’t do anything.
The result, stored in return_2.s, should basically look like this:
1 .globl main
2main:
3 movl $2, %eax
4 ret

Listing 2-2 The program from Listing 2-1 translated into assembly.

NOTE All the assembly listings in this book use AT&T syntax. Elsewhere, you’ll sometimes
see x64 assembly written in Intel syntax. They’re just two different notations
for the same language; the biggest difference is that they put instruction
operands in different order.

Your .s file might contain a few other assembler directives, but you can
safely ignore them for now. The four lines in Listing 2-2 are a complete
assembly program. Assembly programs have several kinds of statements.
The first line, .globl main 1 , is an assembler directive, a statement
that provides directions for the assembler. Assembler directives always
starts with a period. Here, main is a symbol, a placeholder for a memory
address. An assembly instruction can include a symbol when it needs to
refer to the address of a particular function or variable, but the compiler
doesn’t know where that function or variable will end up in memory. Later,
after the linker has combined the different object files that make up the
executable, it can associate each symbol with a memory address; this
process is called symbol resolution. Then the linker will update every place
that uses a symbol to use the corresponding address instead; this is called
relocation.
The .globl main directive tells the assembler that main is a global
symbol. By default, a symbol can only be used in the same assembly file
(and therefore the same object file) where it’s defined. But because main is
global, other object files can refer to it too. The assembler will record this
fact in a section of the object file called the symbol table. The symbol table
contains information about all the symbols in an object file or executable.
The linker relies on the symbol table during symbol resolution. If the
symbol table doesn’t list main as a global symbol, but another object file
tries to refer to it, linking will fail.
Next, we use main 2 as a label for the code that follows it. Labels
consist of a string or number followed by a colon. This label marks the
location that the symbol main refers to. For example, the instruction jmp
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

main should cause the program to jump to the instruction at line 3. But the
label can’t indicate the final location of main; like I mentioned earlier, we
won’t know that until link time. Instead, it defines main as an offset from
the start of the current section in this object file. (An object file includes
different sections for machine instructions, global variables, debug
information, and so on, which are loaded into different parts of the
program's address space at runtime. The object file produced from Listing 2-
2 will only have one section: the text section, which contains machine
instructions.) Because 3 is the very first machine instruction in this file, the
offset of main will be 0. The assembler will record this offset in the symbol
table so the linker can use it to determine the final address of main during
symbol resolution.

FURTHER READING ON LINKERS


The last couple of paragraphs really oversimplified how linking works! If I included a totally
accurate explanation of linkers, this chapter would be 90% about linkers and 10% about your actual
compiler. But you should go read more about linkers, because you need to understand them in order
to really get what’s going on in a running program. Here are some blog posts on linkers that I like:

• “Beginner’s Guide to Linkers,” by David Drysdale, is a good starting point.


(http://www.lurklurk.org/linkers/linkers.html)

• Ian Lance Taylor’s 20-part essay on linkers goes into a lot more depth. The first post is at
https://www.airs.com/blog/archives/38, and there’s a table of contents at
https://lwn.net/Articles/276782/.

• “Position Independent Code (PIC) in shared libraries,” a blog post by Eli Bendersky, provides an
overview of how compilers, linkers, and assemblers work together to produce position-
independent code, focusing on 32-bit machines
(https://eli.thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries/).

• “Position Independent Code (PIC) in shared libraries on x64,” also by Eli Bendersky, builds on
the previous article, focusing on 64-bit systems
(https://eli.thegreenplace.net/2011/11/11/position-independent-code-pic-in-shared-libraries-on-
x64).

Next, we have movl 3, an example of a machine instruction, which is


an instruction that appears in the final executable. The movl instruction in
Listing 2-2 moves the value 2 into a register—a very small, very fast
storage slot that has its own name and sits right on the CPU. Here, we move
2 into the register named EAX, which can hold 32 bits. According to our
platform's calling convention, return values are passed to the caller in EAX
(or RAX, the 64-bit equivalent, depending on the return value’s type). Since
the caller also knows about this convention, it can retrieve the return value
from EAX after the function returns. The l suffix in movl indicates that the
operands to this instruction are long integers. In assembly, unlike most
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

modern implementations of C, “long” means 32 bits. A movq instruction


operates on quadwords, which is how x64 assembly refers to 64-bit integers.
I’ll just write mov when I want to refer to this instruction without specifying
its size.
Finally, we have another machine instruction, ret 4, which returns
control to the caller. You might see retq here instead of ret, since this
instruction implicitly operates on a 64-bit return address. I’m skipping a lot
of details, like what calling conventions are, who decides on them, or how
ret knows where the caller is. I’ll come back to those details when we add
function calls in chapter 10.
At this point, it’s fair to ask who the caller is, since main is the only
function in this program. It’s also fair to wonder why we need the .globl
main directive, since there don’t seem to be any other object files that could
contain references to main. The answer is that the linker adds a tiny bit of
wrapper code called crt0 to handle setup before main runs, and teardown
after it exits. (The crt stands for “C Runtime.”) This wrapper code
basically does the following:

1. Makes a function call to main. This is why main needs to be globally


visible; if it’s not, crt0 can’t call it.

2. Retrieves the return value from main.

3. Invokes the exit system call, passing it the return value from main.
Then exit handles whatever work needs to happen inside the
operating system to terminate the process and turn the return value
into an exit code.
The bottom line is that you don’t need to worry about process startup or
teardown; you can treat main like a normal function.
To verify that the assembly in Listing 2-2 works correctly, you can
assemble and link it, run it, and check the exit code with the $? shell
operator:
$ gcc return_2.s -o return_2
$ ./return_2
$ echo $?
2

Note that you can pass an assembly file to GCC just like a regular
source file. GCC assumes any input files with a .s extension contain
assembly, so it will just assemble and link those files without trying to
compile them first.
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

Writing the Compiler Driver


As we saw in the last chapter, a compiler isn’t very useful on its own.
To turn a source file into an executable, you’ll need to write a compiler
driver that invokes the preprocessor, compiler, assembler, and linker. It’s a
good idea to write a compiler driver that works with test_compiler before
starting on the compiler itself, so you can validate each compiler stage
against the test suite as you go. The compiler driver should do the following:

1. Preprocess a source file:


gcc -E -P INPUT_FILE -o PREPROCESSED_FILE

2. By convention, the preprocessed file should have a .i file extension.

3. Compile the preprocessed source file, and output an assembly file with
a .s extension. You’ll have to stub out this step, since you haven’t
written your compiler yet.

4. Assemble and link the assembly file to produce an executable:


gcc ASSEMBLY_FILE -o OUTPUT_FILE

To work with test_compiler, your compiler driver must be a command-


line program that accepts a path to a C source file as its only argument. If
this command succeeds, it must produce an executable in the same directory
as the input file, with the same name (minus the file extension). In other
words, if you run ./YOUR_COMPILER /path/to/program.c, it should
produce an executable at /path/to/program and terminate with an exit code
of zero. If your compiler fails, the compiler driver should return a non-zero
exit code, and should not write any assembly or executable files; that’s how
test_compiler verifies that your compiler catches errors in invalid programs.
Finally, your compiler driver should support a --lex option that directs it
to just perform the lexing pass, as well as a --parse option that directs it
to just run the lexer and parser but stop before code generation. Neither of
these options should produce any output files.
Once you’ve written the compiler driver, you’re ready to start working
on the actual compiler.
You need to implement the four compiler passes I listed at the
beginning of the chapter: the lexer, which produces a list of tokens; the
parser, which turns those tokens into an abstract syntax tree; the code
generator, which converts the abstract syntax tree into assembly, and the
assembly emitter, which writes that assembly to a file. Let’s look at each of
those passes in more detail.

Writing the Lexer


The lexer should read in a source file and return a list of tokens. Before
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

you can start writing the lexer, you need to know what tokens you might
encounter. Here are all the tokens in Listing 2-1:
int: a keyword
main: an identifier, whose value is “main”
( : an open parenthesis
) : a close parenthesis
{ : an open brace
return: a keyword
2: a constant, whose value is “2”
; : a semicolon
} : a close brace
I’ve used two lexer-specific terms here. An identifier is an ASCII letter
followed by a mix of letters and digits; identifiers are case sensitive. An
(integer) constant consists of one or more digits. (C supports hexadecimal
and octal integer constants too, but you can ignore them to keep things
simple. We’ll add character and floating-point constants in part II.)
Note that identifiers and constants have values in the list of tokens
above, but the other types of tokens don’t. There are many possible
identifiers (foo, variable1, or my_cool_function), so each
identifier token produced by the lexer needs to retain its specific name.
Likewise, each constant token needs to hold an integer value. By contrast,
there's only one possible return keyword, so a return keyword token
doesn't need to store any extra information. Even though main is the only
identifier right now, it’s a good idea to build the lexer in a way that can
support arbitrary identifiers later on. Also note that there are no whitespace
tokens. If we were compiling a language like Python, where whitespace is
significant, we’d need to include whitespace tokens.
You can define each token type with a regular expression. Table 2-1
gives the corresponding regular expression for each token in PCRE syntax:

Table 2-1 Tokens

Token Regular Expression


Identifier [a-zA-Z_]\w*\b
Constant
[0-9]+\b
Int keyword
int\b
Return keyword
return\b
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

Open parenthesis
\(
Close parenthesis
\)
Open brace
{
Close brace
}
Semicolon
;

The process of tokenizing a program then looks roughly like this:


while input isn’t empty:
find longest match at start of input for any regex in
Table 2-1
convert matching substring into a token
remove matching substring from start of input
trim whitespace from start of input
if no valid token can be created, raise an error

Listing 2-3 Converting a string to a sequence of tokens

Note that identifiers and constants must end at word boundaries. For
example, the first three digits of 123;bar match the regular expression for
a constant, and can be converted into the constant 123. That’s because ;
isn’t in the \w character class, so the boundary between 3 and ; is a word
boundary.
However, the first three digits of 123bar do not match the regular
expression for a constant, because those digits are followed by more
characters in the \w character class instead of a word boundary. If your
lexer sees a string like 123bar it should raise an error, because the start of
the string doesn’t match the regular expression for any token.
You can assume that your C source file only contains ASCII characters.
The C standard provides a mechanism called universal character names to
include non-ASCII characters in identifiers, but we won’t implement them.
Many C implementations let you use Unicode characters directly, but you
don’t need to support that either.

Testing the Lexer


You can test your lexer against all the programs in tests/chapter_2. The
sample programs in tests/chapter_2/invalid_lex all contain invalid tokens, so
they should all cause the lexer to fail with an appropriate error message. The
sample programs in tests/chapter_2/invalid_parse and tests/chapter_2/valid
only contain valid tokens, so the lexer should be able to process them
successfully. You can use the following command to test that your program
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

fails on the programs in tests/chapter_2/invalid_lex and succeeds on


everything else:
$ ./test_compiler /path/to/your_compiler --chapter 2 --stage
lex

This command just tests whether the lexer succeeds or fails. You may
want to write your own tests to validate that it produces the correct list of
tokens for valid programs and emits an appropriate error for invalid ones.

Implementation Tips
Treat keywords like other identifiers. The regex for identifiers also
matches keywords. Don’t try to simultaneously find the end of the next
token and figure out whether it’s a keyword or not. First, find the end of
the token. Then, if it looks like an identifier, check whether it matches
any of the keywords.
Don’t split on whitespace. It might seem like a good idea to start by
splitting the string on whitespace, but it’s not. It will just complicate
things, because whitespace isn’t the only boundary between tokens. For
example, main() has three tokens and no whitespace.

Writing the Parser


Now that you have a list of tokens, the next step is to figure out how
those tokens are grouped together into language constructs. In most
programming languages, including C, this grouping is hierarchical: each
language construct in the program is composed of several simpler
constructs. Individual tokens represent the most basic constructs, like
variables, constants, and arithmetic operators. Tree data structures are a
natural way to express this hierarchical relationship. A tree representation of
a program is called an abstract syntax tree, or AST. Most compilers use
ASTs internally, and yours will too. Your parser will accept the list of
tokens produced by the lexer and generate an AST. Then your code
generation stage will traverse that AST to figure out what assembly code to
emit.
There are two basic approaches to writing a parser. One option is to
handwrite the code for your parser. The other option is to use a parser
generator like Bison or ANTLR to produce your parsing code
automatically. Using a parser generator is less work than hand-writing a
parser, but this book uses a handwritten parser for a few reasons. Most
importantly, hand-writing a parser will give you a solid understanding of
how your parser works. It’s easy to use a parser generator without really
understanding the code it produces. Many parser generators also have a
steep learning curve, and you’re better off learning general techniques like
recursive descent parsing before you spend a lot of time mastering specific
Writing a C Compiler (Early Access) © 2022 by Nora Sandler

tools.
Handwritten parsers also have some practical advantages over those
produced by parser generators; they can be faster and easier to debug, and
provide better support for error handling. In fact, both GCC and Clang use
handwritten parsers. So writing a parser by hand isn’t just an academic
exercise.
That said, if you’d rather use a parser generator, that’s fine too! It all
depends on what you’re hoping to get out of the book. But I won’t talk
about how to use them, so you’ll have to figure that out on your own. If you
decide to go that route, make sure to research what parsing libraries are
available in your implementation language of choice.
Whichever option you choose, the first step is designing the abstract
syntax tree you want your compiler to produce. It might help to see an
example of an AST first.

An Example Abstract Syntax Tree


Let’s take a look at the AST for this code snippet:
if (a < b) {
return 2 + 2;
}

Listing 2-4 A simple if statement

This is an if statement, so we’ll label the root of the AST if. The if
node will have two children:

1. The condition, a < b

2. The “then” clause, return 2 + 2;


Each of these constructs can be broken down further. For example, the
condition is a binary operation with three children:

3. The left operand, variable a

4. The operator, <

5. The right operand, variable b


Figure 2-2 shows the whole AST for this code snippet:
Another random document with
no related content on Scribd:
“coal-box” effect greeted the Territorials on arrival and gave them
their first impression of real warfare. It was amazing that the
casualty list was not far heavier. Had the enemy at this period been
in possession of more and better ammunition the position in Gallipoli
would have been untenable. Owing to this shortage in these early
days solitary wagons and pack-animals could be moved about freely
by day behind the lines, within view and range (with open sights) of
the guns on the slopes of Achi Baba; for the Turk rarely wasted a
shell on the chance of destroying one man or horse, and, by
extending to a distance of 400 yards, even a battalion transport
could often go forward and backward unmolested by day. The
incessant rifle fire at night made the area immediately behind the
front lines more dangerous then than by day.
Farther away to the north the British front was The Nullahs
intersected by three streams, or, except during and
immediately after rain, three more or less dry beds of streams,
running north-east to south-west. The largest of these was Gully
Ravine (Saghir Dere) close to and parallel with the western coast,
emptying into Gully Beach about two miles north of Lancashire
Landing. The Krithia Nullah (Kirte Dere) began near Krithia Village,
and intersected the centre of the British area for a distance of three
miles, then, a mile north of “V” Beach, turned to the south-east and
emptied into Morto Bay. The third, Achi Baba Nullah (Maltepe Dere)
ran parallel to, and from 500 to 1000 yards to the east of the Krithia
Nullah, and it also debouched into Morto Bay. No nullah emptied into
“W” or “V” Beach, and none intersected the high ground adjacent to
those beaches. As the one road in the occupied territory, the Krithia
Road, was registered, and in full view of the Turks, these gullies
formed the only concealed approaches from the bivouacs and rest
camps to the front line. The congestion of these “main streets”
made traffic slow and laborious. Normally the approach would be
along the bed of a tortuous stream, showing here and there a trickle
of water, and at one spot in the Krithia Nullah even a small bathing-
pool; but the sight of driftwood and debris deposited six feet and
more above the bed-level gave warning to the observant. Disastrous
experience soon showed that a few hours’ heavy rain could convert
these nullahs into raging and devastating torrents; and when the
spate subsided channels of deep mud would be left, with here and
there a quagmire into which mules and horses sank.
That one may have too much of a good thing while suffering from
a lack of it may be a paradox, but there were times when it was true
enough in Gallipoli. Water there was below the surface, to hinder the
construction of deep trenches, in which men might stand or sit or
walk without offering their heads and bodies as targets to the
sniper; there was at times water in exuberant excess to wash away
stores, equipment, and even trenches and dug-outs; but clean water
was more precious than wine. There were one or two derelict farms
which had wells, but the demand was so great that the supply soon
gave out. Unfortunately no steps had been taken to protect wells
from pollution when the area was first occupied, but afterwards a
guard was placed over them, and the water chlorinated before issue,
through fear of contamination. A small supply for the brewing of tea
was obtained by digging a hole in the trench, below the parados,
and placing therein an old biscuit tin with perforated bottom. In this
way a little water could be collected—and every pint was treasure.
As there were many of our own and the enemy dead lying out in the
open, and also latrines in the immediate neighbourhood, it is a great
tribute to the value of chlorination and typhoid inoculation that men
drank this water with impunity. The normal trickle through the
Krithia Nullah provided water for washing but not for drinking, as the
stream flowed through the Turkish lines into ours, and was very
dirty. A few springs of good water were found in the banks of the
nullah, and one of these never failed to supply about 100 gallons an
hour. Later, new wells were dug, a gang of well-sinkers, chosen from
men of the mining districts, doing useful work. Some of the best of
these wells were sunk on the side of a precipitous cliff at Shrapnel
Point, near Gurkha Bluff, within a stone’s throw of, but fifty feet
above, the sea.
Before the Division landed there had been little attempt at
sanitation; there were not nearly enough men for fighting purposes,
and no one had time to worry about such things until too late. The
flies had then arrived.
The southern point of the peninsula had been very sparsely
inhabited. There were two villages, Sedd-el-Bahr, between “V” Beach
and Morto Bay, and Krithia, below the slopes of Achi Baba.
Elsewhere a few isolated buildings remained, and arches of an
ancient aqueduct which had formerly brought water to Sedd-el-Bahr,
still stood. But the inhabitants of the nullahs had not fled. Who that
heard them will ever forget the frogs of the nullahs at night? A vivid
memory of this will remain when things of more importance are
forgotten. The average Lancashire man had read that frogs croak,
and had accepted the statement tolerantly, as we acquiesce when
told that, in spite of appearances, Sirius is really larger than the
moon, or that the earth goes round the sun. Now they heard them,
and considered “croak” too feeble and inexpressive a word. Some
had perhaps read Aristophanes, and had assumed that the frogs of
sunnier climes might voice their joys and sorrows less decorously
than those which reside in suburban ponds near Manchester. At first
the origin of the noise[3] gave rise to much conjecture, a popular
notion being that the Gurkhas were responsible. Anything out of the
common might be attributed to them. Had it not been printed in the
newspapers that the Gurkhas observed a strange rite in respect of
the shedding of blood whenever they drew their kukris, to show to
the curious stranger or to put a still keener edge on the blade? And
did they not throw these heavy, curved knives at the enemy?
Accepting such statements as facts it was quite simple to believe
that you yourself had seen them do these strange things. So the
noise was made by the Gurkhas, and doubtless some unfortunate
Turks were having a most unpleasant time.
Other interesting and unusual fauna were the The Fauna of
tortoises, lizards, tarantulas, and scorpions. The Gallipoli
tortoises were decidedly popular, and the lizards
entertaining, but no one loved the others. At a later date some
ammunition was wasted on the flocks of migrating cranes and storks
that flew over in wedge-shaped phalanx, until shooting at them was
forbidden. The number of birds which lived and nested on the
peninsula, undeterred by, and apparently indifferent to, the noise,
carnage and destruction and the presence of armies where men had
hitherto been infrequent visitors, was remarkable. Linnets,
goldfinches, turtle-doves, magpies, jackdaws, and other familiar
birds were common. During the summer many rollers were seen,
and were called “parrots” from the brilliance of their plumage. Black-
headed buntings, having yellow plumage, were mistaken for
canaries. Birds of prey abounded, from the griffon vulture seen in
May on the cliffs of Helles to the abundant kestrel. Levantine
sheerwaters, known to the Turks as “the souls of the damned”—a
name which gained in significance as the months passed—flew in
flocks round the cape. The winter brought homely English birds,
robins and dunnocks, starlings and chaffinches, to remind men of
home.
Another noise which for a time puzzled the lads from Lancashire
was a weird, penetrating cry heard in the morning and evening.
There were various conjectures as to its origin, but finally the more
enlightened decided that it was the muezin calling the Faithful to
prayer.
Having given some idea of the conditions in Gallipoli and the
nature of the country, we return to the narrative of events.
On May 11 the East Lancashire Division was ordered to take over
the whole of the British front line, except that portion held by the
Indian Brigade, which came under the command of General Douglas
for a few days. The line was taken over in the course of the night
and of the morning of the 12th. It was a pitch dark night with heavy
rain, and few of those who took part will forget this first experience.
On the evening of the 12th the Manchester Brigade made a
demonstration to draw attention from an important movement by
the Indian Brigade on their left. The high cliff overlooking the ravine
of “Y” Beach was strongly held by the enemy, and the machine guns
of this formidable redoubt formed an obstacle that must be
overcome before further progress could be made. The feint of the
Manchesters served its purpose by distracting attention from the
storming company of the 6th Gurkhas, and so enabling the hardy
little mountaineers to scramble up the cliffs unopposed and rush the
redoubt. They held the Turks at bay while their comrades of the
other three companies swarmed up the rocks and completed the
capture of the position, which received the name of Gurkha Bluff. It
was not only a fine bit of work, but also a success of the greatest
value. On the same evening the Lancashire Fusilier Brigade opened
fire to support a forward movement by French troops on their right.
On May 15 a readjustment of positions was ordered, and on the
nights of May 16-17 and 17-18 the reliefs were carried out. The line
of trenches was now in four sections. That on the left, held by the
29th Division, including the 29th (Indian) Brigade, ran from the
Ægean coast eastward for 1600 yards to the eastern edge of Fir Tree
Wood, 300 yards north-west of Krithia Nullah. The next section, held
by the East Lancashire Division, extended the line for 1500 yards
from the right of the 29th Division, through the Krithia Nullah to the
Achi Baba Nullah, which it included. The Royal Naval Division’s
section continued the line for 700 yards to the Telegraph Line; and
the right section, thence to the coast of the Straits, above the ruin
known as “De Tott’s Battery,” about 2100 yards in length, was held
by the French Corps Expeditionnaire.
Later this line was termed the Redoubt Line. Saps terminating in
T-heads were run out towards the Turkish trenches, and parties told
off at night to connect the T-heads and dig themselves in, until two
new advanced lines had been made. By the end of May a series of
redoubts had been constructed at intervals along the old front line,
and these were garrisoned in readiness to meet any temporary
success of the enemy. The occasion did not, however, arise. The
Manchester Brigade occupied the first line of the second section,
with the Lancashire Fusilier Brigade on its right, and the East
Lancashire Brigade as reserve. It may be mentioned that at this
period the total ammunition available for a battalion consisted of 200
rounds per man, with twelve boxes of 1000 rounds each in reserve
in the firing line, and twelve boxes at Battalion Headquarters.
During the three weeks after the disembarkation of the Division
had been completed there was little actual fighting, no attack being
made by either side. The arrival of the Territorials had strengthened
the position sufficiently to discourage Turkish hopes of dislodging the
invading force, but no forward movement on a large scale could be
contemplated until the ground recently won had been consolidated
and the difficulties of transport and supplies reduced. As the line
stretched from sea to sea no flanking movement was possible. It
was therefore a case of playing for position for a time. Each infantry
brigade in turn assisted the French, the R.N. Division, and the Indian
Brigade to develop their plans and effect necessary changes, and
each in turn relieved the brigade in the first line.
But though there was a lull in the fighting after Shelling and
the 8th of May the shelling of the trenches, rest Sniping
camps, cliffs, and beaches never ceased for long.
Even bathing parties[4] suffered from the shelling, and the Turkish
rifles blazed away day and night without cessation, causing much
loss to working-parties and men in bivouac far behind the first line,
and even in the R.A.M.C. tents below the cliffs. At dark one could
hear from the cliffs of Gully Beach the continuous “plop” of bullets
striking the water. There were also casualties from hidden machine
guns; and the courage, enterprise, and skill of the Turkish snipers
were the cause of many fatal wounds. Owing to the shallowness of
the average trench it was difficult even for the most careful and
experienced to keep under cover, and most injuries received at this
time were head wounds. The Turkish snipers hid in the scrub—some
carrying camouflage so far as to paint themselves green—or lay in
holes apart from, and generally in advance of, their trench system;
and their patience, persistence, and ingenuity evoked reluctant
tributes from their foemen. Fir Tree Wood was a happy hunting-
ground of the snipers, some of whom had remained in their hiding-
places during our advance, in order to pick our men off at short
range during the night. The Territorials received valuable tips from
the Regulars on the best methods of dealing with snipers, and
before long their numbers, and the losses they inflicted, were kept in
check.

BATHING POOL IN KRITHIA NULLAH.


THE KRITHIA NULLAH.

EVENING “HATE.”

During this period the men not in the front lines were kept busy
unloading supplies at the beaches and transporting them to the
dumps, road-making, trench and well digging, and performing many
other fatigues. The sappers, who had landed on the 9th and 10th of
May, had their hands more than full. The 1st Field Company was in
bivouac near Morto Bay on the right, and the 2nd Field Company on
the left flank near Pink Farm, a solitary building which became a
famous landmark and rendezvous during the campaign. They
directed the construction of trenches, of lines of rifle-pits in front of
the trenches, of dug-outs, and trench-bridges for armoured cars,
improvements of the rough country tracks, work on wells and
appliances for distribution of drinking water, and the manufacture of
bombs. The digging, deepening, and repairing, and, when material
was available, the strengthening of trenches was a never-ending
task, which had to be performed under fire from artillery, machine
guns, and snipers. The soil was mainly a stiff yellow loam, which
stood well unrevetted until rain came, when it was transformed into
peculiarly bad mud, and the water would not drain away. Gorse and
heather, outcroppings of rock, and in one or two sectors, the tough
fir-roots, which interlaced and formed a network at varying depths,
added considerably to the difficulties.
The Field Ambulances on landing had equal difficulties to
encounter, and the way in which they contrived to overcome them
and to makeshift successfully afforded proof of their resource.
Dressing stations had to be made in clefts in the cliffs, with tarpaulin
sheets stretched from boulder to boulder for shelter. The shortage of
appliances and equipment during the first weeks was a serious
handicap. As soon as their equipment arrived they moved up to the
rear of the bivouacs in the centre of the line. The battalion stretcher-
bearers had quickly “made good.” They had had to stand the usual
chaff while training, but within a week of landing they had become
“heroes” in the eyes of their comrades. The Field Ambulances,
lacking tackle, had not been able to provide bearers to evacuate
from First-Aid Posts, and the battalion stretcher-bearers carried the
wounded a distance of three miles to the beach.
Practically everything required for the army in Gallipoli had to be
brought from the base at Mudros, the harbour of the Island of
Lemnos, nearly forty miles away. Even water was conveyed overseas
to supplement the inadequate local supply. Rations, ammunition,
equipment, and material of all sorts were transferred from the ships
to flat-bottomed lighters and landed, frequently in rough weather,
and generally under fire from the Asiatic coast. The small A.S.C. unit
therefore did not enjoy much leisure. No. 2 Transport and Supply
Company had given evidence of its efficiency, for, though within ten
days after landing it had lost forty-one animals killed, it was found
that they possessed one more than the original number landed.
Many loose mules were straying around, and the company upheld
the rather unenviable reputation of which it boasted in pre-war days
of never passing any unconsidered trifles by.
A Divisional Supply dump had been established on the top of the
cliffs above “W” Beach, and there it remained until the evacuation.
Though in a very exposed position and under daily shell fire it
enjoyed a remarkable immunity. The rations were “man-handled”
from the beaches to this dump, where they were issued to the
Regimental Quartermasters, who brought with them their limbers
when they had any, but usually A.S.C. limbers took rations to the
R.Q.M.’s dump, about a mile inland, where they were divided in
proportion to the strength of companies. Here battalion transport
men loaded the pack-animals and led them across country for two or
three miles to Battalion Headquarters, a short distance in the rear of
the trenches, where the stores were unloaded, and the Transport
Officer’s responsibility ended. At Battalion Headquarters a party from
each company in the trenches was waiting to carry the rations to
Company Headquarters, where the C.Q.M.S. issued to the platoon
sergeants the share for their men, and the platoon sergeants in due
course divided the articles among the section commanders.
On paper this simple daily routine is a mere Transport and
matter of efficient organization, but in active Rations
practice it was something more. The Turk had a
very good idea of the routes to be taken, and as he fired more
vigorously during the night than in the daytime, the transport,
whenever possible, moved up soon after noon while he indulged in
his siesta. Rations had, however, often to be taken up at night, and
casualties among the A.S.C. men and trench ration parties were
frequent. None of the pack-animals had previously been under fire.
The load must be packed with equal weight on either side or it will
not reach its destination, for the mule, though a convinced
individualist, has nothing to learn from the best-organized trade
union in the matter of direct action or the lightning strike. The loads
consisted of full boxes and half-filled boxes of bully-beef tins, tins of
biscuits, jars of rum, sacks of loaves, whole cheeses, tins of jam,
bags of tea and sugar, sides of bacon, and on mail-days bags of
letters and parcels. The correct balancing and securing of such
articles, even on a placid, well-trained horse in a paddock at home,
where no more disturbing explosions are to be feared than those
caused by a distant motor-cycle, demands no mean skill and sense
of proportion. But when shells are bursting close at hand, and mules
and horses do their best to prevent the loading and dislodge the
loads, it is a very different affair. When the loading has at last been
accomplished and the animal is asked to move he will probably kick
and buck until the load goes to the winds. Both mules and horses
behaved uncommonly well under fire. On the rough tracks the mule
was far steadier than the horse and could carry an equal weight. He
was more particular about the perfect balance of his load, and would
not attempt to carry an uneven pack.
Having finally completed the packing and persuaded the animals
to start on the journey to Battalion Headquarters the Transport
Officer’s troubles take another turn. He has to find his way in the
dark across an open bullet-swept zone with animals that jib and shy
as the shells burst, or lie down as the fit takes them, and at times
succeed in scattering their packs. These must be collected and
laboriously replaced, the driver meanwhile employing the most
spirited and forcible terms of endearment in his vocabulary. At times
the convoy will be held up by heavy shelling of the area that has to
be crossed. Leaving the open they enter one of the nullahs up and
down which hundreds of troops are moving, and progress is slow
and exasperating. But in spite of all obstacles the transport men
daily got the rations through to their comrades in the line. Nor
should a word of gratitude to the Indian drivers of the A.T. carts and
the Zion Mule Corps be omitted. These men gave efficient help in
the transport of stores and material from the beaches to the dumps,
and their courage under fire was admirable. The pride the Indians
took in the smart and clean turn-out of their mules and carts was
the more noticeable as they did not appear to be subject to the
ordeal of inspection.
The journeys of the ration-parties from Battalion Headquarters to
Company Headquarters were no less exciting than those of the
battalion transport parties. Bearing heavy boxes or bags on heads or
shoulders they crossed from trench to trench in the open, tripping
over wire, stumbling into holes, dodging rifle fire, and, too often,
falling victims to the sniper. But the rations arrived and the men
were fed.
The rations were monotonous and ill-suited to the climate. They
consisted of bacon (for breakfast), bully-beef and biscuit, with a little
jam and cheese, a tin of Maconochie’s vegetable rations being at
first, but not later, considered a treat, but Maconochie was
particularly unsuited to a hot climate. Fruit—even good tinned fruit—
and fresh vegetables would have done much to preserve the health
of the men during the intense heat of the summer. In due course
every man became a more or less expert cook, and to be on visiting
terms was a privilege not unattended by risk, as it involved the
sampling of many weird experiments and decoctions. Bread from the
tents on Bakery Beach was first issued on May 21, and was received
with acclamation.
Firewood was very scarce, as there were few trees or bushes, but
it had to be obtained somehow for the trench fires over which the
men brewed their tea and cooked their food. It was therefore not
uncommon in the Helles area, in spite of orders issued to diminish
waste, to see a caseful of tins of bully-beef tipped out on the
roadside, that the invaluable wooden case might be split up for fuel.
Butts of rifles which lay beside their dead owners met the same fate.
Evidence of the awful waste of war abounded—weapons,
ammunition, equipment, food, clothing, trodden under foot, and left
to rust and decay. Where man could not expose himself by day
these things remained unsalved for months, but elsewhere they
were collected and returned to store. The best place where wood
could be “won” was above Bakery Beach. A sentry was put over the
wood-pile, but interesting conversation and a few cigarettes would
occasionally distract his attention for the needful time.
On May 21 the Brigade Commanders received instructions from
the Divisional Commander on various points connected with the
latest methods and conditions of siege warfare, such as the use of
bombs, sandbags, and loopholes, and the action of snipers. One
officer, one N.C.O. and four men from each company were instructed
in bombing, under the officer commanding the R.E., and each
infantry brigade was allotted 400 bombs. It was found, however,
that no more than 225 bombs were available for distribution among
the three brigades. The bombs were made from empty jam tins sent
down from the trenches to Lancashire Landing, where they were
filled (chiefly by the divisional butchers and bakers at first) with old
nails, bits of shell and of barbed wire, and other scraps of metal and
an explosive charge. At first a time fuse was fitted through the top of
the tin, and this had to be lighted by the aid of a match, but before
long a detonating fuse was fitted. Matches were scarce and valuable,
and in wind and rain many were wasted before the fuse could be
lighted. These bombs were first issued in very small quantities about
an hour before the attack began on June 4.
On the 25th of May occurred the memorable cloud-burst on Achi
Baba, and in a few moments the nullahs were in spate, the trenches
flooded, and thousands of men soaked to the skin. It was an Act of
God which could not be foreseen or provided against, and the
hardship inflicted upon the troops was very great. For a time the
Krithia Nullah was impassable, and many dead Turks were carried
down. The Lancashire Fusiliers Brigade Headquarters was under four
feet of water for several hours, and the Signal Office was washed
away. One battalion was enjoying beef-steaks in the dug-outs when
a roar of water was heard, and a stream twenty feet wide quickly
filled every dug-out. With British tenacity the men held on to chunks
of bread and of steak as they scrambled for higher ground.
Towards the end of the month the submarine The Submarine
menace developed into a very real danger to the Menace
men-of-war in these waters. The battleship
Triumph was torpedoed on May 25 as she lay at anchor with nets
out, off Anzac. She sank in ten minutes with a loss of ten officers
and sixty-eight men. Two days later, the Majestic, Rear-Admiral
Nicholson’s flagship, lying off Cape Helles, fell a victim to the same
German submarine, and sank in six fathoms. Fortunately all but
forty-eight men were saved. This disaster was witnessed by many of
the Territorials on the beaches and cliffs. As other British and French
battleships were attacked by submarines about the same time, it
became clear that naval co-operation must be dispensed with, or
considerably reduced, as ships at anchor offered too easy a target
for torpedoes.
The Queen Elizabeth had been ordered home on the first hint of
danger, and now all the large ships were sent back to the safety of
Mudros, and the regatta-like gathering at the mouth of the
Dardanelles melted away. The Turk promptly seized the opportunity
for propaganda purposes. An ingeniously worded pamphlet, printed
in English, French, and Hindustani, and dropped from aeroplanes,
notified the invaders that all their battleships and transports had
been destroyed, that the Germans had gained control of the seas,
and that no further supplies need be expected. “Don’t take our word
for it, but see for yourselves. Last week you saw a large fleet of all
kinds of vessels off Cape Helles. Look for it to-day. You have fought
bravely; give yourselves up now to an enemy who respects your
valour and will treat you well.” Tommy laughed. He had got his
rations for the day, and the morrow would take care of itself.
On the 25th of May the designation of the Division was changed,
and as the “42nd (East Lancashire) Division” it took precedence in
numerical order of all other Territorial divisions. The Lancashire
Fusilier Brigade became the 125th Infantry Brigade; the East
Lancashire Brigade the 126th; and the Manchester Brigade the
127th. On May 27 the 126th Brigade was split up among various
battalions of the 29th Division in order to bring those depleted
battalions up to strength pending the arrival of drafts from England.
CHAPTER III
GALLIPOLI
(June 1915—January 1916)

The situation in Gallipoli on the 1st of June, 1915, was


disappointing. Much more had been hoped for than had been
accomplished, and the loss incurred for so small a gain had been
three times as great as the maximum for which the authorities had
made preparation.
After five weeks of toil and struggle, valour and self-sacrifice,
unsurpassed in history, no more had been achieved than the
securing of a mere foothold on the peninsula. Only incurable
“optimists” in England could ignore that fact, but, discouraging
though it was, the prospect would have been less gloomy had there
been any reasonable hope of a steady inflow of drafts to fill the
great gaps in the ranks, and of reinforcements of sufficient strength
to permit a breathing-space to the overworked, worn-out remnants
of the heroic 29th Division. Instead, the Russian collapse under
Hindenburg’s blows in Courland, Galicia and Poland took away all
hope of support from the north and east, and set free Turkish
divisions in the Caucasus and Asia Minor for employment in defence
of the peninsula. Bulgaria, too, was about to join in on the side of
her ancient enemy against her former friends; submarine activity
had become a very real menace to communications and had
deprived the invaders of the support of the heavy naval guns; and
the shortage of shells, especially of high explosive, placed them at a
great disadvantage. The daily allowance was limited to three rounds
per gun, and at times to one round, whereas the French 75’s were
firing continuously.
The Plan of Battle
The casualties of the Mediterranean Expeditionary Force already
numbered 38,600, and though it was calculated that the enemy had
lost at least 55,000 men, the damage done to the defending force
was not in proportion to that received by the invading force in view
of their relative resources. The difficulties had been underestimated,
and the preparations inadequate, and as the present position at
Helles was an impossible one, it was necessary to move forward
and, by repeated assaults, to push the enemy’s lines farther and
farther from the landing-places. With this object in view an attack on
a large scale had been planned for the beginning of the month. As a
preliminary to this Lieut.-General Hunter-Weston, commanding the
8th Army Corps, held a conference at the Corps Headquarters on
May 27, to settle details of an advance along the whole front in order
to bring the first-line trenches within assaulting distance of the
Turkish trenches. By 11.10 p.m. the movement was reported
completed, and the troops were digging themselves in. Casualties
had been few, but next morning it was found that in the darkness
mistakes had been made and the new line was, in places, from 50 to
150 yards in rear of the positions indicated. On the night of May 28-
29 a fresh advance to rectify mistakes was successfully carried out
by the 127th Brigade, but this time the casualty list was much
heavier.

Gallipoli Peninsula

Southern Zone
Map shewing British Trenches and Turkish Front Line
On June 3 orders for the attack were issued. The French objective
was the line of the Kereves Dere Nullah. The first objective of the
8th Army Corps (of which the 42nd Division formed the centre, with
the 29th Division and the Indian Brigade on their left, and the R.N.
Division on the right) was the main line of Turkish trenches, about
200 yards from the British first line. The second objective was the
enemy’s third line.
At 8 a.m. the next morning (June 4) the heavy guns and howitzers
would open the bombardment of certain strong positions. At 11.5
a.m. an intense bombardment of the enemy trenches would begin.
At 11.20 all guns except those on the approach lines would cease
fire, and the infantry would cheer, raise their bayonets above the
parapet, as though about to assault, with the object of inducing the
Turk to occupy his front trenches, which would be heavily
bombarded by all guns and howitzers, the machine-guns firing in
bursts as targets presented themselves. At 12 noon the first line of
infantry would advance, without firing, to the assault of the first
objective, the batteries lifting to range on the trenches farther back.
At 12.15 the second wave would advance, pass through the first
line, and attack the second objective.
Divisional conferences were held at the Headquarters of the 125th
Brigade, and General Douglas issued and explained his orders, and
disposed the troops under his command as follows: First wave—two
battalions of the 127th Brigade consisting of a half-battalion each of
the 7th, 5th, 8th and 6th Manchesters, from right to left in the order
named. The objective for this line was the front line of the Turkish
trenches. A half-battalion of the 5th Lancashire Fusiliers was to
follow in support on the left flank. The second wave consisted of the
remaining half-battalions of the 127th Brigade. Their orders were to
rush through the front line of Turkish trenches and gain the second
objective, which was less than a mile from Krithia. A half-battalion of
the 6th L.F., as working party, and the 1st Field Company, R.E., were
to follow the first wave; the other half-battalion and the 2nd Field
Company were to follow the second wave, to consolidate the lines
gained. All the above troops were under the command of Brig.-
General Noel Lee. The remaining half-battalion of the 5th L.F. was to
form the garrison of the line of trenches held as the firing-line before
the attack. The 9th Manchesters were to occupy the second line,
which was strengthened by redoubts. The 7th and 8th Lancashire
Fusiliers were to be in Divisional Reserve. The 9th Manchesters was
the only battalion of the 126th Brigade acting with the Division, the
4th and 5th East Lancashires and the 10th Manchesters being still
split up among the skeleton battalions of the 29th Division.
The bombardment that opened at 8 a.m. on Battle of June 4,
June 4 was the heaviest and most prolonged that 1915
the peninsula had witnessed. At 11 a.m. every
available gun both on land and sea was firing, including six batteries
of four guns each of the famous 75’s, generously lent by the French
Commander. These were firing high-explosive shell. The whole
Turkish line was enveloped in smoke, and it seemed impossible that
any positions could withstand its fury. The village of Krithia and,
indeed, the whole of the hillside appeared to be a mass of flame and
dust. The plan to cease fire on the front trenches at 11.20 a.m. had
the effect intended, and the enemy prepared to meet the expected
assault. A hail of bullets swept over the trenches of the 127th
Brigade, and a few moments later the renewal of the bombardment
caught the Turks as they were manning the trenches or hastening
through the communication trenches to reinforce their thinly held
front line.
The last half-hour of waiting was a severe test of nerves, and it
was a relief both to the imaginative and the stolid when the hour of
noon arrived. But the Manchesters had already been proved. The
operations of the end of May, the digging in No Man’s Land to push
the first line closer to the enemy, while the Turk knew perfectly well
what was intended and had been able, by the light of a waxing
moon, to thin out the working-parties, had been highly dangerous
and trying to the nerves. The losses had been deplorable, but the
will to overcome the difficulties and to face the dangers with
resolution had prevailed, and had given officers, N.C.O.s and men
confidence in one another. Each platoon, each company, knew that it
would not let the others down when the big event should come off.
And now the hour had struck. Promptly at twelve o’clock the leading
wave of the 127th Brigade went over the top for the first time, and
advanced steadily and in good order. They were met by devastating
rifle and machine-gun fire, but those who escaped the bullets
pressed on in a steady line and by bitter hand-to-hand fighting made
good their first objective. In places the wire was untouched by the
bombardment, and men died cutting it that their comrades might
pass through. The second wave followed at the appointed time.
Within five minutes the Turkish first-line trenches had been
captured, and the second in half an hour, and during the afternoon
the fourth line of Turkish trenches had been penetrated. Sappers
accompanying the successive waves found and disconnected buried
mines, and assisted in the construction of new trenches and the
reversal of captured ones. On the left the 29th Division had seized
their first objective, but their further advance was checked, as the
barbed wire on their left remained undamaged, and the Indian
Brigade was held up by this obstacle. The professional soldiers of
this division paid generous tribute to the amateurs of the 4th and
5th East Lancashires and 10th Manchesters, who fought with such
spirit and determination within their ranks.
On the right, however, an initial success was soon followed by a
reverse which had disastrous consequences. The R.N. Division had
gone forward with a dash that did credit to these young untrained
soldiers, and with a considerable measure of success. On their right
the French had rushed a formidable redoubt, called from its shape
“the Haricot,” but unfortunately their colonial troops, magnificent in
attack, lack the confidence and dogged resolution in adversity that
characterize our “native” troops from the Punjab and Nepal. They
gave way before a furious bombardment and counter-attack, and the
Haricot, once more in Turkish possession, proved a fatal obstacle.
With their right flank exposed to the concentrated fire of
innumerable machine-guns the Naval Division, cruelly reduced in
numbers—one brigade losing sixty officers—were compelled to fall
back to their original line, leaving the right flank of the 42nd Division
in the air, the gap being 300 yards from front to rear. The Turk
possesses individual initiative and resource in full measure, and he
was quick to take advantage of the situation. Also, he was amply
provided with bombs, whereas at this date our men had none—a
serious handicap in close fighting. His bombing parties began to eat
their way into this flank, which was also enfiladed by rifle and
machine-gun fire, and in spite of the most determined opposition of
the Manchesters, of the L.F. who were in support, and of a party of
Engineers under Lieutenant Oscar Taunton, who threw back the
enemy’s grenades until wounded, the position became critical.
In the meantime the 7th Lancashire Fusiliers had been moved up
to the old fire trenches when these were vacated by the second
wave, and at 2.45 p.m. two companies of the 8th L.F. were sent to
fill the gap between the right of the 127th Brigade and the R.N.
Division. At 3.35 p.m. it was seen that the enemy was massing
troops in a nullah on this flank, seriously threatening the foremost
line. The French Commander had, however, promised to make a
fresh attack on the Haricot at 4 p.m., and this, by enabling the R.N.
Division to advance, should relieve the pressure. Our Allies were
unable, however, to make this attack, and the position of the 7th
Manchesters on the right becoming quite untenable, the Divisional
Commander, after consulting the Corps Commander, at 6.30 p.m.
ordered the withdrawal of the foremost line to the main Turkish
trench. The retirement was made with the greatest reluctance;
indeed, the few remaining officers had great difficulty in making the
men realize that the order to withdraw must be obeyed. The idea of
giving up the ground they had won was almost unbearable, for the
four Manchester battalions had resolved to hold on to their gains,
whatever the cost might be. “C” Company of the 6th Manchesters
had penetrated to a considerable distance beyond the bifurcation of
the nullahs, but, being enfiladed from the higher ground on the
right, found it impossible to retire. Its commander, Captain H. B.
Pilkington, was mortally wounded in the head, but, propped up in
the trench, he continued to direct and encourage his men. The
company was practically wiped out.
The cost had indeed been great. Of the 770 men of the 6th
Manchesters only 160 answered to the roll-call that night. A
company of the 8th Manchesters which at noon leapt out of the
trenches nearly 200 strong, could only muster 18, and from the
other units there were similar reports. Early in the afternoon Brig.-
General Noel Lee had received a shell-wound in the throat from
which he died on June 21 in hospital at Malta. When he fell, Lieut.-
Colonel Heys, 8th Manchesters, assumed command, until, an hour
later, he was compelled to return to his battalion, as hardly any of its
officers were left; and he was killed soon after he rejoined. The last
remaining officer of this battalion, Captain Oldfield, was killed shortly
after he had organized the withdrawal of the battalion. Lieut.-Colonel
Lord Rochdale, 6th Lancashire Fusiliers, was ordered to succeed
Colonel Heys, and he remained in temporary command of the 127th
Brigade until June 21. The 7th Manchesters had also lost their C.O.,
Major Staveacre, who had succeeded to the command of the
battalion on May 28, when Lieut.-Colonel Gresham was invalided to
Malta.
The work of the Battalion Medical Officers and stretcher-bearers
was beyond praise, but what can be said of the grit of the wounded!
One M.O. records that from the 120 men who passed through his
Regimental Aid Post, many being badly wounded and obviously in
great pain, he did not hear even a whimper. Much difficulty was
experienced in getting the wounded down the crowded and battered
trenches and communication ways. The advanced Dressing Station
of the 3rd Field Ambulance was in the Achi Baba Nullah, half a mile
above Backhouse Post; that of the 1st Field Ambulance was at
Clapham Junction. It was a rough journey for wounded men from
either of these posts to the Central Clearing Station on “W” Beach;
only hand carriage was available for those who could not walk, and
there were many casualties among the bearers, though they were
not fired upon deliberately. The wounded could not be attended to
quickly enough to prevent a line of stretcher cases, waiting to be
dressed, forming outside the stations.
The Territorials had proved themselves in the Division’s first
pitched battle, not merely with credit, but with distinction. Though
the assaulting waves had been exposed to converging fire from
higher ground on either flank their attack had been brilliantly
successful. At the end of the day the front had only been advanced
by 400 yards, yet the Manchesters had gained 1000 yards, and could
have advanced still farther. Indeed, there can be little doubt that the
Turkish centre had been pierced, and that, had not the troops on
their right been compelled to fall back, or had there been reserves to
bring forward, they would have seized the high ground behind the
village of Krithia, the key to the Achi Baba position. The Division had
captured 217 prisoners, including 11 officers.
The 5th of June was mainly given over to the consolidation of the
front to meet the expected counter-attack. On the evening of the
5th the first line was still held by the 127th Brigade, but during the
night part of it was relieved by the 125th Brigade. There were two
weak points—

(1) A pronounced salient where the right of the 42nd Division


linked with the left of the R.N. Division. A strong work
was in process of formation to strengthen this.
(2) The ground between the Vineyard and the right branch of
the Krithia Nullah had many facilities for bringing enfilade
and reverse fire to bear on our line. This became the
scene of the hardest fighting.

At 3.45 a.m. on the 6th the enemy began to Turkish Counter-


shell our line: at 4.25 a.m. strong bodies of Turks attacks, June 6,
were working their way down the Krithia nullahs. 1915
At the same time an attack was delivered on the trenches held by
the 8th Manchesters, but this unit had just been reinforced by three
platoons of the 7th Lancashire Fusiliers, and the attack was easily
repulsed. Some Turks succeeded in getting part of the trench held
by the 5th Manchesters, but were driven out again by the combined
action of the 5th Manchesters and the 5th Lancashire Fusiliers. At
6.20 a.m. the 88th Brigade, on the left, were obliged to fall back
slightly, and as this exposed the left flank of the 5th L.F., they were
forced to fall back below the bifurcation of the nullahs. Here they
were reinforced by a weak company of the 7th Lancashire Fusiliers.
Bombing attacks and bayonet charges continued throughout the
morning, and reserves were brought into the front lines until the
Divisional Reserve consisted of only 60 men of the 7th L.F. Casualties
were heavy, Lieut.-Colonel Fallows of the 8th L.F., and his second-in-
command, Major Baddeley, being among the killed. The three
battalions of the 126th Brigade should have rejoined the Division on
the 5th, but they, too, had been fiercely attacked, and, though
suffering severely, were upholding the credit of the Lancashire
Territorials. As the 29th Division could not spare any of these three
battalions, the Chatham Battalion of the R.N. Division was attached
to the 42nd Division at noon on the 6th, and held in reserve.
By 1 p.m. the situation had improved, and the number of Turks in
and around the nullahs had greatly diminished. The 5th and 7th L.F.
were now ordered to take the offensive; the small redoubt near to
the bifurcation of nullahs, which had been captured by the enemy,
was attacked and retaken. By the evening of the 6th the enemy’s
attack, which had been made in great strength and with much
bravery, had been repulsed. His losses had been considerable, and
his only gain was the small indentation by the Krithia Nullah. For
three days the fight had raged without intermission. Worn-out,
hungry, thirsty, sleepless men had fought and dug and fought again
until the line had been firmly established and held by the physically
exhausted remnants; and the battalions that had suffered most had
time to rest and lick their wounds.
On June 7 counter-operations were undertaken after dark with the
object of straightening the line from the Vineyard towards the
nullah. The attack was divided into three parts, the right being
entrusted to 100 men of the 9th Manchesters, and 20 men of the 1st
Field Company; the centre and left each to a company of the
Chatham Battalion. The 9th Manchesters succeeded, but the left and
centre failed to attain their objective. On the night of June 8-9 the
127th Brigade was withdrawn to Corps Reserve, and its place in the
firing-line taken by the 126th Brigade, the three detached battalions
having rejoined.
The casualties in the 42nd Division during the four weeks
amounted to—

Killed. Wounded. Missing.


Officers 68 121 6
Other ranks 610 2691 688
678 2812 694
Total, 4184.

In his Official Despatch, General Sir Ian Hamilton made special


mention of the part taken by the 42nd Division in the action of the
past few days.

“The Manchester Brigade of 42nd Division advanced


magnificently. In five minutes the first line of Turkish trenches
was captured, and by 12.30 p.m. the Brigade had carried with
a rush the line forming their second objective, having made
an advance of 600 yards in all. The working parties got to
work without incident, and the position here could not
possibly have been better.”

After describing the withdrawal of the R.N. Division, Sir Ian


proceeds—

“The question was now whether this rolling up of the newly


captured line from the right would continue until the whole of
our gains were wiped out. It looked very like it, for now the
enfilade fire of the Turks began to fall upon the Manchester
Brigade of the 42nd Division, which was firmly consolidating
the furthest distant line of trenches it had so brilliantly won.
After 1.30 p.m. it became increasingly difficult for this gallant
Brigade to hold its ground. Heavy casualties occurred; the
Brigadier and many other officers were wounded or killed; yet
it continued to hold out with tenacity and grit. Every effort
was made to sustain the Brigade in its position. Its right flank
was thrown back to make face against the enfilade fire, and
reinforcements were sent to try and fill the diagonal gap
between it and the Royal Naval Division.... By 6.30 p.m.,
therefore, the 42nd Division had to be extricated with loss
from the second line Turkish trenches, and had to content
themselves with consolidating on the first line which they had
captured within five minutes of commencing the attack. Such
was the spirit displayed by this Brigade that there was great
difficulty in persuading the men to fall back. Had their flanks
been covered nothing would have made them loosen their
grip.”

In a private letter from Sir Ian Hamilton to the Divisional


Commander the following sentence occurs: “As a matter of fact I
never saw any finer piece of work than that performed by the
Manchesters that day.”
Later on the evening of June 4 this message Appreciation
from the Divisional Commander was conveyed to
all ranks—

The following message from Lieut.-General A. G. Hunter-


Weston, C.B., D.S.O., received at 8.33 p.m. on June 4, is
published for information—
“Please express to the 42nd Division, and particularly to the
127th Brigade, my appreciation of the magnificent work done
by them to-day. The 127th Brigade attacked with gallantry,
and held on to the objective ordered with tenacity. It was a
very fine performance. Please convey this to all the troops of
the Division when possible, and tell them that I deeply
appreciate their gallant conduct and devotion to their duty.
The renown they have gained for the Division will not only
reach the ears of all in Lancashire, but throughout the British
Empire. I feel sure that the same tenacity will be maintained
to-night and throughout the Campaign.”

On the night of June 12-13 the 127th Brigade embarked for a


period of rest and reorganization on the island of Imbros. Any who
fondly imagined that the term “rest” implied a period of repose and
pleasant recreation were soon disillusioned, for fatigue parties were
much in request at the Imbros base, and guards had to be provided
for the various stores. While there, the men were inspected and
addressed by the Commander-in-Chief, who assured them of his
appreciation of the Brigade’s gallantry on June 4. Its place in the line
was taken by the 155th Brigade, which with the 156th Brigade had
arrived at Helles in advance of the Headquarters of the 52nd
(Lowland Territorial) Division. When the 127th Brigade returned on
June 22 and 23, Brig.-General the Hon. H. A. Lawrence (later Chief
of the General Staff in France) took over the command. The 5th and
6th Lancashire Fusiliers and the 10th Manchesters next had their
period of rest; the first-named at Mudros and the others at Imbros.
When they returned on July 9 and 10, the 7th and 8th Lancashire
Fusiliers and the 5th East Lancashires took their turns, the Fusiliers’
period of recuperation being cut down to four days. On July 13 Brig.-
General Viscount Hampden assumed command of the 126th Brigade.
Though there were many minor operations during June and July
no action on a large scale took place after June 8 on the divisional
front. Enemy activity was kept down by local counter-attacks and
bomb-raids. In one of the former the 126th Brigade’s attack between
the Vineyard and Krithia Nullah on June 18 was anticipated by the
enemy, and the 10th Manchesters suffered severely. The first trench
raid of the Division was made about this time. Lieutenant Bennett
Burleigh, 7th L.F., with six volunteers, crawled up an old
communication trench and bombed a small redoubt held by Turkish
snipers. The party returned without a scratch, though several men of
the 8th L.F., who were giving supporting fire, were killed or
wounded. This raid was the more notable in that it took place an
hour before noon, and, as was hoped, the Turk was caught asleep.
On July 2, the same officer (who was killed in action a few days
later) accompanied by two men, went out twice by daylight and
once after dark along the Turkish communication trench which ran
through the Vineyard, and brought back valuable information. On
the 5th the 7th Manchesters helped to repulse a fierce attack on the
29th Division on their left, and the battalion wiped out about 150 of
the enemy. On the night of the 10th, Lieutenant O. J. Sutton and
Sergeant Grantham, both of the 9th Manchesters, made a daring
and successful reconnaissance of a new Turkish trench, and on the
following night went out again and ascertained by measurement its
exact position.
About the middle of the month the first Monitors arrived, each
carrying two huge guns, and before long other strange marine
objects appeared—the “blister ships” and the “beetles.” The former
were cruisers which even at anchor could ignore the submarine
menace, and the latter were motor-lighters with a drawbridge at the
bows, and they could carry 500 men to the landings, protected from
bullets and shrapnel by the iron decks and sides. The need for such
protection increased with the daily evidence of the enemy’s
improved supplies of guns and ammunition. On one morning seven
hundred shells dropped on Lancashire Landing alone. On July 23 the
Division had been reinforced by 47 officers and 1500 other ranks
from the second line in England, but these did not nearly make good
the losses. The 18th Battery, R.F.A., and the 1/4th E. Lancs
(Cumberland and Westmorland) Howitzer Brigade had also arrived
from Egypt during the month, and with them Brig.-General A. D’A.
King, D.S.O., who was given the command of all artillery in the right-
half sector of the Corps. The 5th Battery under Major Browning, and
the two guns of the 6th Battery had been continuously in action, and
had firmly established the credit of the Territorial Artillery. On July 24
Major-General Douglas had assumed temporary command of the 8th
Corps until August 8, the command of the Division during that period
being taken by Major-General W. R. Marshall.
On August 6 the period of comparative inactivity Battle of the
came to an end. The primary purpose of the Vineyard, August
Gallipoli campaign was to obtain possession of the 6-7, 1915
Narrows, and thus secure command of the Dardanelles and cut off
communication with the Asiatic shore. It had been hoped to achieve
this by pushing forward from the south, but the original force had
been far too small for the purpose. During May, June and July the
Turkish garrison had been much increased, and also the supply of
guns and shells, and the defences on Achi Baba greatly and most
ably strengthened, whereas the British reinforcements and drafts to
fill the gaps had been relatively small. There was little prospect of
success by a frontal assault from Helles, and the loss that would be
incurred by a futile attempt would cripple the Allies and remove all
chance of ultimate success. The Commander-in-Chief decided upon
an attempt to reach the Narrows at Maidos, five miles across the
peninsula from Anzac, the formidable Sari Bair range intervening. A
new landing was to be made on August 6 and 7 at Suvla Bay, a few
miles to the north of Anzac cove, and it was hoped that the force
landed here would seize the northern slopes of the Sari Bair range,
while the troops from Anzac would storm the central and southern
heights. On August 6 an attack was to be made from the right of
Anzac in order to divert attention from both the landing and the true
objective; and a vigorous offensive was ordered at Helles, with the
object of containing as large a Turkish force as possible within the
southern area and of drawing their reserves from the north. There
appeared to be good prospects of a decisive success, and hopes
were high.
The line of trenches from the Achi Baba Nullah to the Krithia
Nullah (both inclusive) was held by the 125th Brigade on the right
and the 127th on the left, the 126th being in reserve. The French
were on the right of the 125th Brigade and the 29th Division on the
left of the 127th. The 5th Manchesters, who were acting in
conjunction with the 88th Brigade (29th Division) had for objective a
Turkish trench on the right of that Brigade. The bombardment began
at 2.30 p.m. on the 6th, and soon H.E. shells could be seen bursting
in the trench which the 5th had been ordered to take. At 3.50 p.m.
they attacked, but on reaching the objective, found that they had
been enticed into a dummy trench, without cover, and exposed to
enfilade fire. To prevent the right flank of the 29th Division being left
“in the air,” Captain Fawcus, commanding the first line of the 7th
Manchesters, was ordered, about 8 p.m., to get into touch. Arriving
at a trench which he expected to find occupied by the 88th Brigade,
he called out: “Are the Worcesters there?” and was heavily fired
upon. Moving to the left he still found the enemy in occupation of
the trench, and fell back. On his way to rejoin the second line he
came across a small party of the Worcesters and took them with
him. The two lines regained the firing-line in the small hours of the
morning, having lost 40 men out of 200. That Captain Fawcus
returned safely was amazing, his clothes being riddled with bullets.
A few hours later the Battle of the Vineyard began, the
bombardment by British and French batteries opening at 8.10 a.m.,
and increasing in intensity at nine o’clock when the naval guns
joined in. The fire on the trenches south-east of Krithia Nullah was
both heavy and accurate, but the trenches within the triangle formed
by the fork of the nullahs suffered but little. Half a battalion of the
126th Brigade was attached to the 125th Brigade on the right, and
another half-battalion to the 127th Brigade on the left. One battalion
of the 126th Brigade was to hold the original line. Two batteries of
machine-guns assisted by bringing a cross fire to bear on the
enemy’s trenches.
At 9.40 a.m., the troops went forward with their usual dash,
wearing tin back-plates that could be seen by the artillery “spotters.”
On the right the Lancashire Fusiliers gained their first objective, but
the 5th and 8th found that their portion was merely a very shallow
trench raked by enfilade fire. Parties of the 6th and 7th reached their
second objective, but enfilade fire and superior numbers compelled
them to fall back. One of the few officers to reach this objective was
Major W. J. Law, 7th Lancashire Fusiliers, who took part in all the
subsequent fighting in the Vineyard. Soon after 11 a.m. portions of
the first objective were retaken by a strong Turkish counter-attack,
but the Vineyard remained in our hands. The 5th and 7th L.F. made
a gallant effort to recover what had been lost and were partially
successful. At 1.30 p.m. another enemy counter-attack in close
formation was caught by our guns and brought to a standstill. The
Turks suffered severely in counter-attacks upon the Vineyard, and for
some hours gave up the attempt in this quarter, but resumed it late
at night with no more success. The 5th and 8th L.F. reoccupied a
portion of their first objective in the evening. Parties of the 4th East
Lancashires and 10th Manchesters gave great assistance both in
attack and defence. On the left the Manchesters showed similar dash
and determination, but owing to the greater difficulties of the
ground between and about the nullahs and to the intricacy of the
Turkish trench system, which, with the nests of machine-guns, had
escaped our shells, they were unable to hold any of the trenches
taken in the initial assault, and their losses were grievous, the
attacking lines being mown down by the enemy’s machine-guns.
The casualties during the two days were—

Officers. Other Ranks.


Killed 20 203
Wounded 36 770
Missing 24 511

The result was that a tactical point of some importance had been
won and held by the tenacity of the 125th Brigade, and that a large
Turkish force had been pinned down when urgently needed in the
north. The Turks had, indeed, been massing troops in front of the
Division as they had intended to attack our lines in force, on the 6th
or 7th of August. Sir Ian Hamilton telegraphed to the Corps
Commander: “Your operations have been invaluable, and have given
the Northern Corps the greatest possible help by drawing the main

You might also like