blob: bb63620c98a7e0ceb0590e9b714f495e3f15b0d9 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This file documents the GNU Assembler "as".
Copyright (C) 1991-2013 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".
-->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Using as: Statements</title>
<meta name="description" content="Using as: Statements">
<meta name="keywords" content="Using as: Statements">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Syntax.html#Syntax" rel="up" title="Syntax">
<link href="Constants.html#Constants" rel="next" title="Constants">
<link href="Symbol-Intro.html#Symbol-Intro" rel="prev" title="Symbol Intro">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Statements"></a>
<div class="header">
<p>
Next: <a href="Constants.html#Constants" accesskey="n" rel="next">Constants</a>, Previous: <a href="Symbol-Intro.html#Symbol-Intro" accesskey="p" rel="prev">Symbol Intro</a>, Up: <a href="Syntax.html#Syntax" accesskey="u" rel="up">Syntax</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Statements-1"></a>
<h3 class="section">3.5 Statements</h3>
<a name="index-statements_002c-structure-of"></a>
<a name="index-line-separator-character"></a>
<a name="index-statement-separator-character"></a>
<p>A <em>statement</em> ends at a newline character (&lsquo;<samp>\n</samp>&rsquo;) or a
<em>line separator character</em>. The line separator character is target
specific and described in the <em>Syntax</em> section of each
target&rsquo;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"></a>
<a name="index-EOF_002c-newline-must-precede"></a>
<p>It is an error to end any statement with end-of-file: the last
character of any input file should be a newline.
</p>
<p>An empty statement is allowed, and may include whitespace. It is ignored.
</p>
<a name="index-instructions-and-directives"></a>
<a name="index-directives-and-instructions"></a>
<p>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>.</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 <em>instruction</em>: it
assembles into a machine language instruction.
Different versions of <code>as</code> for different computers
recognize different instructions. In fact, the same symbol may
represent a different instruction in a different computer&rsquo;s assembly
language.
</p>
<a name="index-_003a-_0028label_0029"></a>
<a name="index-label-_0028_003a_0029"></a>
<p>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&rsquo;s symbol and its colon. See <a href="Labels.html#Labels">Labels</a>.
</p>
<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.
</p>
<div class="smallexample">
<pre class="smallexample">label: .directive followed by something
another_label: # This is an empty statement.
instruction operand_1, operand_2, &hellip;
</pre></div>
<hr>
<div class="header">
<p>
Next: <a href="Constants.html#Constants" accesskey="n" rel="next">Constants</a>, Previous: <a href="Symbol-Intro.html#Symbol-Intro" accesskey="p" rel="prev">Symbol Intro</a>, Up: <a href="Syntax.html#Syntax" accesskey="u" rel="up">Syntax</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>