blob: f0f2ed9bc769de943d4b46e1823ec42436da96a0 [file] [log] [blame]
<html lang="en">
<head>
<title>Statements - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Syntax.html#Syntax" title="Syntax">
<link rel="prev" href="Symbol-Intro.html#Symbol-Intro" title="Symbol Intro">
<link rel="next" href="Constants.html#Constants" title="Constants">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Statements"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Constants.html#Constants">Constants</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Symbol-Intro.html#Symbol-Intro">Symbol Intro</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Syntax.html#Syntax">Syntax</a>
<hr>
</div>
<h3 class="section">3.5 Statements</h3>
<p><a name="index-statements_002c-structure-of-132"></a><a name="index-line-separator-character-133"></a><a name="index-statement-separator-character-134"></a>
A <dfn>statement</dfn> ends at a newline character (&lsquo;<samp><span class="samp">\n</span></samp>&rsquo;) or a
<dfn>line separator character</dfn>. The line separator character is target
specific and described in the <em>Syntax</em> section of each
target's documentation. Not all targets support a line separator character.
The newline or line separator character is considered to be part of the
preceding statement. Newlines and separators within character constants are an
exception: they do not end statements.
<p><a name="index-newline_002c-required-at-file-end-135"></a><a name="index-EOF_002c-newline-must-precede-136"></a>It is an error to end any statement with end-of-file: the last
character of any input file should be a newline.
<p>An empty statement is allowed, and may include whitespace. It is ignored.
<p><a name="index-instructions-and-directives-137"></a><a name="index-directives-and-instructions-138"></a><!-- "key symbol" is not used elsewhere in the document; seems pedantic to -->
<!-- @defn{} it in that case, as was done previously... doc@cygnus.com, -->
<!-- 13feb91. -->
A statement begins with zero or more labels, optionally followed by a
key symbol which determines what kind of statement it is. The key
symbol determines the syntax of the rest of the statement. If the
symbol begins with a dot &lsquo;<samp><span class="samp">.</span></samp>&rsquo; then the statement is an assembler
directive: typically valid for any computer. If the symbol begins with
a letter the statement is an assembly language <dfn>instruction</dfn>: it
assembles into a machine language instruction.
Different versions of <samp><span class="command">as</span></samp> for different computers
recognize different instructions. In fact, the same symbol may
represent a different instruction in a different computer's assembly
language.
<p><a name="index-g_t_0040code_007b_003a_007d-_0028label_0029-139"></a><a name="index-label-_0028_0040code_007b_003a_007d_0029-140"></a>A label is a symbol immediately followed by a colon (<code>:</code>).
Whitespace before a label or after a colon is permitted, but you may not
have whitespace between a label's symbol and its colon. See <a href="Labels.html#Labels">Labels</a>.
<p>For HPPA targets, labels need not be immediately followed by a colon, but
the definition of a label must begin in column zero. This also implies that
only one label may be defined on each line.
<pre class="smallexample"> label: .directive followed by something
another_label: # This is an empty statement.
instruction operand_1, operand_2, ...
</pre>
</body></html>