1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- This file documents the GNU Assembler "as". 4 5Copyright (C) 1991-2021 Free Software Foundation, Inc. 6 7Permission is granted to copy, distribute and/or modify this document 8under the terms of the GNU Free Documentation License, Version 1.3 9or any later version published by the Free Software Foundation; 10with no Invariant Sections, with no Front-Cover Texts, and with no 11Back-Cover Texts. A copy of the license is included in the 12section entitled "GNU Free Documentation License". 13 --> 14<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 15<head> 16<title>Using as: Statements</title> 17 18<meta name="description" content="Using as: Statements"> 19<meta name="keywords" content="Using as: Statements"> 20<meta name="resource-type" content="document"> 21<meta name="distribution" content="global"> 22<meta name="Generator" content="makeinfo"> 23<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 24<link href="index.html#Top" rel="start" title="Top"> 25<link href="AS-Index.html#AS-Index" rel="index" title="AS Index"> 26<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 27<link href="Syntax.html#Syntax" rel="up" title="Syntax"> 28<link href="Constants.html#Constants" rel="next" title="Constants"> 29<link href="Symbol-Intro.html#Symbol-Intro" rel="previous" title="Symbol Intro"> 30<style type="text/css"> 31<!-- 32a.summary-letter {text-decoration: none} 33blockquote.smallquotation {font-size: smaller} 34div.display {margin-left: 3.2em} 35div.example {margin-left: 3.2em} 36div.indentedblock {margin-left: 3.2em} 37div.lisp {margin-left: 3.2em} 38div.smalldisplay {margin-left: 3.2em} 39div.smallexample {margin-left: 3.2em} 40div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 41div.smalllisp {margin-left: 3.2em} 42kbd {font-style:oblique} 43pre.display {font-family: inherit} 44pre.format {font-family: inherit} 45pre.menu-comment {font-family: serif} 46pre.menu-preformatted {font-family: serif} 47pre.smalldisplay {font-family: inherit; font-size: smaller} 48pre.smallexample {font-size: smaller} 49pre.smallformat {font-family: inherit; font-size: smaller} 50pre.smalllisp {font-size: smaller} 51span.nocodebreak {white-space:nowrap} 52span.nolinebreak {white-space:nowrap} 53span.roman {font-family:serif; font-weight:normal} 54span.sansserif {font-family:sans-serif; font-weight:normal} 55ul.no-bullet {list-style: none} 56--> 57</style> 58 59 60</head> 61 62<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 63<a name="Statements"></a> 64<div class="header"> 65<p> 66Next: <a href="Constants.html#Constants" accesskey="n" rel="next">Constants</a>, Previous: <a href="Symbol-Intro.html#Symbol-Intro" accesskey="p" rel="previous">Symbol Intro</a>, Up: <a href="Syntax.html#Syntax" accesskey="u" rel="up">Syntax</a> [<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> 67</div> 68<hr> 69<a name="Statements-1"></a> 70<h3 class="section">3.5 Statements</h3> 71 72<a name="index-statements_002c-structure-of"></a> 73<a name="index-line-separator-character"></a> 74<a name="index-statement-separator-character"></a> 75 76<p>A <em>statement</em> ends at a newline character (‘<samp>\n</samp>’) or a 77<em>line separator character</em>. The line separator character is target 78specific and described in the <em>Syntax</em> section of each 79target’s documentation. Not all targets support a line separator character. 80The newline or line separator character is considered to be part of the 81preceding statement. Newlines and separators within character constants are an 82exception: they do not end statements. 83</p> 84<a name="index-newline_002c-required-at-file-end"></a> 85<a name="index-EOF_002c-newline-must-precede"></a> 86<p>It is an error to end any statement with end-of-file: the last 87character of any input file should be a newline. 88</p> 89<p>An empty statement is allowed, and may include whitespace. It is ignored. 90</p> 91<a name="index-instructions-and-directives"></a> 92<a name="index-directives-and-instructions"></a> 93<p>A statement begins with zero or more labels, optionally followed by a 94key symbol which determines what kind of statement it is. The key 95symbol determines the syntax of the rest of the statement. If the 96symbol begins with a dot ‘<samp>.</samp>’ then the statement is an assembler 97directive: typically valid for any computer. If the symbol begins with 98a letter the statement is an assembly language <em>instruction</em>: it 99assembles into a machine language instruction. 100Different versions of <code>as</code> for different computers 101recognize different instructions. In fact, the same symbol may 102represent a different instruction in a different computer’s assembly 103language. 104</p> 105<a name="index-_003a-_0028label_0029"></a> 106<a name="index-label-_0028_003a_0029"></a> 107<p>A label is a symbol immediately followed by a colon (<code>:</code>). 108Whitespace before a label or after a colon is permitted, but you may not 109have whitespace between a label’s symbol and its colon. See <a href="Labels.html#Labels">Labels</a>. 110</p> 111<p>For HPPA targets, labels need not be immediately followed by a colon, but 112the definition of a label must begin in column zero. This also implies that 113only one label may be defined on each line. 114</p> 115<div class="smallexample"> 116<pre class="smallexample">label: .directive followed by something 117another_label: # This is an empty statement. 118 instruction operand_1, operand_2, … 119</pre></div> 120 121<hr> 122<div class="header"> 123<p> 124Next: <a href="Constants.html#Constants" accesskey="n" rel="next">Constants</a>, Previous: <a href="Symbol-Intro.html#Symbol-Intro" accesskey="p" rel="previous">Symbol Intro</a>, Up: <a href="Syntax.html#Syntax" accesskey="u" rel="up">Syntax</a> [<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> 125</div> 126 127 128 129</body> 130</html> 131