blob: 4a6159f7d4c07f3c9a1a3ee271f9b7e0d78e06ab [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, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2006, 2007, 2008, 2009, 2010 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>
<link rel="stylesheet" type="text/css" href="../cs.css">
</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-130"></a><a name="index-line-separator-character-131"></a><a name="index-statement-separator-character-132"></a>A <dfn>statement</dfn> ends at a newline character (&lsquo;<samp><span class="samp">\n</span></samp>&rsquo;) or line
separator character. (The line separator is usually &lsquo;<samp><span class="samp">;</span></samp>&rsquo;, unless this
conflicts with the comment character; see <a href="Machine-Dependencies.html#Machine-Dependencies">Machine Dependencies</a>.) The
newline or separator character is considered 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-133"></a><a name="index-EOF_002c-newline-must-precede-134"></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-135"></a><a name="index-directives-and-instructions-136"></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-137"></a><a name="index-label-_0028_0040code_007b_003a_007d_0029-138"></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>