| 1 | <?xml version="1.0" encoding="utf-8"?> |
|---|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
|---|
| 3 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|---|
| 4 | |
|---|
| 5 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
|---|
| 6 | |
|---|
| 7 | <head> |
|---|
| 8 | <meta http-equiv="content-type" content="application/xml+xhtml; charset=utf-8" /> |
|---|
| 9 | <title>Logtalk reference manual: grammar</title> |
|---|
| 10 | <link rel="stylesheet" href="../screen.css" type="text/css" media="screen"/> |
|---|
| 11 | <link rel="stylesheet" href="../print.css" type="text/css" media="print"/> |
|---|
| 12 | </head> |
|---|
| 13 | |
|---|
| 14 | <body> |
|---|
| 15 | |
|---|
| 16 | <div class="top-left">Logtalk reference manual</div> |
|---|
| 17 | <div class="top-right">Grammar</div> |
|---|
| 18 | <div class="bottom-left"><span class="page"/></div> |
|---|
| 19 | <div class="bottom-right"><span class="page"/></div> |
|---|
| 20 | <div class="navtop"><a href="../index.html">Contents</a> > <a href="index.html">Reference Manual</a> > Grammar</div> |
|---|
| 21 | |
|---|
| 22 | <h1 id="grammar_grammar">Grammar</h1> |
|---|
| 23 | |
|---|
| 24 | <p> |
|---|
| 25 | The Logtalk grammar is here described using Backus-Naur Form syntax. Non-terminal symbols in <i>italics</i> have the definition found in the ISO Prolog Standard. Terminal symbols are represented in a <code>fixed width font</code> and between "". |
|---|
| 26 | </p> |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | <h2 id="grammar_compilation_units">Compilation units</h2> |
|---|
| 30 | |
|---|
| 31 | <dl> |
|---|
| 32 | <dt>entity ::=</dt> |
|---|
| 33 | <dd>object |</dd> |
|---|
| 34 | <dd>category |</dd> |
|---|
| 35 | <dd>protocol</dd> |
|---|
| 36 | </dl> |
|---|
| 37 | |
|---|
| 38 | <h2 id="grammar_object_definition">Object definition</h2> |
|---|
| 39 | |
|---|
| 40 | <dl> |
|---|
| 41 | <dt>object ::=</dt> |
|---|
| 42 | <dd>begin_object_directive [object_directives] [clauses] end_object_directive.</dd> |
|---|
| 43 | </dl> |
|---|
| 44 | <dl> |
|---|
| 45 | <dt>begin_object_directive ::=</dt> |
|---|
| 46 | <dd>"<code>:- object(</code>" object_identifier [ "<code>,</code>" object_relations] "<code>).</code>"</dd> |
|---|
| 47 | </dl> |
|---|
| 48 | <dl> |
|---|
| 49 | <dt>end_object_directive ::=</dt> |
|---|
| 50 | <dd>"<code>:- end_object.</code>"</dd> |
|---|
| 51 | </dl> |
|---|
| 52 | <dl> |
|---|
| 53 | <dt>object_relations ::=</dt> |
|---|
| 54 | <dd>prototype_relations |</dd> |
|---|
| 55 | <dd>non_prototype_relations</dd> |
|---|
| 56 | </dl> |
|---|
| 57 | <dl> |
|---|
| 58 | <dt>prototype_relations ::=</dt> |
|---|
| 59 | <dd>prototype_relation |</dd> |
|---|
| 60 | <dd>prototype_relation "<code>,</code>" prototype_relations</dd> |
|---|
| 61 | </dl> |
|---|
| 62 | <dl> |
|---|
| 63 | <dt>prototype_relation ::=</dt> |
|---|
| 64 | <dd>implements_protocols |</dd> |
|---|
| 65 | <dd>imports_categories |</dd> |
|---|
| 66 | <dd>extends_objects</dd> |
|---|
| 67 | </dl> |
|---|
| 68 | <dl> |
|---|
| 69 | <dt>non_prototype_relations ::=</dt> |
|---|
| 70 | <dd>non_prototype_relation |</dd> |
|---|
| 71 | <dd>non_prototype_relation "<code>,</code>" non_prototype_relations</dd> |
|---|
| 72 | </dl> |
|---|
| 73 | <dl> |
|---|
| 74 | <dt>non_prototype_relation ::=</dt> |
|---|
| 75 | <dd>implements_protocols |</dd> |
|---|
| 76 | <dd>imports_categories |</dd> |
|---|
| 77 | <dd>instantiates_classes |</dd> |
|---|
| 78 | <dd>specializes_classes</dd> |
|---|
| 79 | </dl> |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | <h2 id="grammar_category_definition">Category definition</h2> |
|---|
| 83 | |
|---|
| 84 | <dl> |
|---|
| 85 | <dt>category ::=</dt> |
|---|
| 86 | <dd>begin_category_directive [category_directives] [clauses] end_category_directive.</dd> |
|---|
| 87 | </dl> |
|---|
| 88 | <dl> |
|---|
| 89 | <dt>begin_category_directive ::=</dt> |
|---|
| 90 | <dd>"<code>:- category(</code>" category_identifier [ "<code>,</code>" category_relations] "<code>).</code>"</dd> |
|---|
| 91 | </dl> |
|---|
| 92 | <dl> |
|---|
| 93 | <dt>end_category_directive ::=</dt> |
|---|
| 94 | <dd>"<code>:- end_category.</code>"</dd> |
|---|
| 95 | </dl> |
|---|
| 96 | <dl> |
|---|
| 97 | <dt>category_relations ::=</dt> |
|---|
| 98 | <dd>category_relation |</dd> |
|---|
| 99 | <dd>category_relation "<code>,</code>" category_relations</dd> |
|---|
| 100 | </dl> |
|---|
| 101 | <dl> |
|---|
| 102 | <dt>category_relation ::=</dt> |
|---|
| 103 | <dd>implements_protocols |</dd> |
|---|
| 104 | <dd>extends_categories |</dd> |
|---|
| 105 | <dd>complements_objects</dd> |
|---|
| 106 | </dl> |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | <h2 id="grammar_protocol_definition">Protocol definition</h2> |
|---|
| 110 | |
|---|
| 111 | <dl> |
|---|
| 112 | <dt>protocol ::=</dt> |
|---|
| 113 | <dd>begin_protocol_directive [protocol_directives] end_protocol_directive.</dd> |
|---|
| 114 | </dl> |
|---|
| 115 | <dl> |
|---|
| 116 | <dt>begin_protocol_directive ::=</dt> |
|---|
| 117 | <dd>"<code>:- protocol(</code>" protocol_identifier [ "<code>,</code>" extends_protocols] "<code>).</code>"</dd> |
|---|
| 118 | </dl> |
|---|
| 119 | <dl> |
|---|
| 120 | <dt>end_protocol_directive ::=</dt> |
|---|
| 121 | <dd>"<code>:- end_protocol.</code>"</dd> |
|---|
| 122 | </dl> |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | <h2 id="grammar_entity_relations">Entity relations</h2> |
|---|
| 126 | |
|---|
| 127 | <dl> |
|---|
| 128 | <dt>extends_protocols ::=</dt> |
|---|
| 129 | <dd>"<code>extends(</code>" extended_protocols "<code>)</code>"</dd> |
|---|
| 130 | </dl> |
|---|
| 131 | <dl> |
|---|
| 132 | <dt>extends_objects ::=</dt> |
|---|
| 133 | <dd>"<code>extends(</code>" extended_objects "<code>)</code>"</dd> |
|---|
| 134 | </dl> |
|---|
| 135 | <dl> |
|---|
| 136 | <dt>extends_categories ::=</dt> |
|---|
| 137 | <dd>"<code>extends(</code>" extended_categories "<code>)</code>"</dd> |
|---|
| 138 | </dl> |
|---|
| 139 | <dl> |
|---|
| 140 | <dt>implements_protocols ::=</dt> |
|---|
| 141 | <dd>"<code>implements(</code>" implemented_protocols "<code>)</code>"</dd> |
|---|
| 142 | </dl> |
|---|
| 143 | <dl> |
|---|
| 144 | <dt>imports_categories ::=</dt> |
|---|
| 145 | <dd>"<code>imports(</code>" imported_categories "<code>)</code>"</dd> |
|---|
| 146 | </dl> |
|---|
| 147 | <dl> |
|---|
| 148 | <dt>instantiates_classes ::=</dt> |
|---|
| 149 | <dd>"<code>instantiates(</code>" instantiated_objects "<code>)</code>"</dd> |
|---|
| 150 | </dl> |
|---|
| 151 | <dl> |
|---|
| 152 | <dt>specializes_classes ::=</dt> |
|---|
| 153 | <dd>"<code>specializes(</code>" specialized_objects "<code>)</code>"</dd> |
|---|
| 154 | </dl> |
|---|
| 155 | <dl> |
|---|
| 156 | <dt>complements_objects ::=</dt> |
|---|
| 157 | <dd>"<code>complements(</code>" complemented_objects "<code>)</code>"</dd> |
|---|
| 158 | </dl> |
|---|
| 159 | |
|---|
| 160 | <h3 id="grammar_implemented_protocols">Implemented protocols</h3> |
|---|
| 161 | <dl> |
|---|
| 162 | <dt>implemented_protocols ::=</dt> |
|---|
| 163 | <dd>implemented_protocol |</dd> |
|---|
| 164 | <dd>implemented_protocol_sequence |</dd> |
|---|
| 165 | <dd>implemented_protocol_list</dd> |
|---|
| 166 | </dl> |
|---|
| 167 | <dl> |
|---|
| 168 | <dt>implemented_protocol ::=</dt> |
|---|
| 169 | <dd>protocol_identifier |</dd> |
|---|
| 170 | <dd>scope "<code>::</code>" protocol_identifier</dd> |
|---|
| 171 | </dl> |
|---|
| 172 | <dl> |
|---|
| 173 | <dt>implemented_protocol_sequence ::=</dt> |
|---|
| 174 | <dd>implemented_protocol |</dd> |
|---|
| 175 | <dd>implemented_protocol "<code>,</code>" implemented_protocol_sequence</dd> |
|---|
| 176 | </dl> |
|---|
| 177 | <dl> |
|---|
| 178 | <dt>implemented_protocol_list ::=</dt> |
|---|
| 179 | <dd>"<code>[</code>" implemented_protocol_sequence "<code>]</code>"</dd> |
|---|
| 180 | </dl> |
|---|
| 181 | |
|---|
| 182 | <h3 id="grammar_extended_protocols">Extended protocols</h3> |
|---|
| 183 | <dl> |
|---|
| 184 | <dt>extended_protocols ::=</dt> |
|---|
| 185 | <dd>extended_protocol |</dd> |
|---|
| 186 | <dd>extended_protocol_sequence |</dd> |
|---|
| 187 | <dd>extended_protocol_list</dd> |
|---|
| 188 | </dl> |
|---|
| 189 | <dl> |
|---|
| 190 | <dt>extended_protocol ::=</dt> |
|---|
| 191 | <dd>protocol_identifier |</dd> |
|---|
| 192 | <dd>scope "<code>::</code>" protocol_identifier</dd> |
|---|
| 193 | </dl> |
|---|
| 194 | <dl> |
|---|
| 195 | <dt>extended_protocol_sequence ::=</dt> |
|---|
| 196 | <dd>extended_protocol |</dd> |
|---|
| 197 | <dd>extended_protocol "<code>,</code>" extended_protocol_sequence</dd> |
|---|
| 198 | </dl> |
|---|
| 199 | <dl> |
|---|
| 200 | <dt>extended_protocol_list ::=</dt> |
|---|
| 201 | <dd>"<code>[</code>" extended_protocol_sequence "<code>]</code>"</dd> |
|---|
| 202 | </dl> |
|---|
| 203 | |
|---|
| 204 | <h3 id="grammar_imported_categories">Imported categories</h3> |
|---|
| 205 | <dl> |
|---|
| 206 | <dt>imported_categories ::=</dt> |
|---|
| 207 | <dd>imported_category |</dd> |
|---|
| 208 | <dd>imported_category_sequence |</dd> |
|---|
| 209 | <dd>imported_category_list</dd> |
|---|
| 210 | </dl> |
|---|
| 211 | <dl> |
|---|
| 212 | <dt>imported_category ::=</dt> |
|---|
| 213 | <dd>category_identifier |</dd> |
|---|
| 214 | <dd>scope "<code>::</code>" category_identifier</dd> |
|---|
| 215 | </dl> |
|---|
| 216 | <dl> |
|---|
| 217 | <dt>imported_category_sequence ::=</dt> |
|---|
| 218 | <dd>imported_category |</dd> |
|---|
| 219 | <dd>imported_category "<code>,</code>" imported_category_sequence</dd> |
|---|
| 220 | </dl> |
|---|
| 221 | <dl> |
|---|
| 222 | <dt>imported_category_list ::=</dt> |
|---|
| 223 | <dd>"<code>[</code>" imported_category_sequence "<code>]</code>"</dd> |
|---|
| 224 | </dl> |
|---|
| 225 | |
|---|
| 226 | <h3 id="grammar_extended_objects">Extended objects</h3> |
|---|
| 227 | <dl> |
|---|
| 228 | <dt>extended_objects ::=</dt> |
|---|
| 229 | <dd>extended_object |</dd> |
|---|
| 230 | <dd>extended_object_sequence |</dd> |
|---|
| 231 | <dd>extended_object_list</dd> |
|---|
| 232 | </dl> |
|---|
| 233 | <dl> |
|---|
| 234 | <dt>extended_object ::=</dt> |
|---|
| 235 | <dd>object_identifier |</dd> |
|---|
| 236 | <dd>scope "<code>::</code>" object_identifier</dd> |
|---|
| 237 | </dl> |
|---|
| 238 | <dl> |
|---|
| 239 | <dt>extended_object_sequence ::=</dt> |
|---|
| 240 | <dd>extended_object |</dd> |
|---|
| 241 | <dd>extended_object "<code>,</code>" extended_object_sequence</dd> |
|---|
| 242 | </dl> |
|---|
| 243 | <dl> |
|---|
| 244 | <dt>extended_object_list ::=</dt> |
|---|
| 245 | <dd>"<code>[</code>" extended_object_sequence "<code>]</code>"</dd> |
|---|
| 246 | </dl> |
|---|
| 247 | |
|---|
| 248 | <h3 id="grammar_extended_categories">Extended categories</h3> |
|---|
| 249 | <dl> |
|---|
| 250 | <dt>extended_categories ::=</dt> |
|---|
| 251 | <dd>extended_category |</dd> |
|---|
| 252 | <dd>extended_category_sequence |</dd> |
|---|
| 253 | <dd>extended_category_list</dd> |
|---|
| 254 | </dl> |
|---|
| 255 | <dl> |
|---|
| 256 | <dt>extended_category ::=</dt> |
|---|
| 257 | <dd>category_identifier |</dd> |
|---|
| 258 | <dd>scope "<code>::</code>" category_identifier</dd> |
|---|
| 259 | </dl> |
|---|
| 260 | <dl> |
|---|
| 261 | <dt>extended_category_sequence ::=</dt> |
|---|
| 262 | <dd>extended_category |</dd> |
|---|
| 263 | <dd>extended_category "<code>,</code>" extended_category_sequence</dd> |
|---|
| 264 | </dl> |
|---|
| 265 | <dl> |
|---|
| 266 | <dt>extended_category_list ::=</dt> |
|---|
| 267 | <dd>"<code>[</code>" extended_category_sequence "<code>]</code>"</dd> |
|---|
| 268 | </dl> |
|---|
| 269 | |
|---|
| 270 | <h3 id="grammar_instantiated_objects">Instantiated objects</h3> |
|---|
| 271 | <dl> |
|---|
| 272 | <dt>instantiated_objects ::=</dt> |
|---|
| 273 | <dd>instantiated_object |</dd> |
|---|
| 274 | <dd>instantiated_object_sequence |</dd> |
|---|
| 275 | <dd>instantiated_object_list</dd> |
|---|
| 276 | </dl> |
|---|
| 277 | <dl> |
|---|
| 278 | <dt>instantiated_object ::=</dt> |
|---|
| 279 | <dd>object_identifier |</dd> |
|---|
| 280 | <dd>scope "<code>::</code>" object_identifier</dd> |
|---|
| 281 | </dl> |
|---|
| 282 | <dl> |
|---|
| 283 | <dt>instantiated_object_sequence ::=</dt> |
|---|
| 284 | <dd>instantiated_object</dd> |
|---|
| 285 | <dd>instantiated_object "<code>,</code>" instantiated_object_sequence |</dd> |
|---|
| 286 | </dl> |
|---|
| 287 | <dl> |
|---|
| 288 | <dt>instantiated_object_list ::=</dt> |
|---|
| 289 | <dd>"<code>[</code>" instantiated_object_sequence "<code>]</code>"</dd> |
|---|
| 290 | </dl> |
|---|
| 291 | |
|---|
| 292 | <h3 id="grammar_specialized_objects">Specialized objects</h3> |
|---|
| 293 | <dl> |
|---|
| 294 | <dt>specialized_objects ::=</dt> |
|---|
| 295 | <dd>specialized_object |</dd> |
|---|
| 296 | <dd>specialized_object_sequence |</dd> |
|---|
| 297 | <dd>specialized_object_list</dd> |
|---|
| 298 | </dl> |
|---|
| 299 | <dl> |
|---|
| 300 | <dt>specialized_object ::=</dt> |
|---|
| 301 | <dd>object_identifier |</dd> |
|---|
| 302 | <dd>scope "<code>::</code>" object_identifier</dd> |
|---|
| 303 | </dl> |
|---|
| 304 | <dl> |
|---|
| 305 | <dt>specialized_object_sequence ::=</dt> |
|---|
| 306 | <dd>specialized_object |</dd> |
|---|
| 307 | <dd>specialized_object "<code>,</code>" specialized_object_sequence</dd> |
|---|
| 308 | </dl> |
|---|
| 309 | <dl> |
|---|
| 310 | <dt>specialized_object_list ::=</dt> |
|---|
| 311 | <dd>"<code>[</code>" specialized_object_sequence "<code>]</code>"</dd> |
|---|
| 312 | </dl> |
|---|
| 313 | |
|---|
| 314 | <h3 id="grammar_complemented_objects">Complemented objects</h3> |
|---|
| 315 | <dl> |
|---|
| 316 | <dt>complemented_objects ::=</dt> |
|---|
| 317 | <dd>object_identifier |</dd> |
|---|
| 318 | <dd>complemented_object_sequence |</dd> |
|---|
| 319 | <dd>complemented_object_list</dd> |
|---|
| 320 | </dl> |
|---|
| 321 | <dl> |
|---|
| 322 | <dt>complemented_object_sequence ::=</dt> |
|---|
| 323 | <dd>object_identifier |</dd> |
|---|
| 324 | <dd>object_identifier "<code>,</code>" complemented_object_sequence</dd> |
|---|
| 325 | </dl> |
|---|
| 326 | <dl> |
|---|
| 327 | <dt>complemented_object_list ::=</dt> |
|---|
| 328 | <dd>"<code>[</code>" complemented_object_sequence "<code>]</code>"</dd> |
|---|
| 329 | </dl> |
|---|
| 330 | |
|---|
| 331 | <h3 id="grammar_scope">Entity scope</h3> |
|---|
| 332 | <dl> |
|---|
| 333 | <dt>scope ::=</dt> |
|---|
| 334 | <dd>"<code>public</code>" |</dd> |
|---|
| 335 | <dd>"<code>protected</code>" |</dd> |
|---|
| 336 | <dd>"<code>private</code>"</dd> |
|---|
| 337 | </dl> |
|---|
| 338 | |
|---|
| 339 | |
|---|
| 340 | <h2 id="grammar_entity_identifiers">Entity identifiers</h2> |
|---|
| 341 | |
|---|
| 342 | <dl> |
|---|
| 343 | <dt>entity_identifiers ::=</dt> |
|---|
| 344 | <dd>entity_identifier |</dd> |
|---|
| 345 | <dd>entity_identifier_sequence |</dd> |
|---|
| 346 | <dd>entity_identifier_list</dd> |
|---|
| 347 | </dl> |
|---|
| 348 | <dl> |
|---|
| 349 | <dt>entity_identifier ::=</dt> |
|---|
| 350 | <dd>object_identifier |</dd> |
|---|
| 351 | <dd>protocol_identifier |</dd> |
|---|
| 352 | <dd>category_identifier</dd> |
|---|
| 353 | </dl> |
|---|
| 354 | <dl> |
|---|
| 355 | <dt>entity_identifier_sequence ::=</dt> |
|---|
| 356 | <dd>entity_identifier |</dd> |
|---|
| 357 | <dd>entity_identifier "<code>,</code>" entity_identifier_sequence</dd> |
|---|
| 358 | </dl> |
|---|
| 359 | <dl> |
|---|
| 360 | <dt>entity_identifier_list ::=</dt> |
|---|
| 361 | <dd>"<code>[</code>" entity_identifier_sequence "<code>]</code>"</dd> |
|---|
| 362 | </dl> |
|---|
| 363 | |
|---|
| 364 | <h3 id="grammar_object_identifiers">Object identifiers</h3> |
|---|
| 365 | <dl> |
|---|
| 366 | <dt>object_identifiers ::=</dt> |
|---|
| 367 | <dd>object_identifier |</dd> |
|---|
| 368 | <dd>object_identifier_sequence |</dd> |
|---|
| 369 | <dd>object_identifier_list</dd> |
|---|
| 370 | </dl> |
|---|
| 371 | <dl> |
|---|
| 372 | <dt>object_identifier ::=</dt> |
|---|
| 373 | <dd><i>atom</i> |</dd> |
|---|
| 374 | <dd><i>compound</i></dd> |
|---|
| 375 | </dl> |
|---|
| 376 | <dl> |
|---|
| 377 | <dt>object_identifier_sequence ::=</dt> |
|---|
| 378 | <dd>object_identifier |</dd> |
|---|
| 379 | <dd>object_identifier "<code>,</code>" object_identifier_sequence</dd> |
|---|
| 380 | </dl> |
|---|
| 381 | <dl> |
|---|
| 382 | <dt>object_identifier_list ::=</dt> |
|---|
| 383 | <dd>"<code>[</code>" object_identifier_sequence "<code>]</code>"</dd> |
|---|
| 384 | </dl> |
|---|
| 385 | |
|---|
| 386 | <h3 id="grammar_category_identifiers">Category identifiers</h3> |
|---|
| 387 | <dl> |
|---|
| 388 | <dt>category_identifiers ::=</dt> |
|---|
| 389 | <dd>category_identifier |</dd> |
|---|
| 390 | <dd>category_identifier_sequence |</dd> |
|---|
| 391 | <dd>category_identifier_list</dd> |
|---|
| 392 | </dl> |
|---|
| 393 | <dl> |
|---|
| 394 | <dt>category_identifier ::=</dt> |
|---|
| 395 | <dd><i>atom</i></dd> |
|---|
| 396 | </dl> |
|---|
| 397 | <dl> |
|---|
| 398 | <dt>category_identifier_sequence ::=</dt> |
|---|
| 399 | <dd>category_identifier |</dd> |
|---|
| 400 | <dd>category_identifier "<code>,</code>" category_identifier_sequence</dd> |
|---|
| 401 | </dl> |
|---|
| 402 | <dl> |
|---|
| 403 | <dt>category_identifier_list ::=</dt> |
|---|
| 404 | <dd>"<code>[</code>" category_identifier_sequence "<code>]</code>"</dd> |
|---|
| 405 | </dl> |
|---|
| 406 | |
|---|
| 407 | <h3 id="grammar_protocol_identifiers">Protocol identifiers</h3> |
|---|
| 408 | <dl> |
|---|
| 409 | <dt>protocol_identifiers ::=</dt> |
|---|
| 410 | <dd>protocol_identifier |</dd> |
|---|
| 411 | <dd>protocol_identifier_sequence |</dd> |
|---|
| 412 | <dd>protocol_identifier_list</dd> |
|---|
| 413 | </dl> |
|---|
| 414 | <dl> |
|---|
| 415 | |
|---|
| 416 | <dt>protocol_identifier ::=</dt> |
|---|
| 417 | <dd><i>atom</i></dd> |
|---|
| 418 | </dl> |
|---|
| 419 | <dl> |
|---|
| 420 | <dt>protocol_identifier_sequence ::=</dt> |
|---|
| 421 | <dd>protocol_identifier |</dd> |
|---|
| 422 | <dd>protocol_identifier "<code>,</code>" protocol_identifier_sequence</dd> |
|---|
| 423 | </dl> |
|---|
| 424 | <dl> |
|---|
| 425 | <dt>protocol_identifier_list ::=</dt> |
|---|
| 426 | <dd>"<code>[</code>" protocol_identifier_sequence "<code>]</code>"</dd> |
|---|
| 427 | </dl> |
|---|
| 428 | |
|---|
| 429 | |
|---|
| 430 | <h2 id="grammar_source_file_names">Source file names</h2> |
|---|
| 431 | |
|---|
| 432 | <dl> |
|---|
| 433 | <dt>source_file_names ::=</dt> |
|---|
| 434 | <dd>source_file_name |</dd> |
|---|
| 435 | <dd>source_file_name_list</dd> |
|---|
| 436 | </dl> |
|---|
| 437 | <dl> |
|---|
| 438 | <dt>source_file_name ::=</dt> |
|---|
| 439 | <dd><em>atom</em> |</dd> |
|---|
| 440 | <dd>library_source_file_name</dd> |
|---|
| 441 | </dl> |
|---|
| 442 | <dl> |
|---|
| 443 | <dt>library_source_file_name ::=</dt> |
|---|
| 444 | <dd>library_name "<code>(</code>" <em>atom</em> "<code>)</code>"</dd> |
|---|
| 445 | </dl> |
|---|
| 446 | <dl> |
|---|
| 447 | <dt>library_name ::=</dt> |
|---|
| 448 | <dd><em>atom</em></dd> |
|---|
| 449 | </dl> |
|---|
| 450 | <dl> |
|---|
| 451 | <dt>source_file_name_sequence ::=</dt> |
|---|
| 452 | <dd>source_file_name |</dd> |
|---|
| 453 | <dd>source_file_name "<code>,</code>" source_file_name_sequence</dd> |
|---|
| 454 | </dl> |
|---|
| 455 | <dl> |
|---|
| 456 | <dt>source_file_name_list ::=</dt> |
|---|
| 457 | <dd>"<code>[</code>" source_file_name_sequence "<code>]</code>"</dd> |
|---|
| 458 | </dl> |
|---|
| 459 | |
|---|
| 460 | |
|---|
| 461 | |
|---|
| 462 | <h2 id="grammar_directives">Directives</h2> |
|---|
| 463 | |
|---|
| 464 | <h3 id="grammar_source_file_directives">Source file directives</h3> |
|---|
| 465 | <dl> |
|---|
| 466 | <dt>source_file_directives ::=</dt> |
|---|
| 467 | <dd>source_file_directive |</dd> |
|---|
| 468 | <dd>source_file_directive source_file_directives</dd> |
|---|
| 469 | </dl> |
|---|
| 470 | <dl> |
|---|
| 471 | <dt>source_file_directive ::=</dt> |
|---|
| 472 | <dd>"<code>:- encoding(</code>" <i>atom</i> "<code>).</code>" |</dd> |
|---|
| 473 | <dd><i>initialization_directive</i> |</dd> |
|---|
| 474 | <dd><i>operator_directive</i></dd> |
|---|
| 475 | </dl> |
|---|
| 476 | |
|---|
| 477 | <h3 id="grammar_conditional_compilation_directives">Conditional compilation directives</h3> |
|---|
| 478 | <dl> |
|---|
| 479 | <dt>conditional_compilation_directives ::=</dt> |
|---|
| 480 | <dd>conditional_compilation_directive |</dd> |
|---|
| 481 | <dd>conditional_compilation_directive conditional_compilation_directives</dd> |
|---|
| 482 | </dl> |
|---|
| 483 | <dl> |
|---|
| 484 | <dt>conditional_compilation_directive ::=</dt> |
|---|
| 485 | <dd>"<code>:- if(</code>" <i>callable</i> "<code>).</code>" |</dd> |
|---|
| 486 | <dd>"<code>:- elif(</code>" <i>callable</i> "<code>).</code>" |</dd> |
|---|
| 487 | <dd>"<code>:- else.</code>" |</dd> |
|---|
| 488 | <dd>"<code>:- endif.</code>"</dd> |
|---|
| 489 | </dl> |
|---|
| 490 | |
|---|
| 491 | <h3 id="grammar_object_directives">Object directives</h3> |
|---|
| 492 | <dl> |
|---|
| 493 | <dt>object_directives ::=</dt> |
|---|
| 494 | <dd>object_directive |</dd> |
|---|
| 495 | <dd>object_directive object_directives</dd> |
|---|
| 496 | </dl> |
|---|
| 497 | <dl> |
|---|
| 498 | <dt>object_directive ::=</dt> |
|---|
| 499 | <dd><i>initialization_directive</i> |</dd> |
|---|
| 500 | <dd>"<code>:- threaded.</code>" |</dd> |
|---|
| 501 | <dd>"<code>:- synchronized.</code>" |</dd> |
|---|
| 502 | <dd>"<code>:- dynamic.</code>" |</dd> |
|---|
| 503 | <dd>"<code>:- uses(</code>" object_identifier "<code>).</code>" |</dd> |
|---|
| 504 | <dd>"<code>:- calls(</code>" protocol_identifiers "<code>).</code>" |</dd> |
|---|
| 505 | <dd>"<code>:- info(</code>" info_list "<code>).</code>" |</dd> |
|---|
| 506 | <dd>predicate_directives</dd> |
|---|
| 507 | </dl> |
|---|
| 508 | |
|---|
| 509 | <h3 id="grammar_category_directives">Category directives</h3> |
|---|
| 510 | <dl> |
|---|
| 511 | <dt>category_directives ::=</dt> |
|---|
| 512 | <dd>category_directive |</dd> |
|---|
| 513 | <dd>category_directive category_directives</dd> |
|---|
| 514 | </dl> |
|---|
| 515 | <dl> |
|---|
| 516 | <dt>category_directive ::=</dt> |
|---|
| 517 | <dd><i>initialization_directive</i> |</dd> |
|---|
| 518 | <dd>"<code>:- synchronized.</code>" |</dd> |
|---|
| 519 | <dd>"<code>:- dynamic.</code>" |</dd> |
|---|
| 520 | <dd>"<code>:- uses(</code>" object_identifier "<code>).</code>" |</dd> |
|---|
| 521 | <dd>"<code>:- calls(</code>" protocol_identifiers "<code>).</code>" |</dd> |
|---|
| 522 | <dd>"<code>:- info(</code>" info_list "<code>).</code>" |</dd> |
|---|
| 523 | <dd>predicate_directives</dd> |
|---|
| 524 | </dl> |
|---|
| 525 | |
|---|
| 526 | <h3 id="grammar_protocol_directives">Protocol directives</h3> |
|---|
| 527 | <dl> |
|---|
| 528 | <dt>protocol_directives ::=</dt> |
|---|
| 529 | <dd>protocol_directive |</dd> |
|---|
| 530 | <dd>protocol_directive protocol_directives</dd> |
|---|
| 531 | </dl> |
|---|
| 532 | <dl> |
|---|
| 533 | <dt>protocol_directive ::=</dt> |
|---|
| 534 | <dd><i>initialization_directive</i> |</dd> |
|---|
| 535 | <dd>"<code>:- dynamic.</code>" |</dd> |
|---|
| 536 | <dd>"<code>:- info(</code>" info_list "<code>).</code>" |</dd> |
|---|
| 537 | <dd>predicate_directives</dd> |
|---|
| 538 | </dl> |
|---|
| 539 | |
|---|
| 540 | <h3 id="grammar_predicate_directives">Predicate directives</h3> |
|---|
| 541 | <dl> |
|---|
| 542 | <dt>predicate_directives ::=</dt> |
|---|
| 543 | <dd>predicate_directive |</dd> |
|---|
| 544 | <dd>predicate_directive predicate_directives</dd> |
|---|
| 545 | </dl> |
|---|
| 546 | <dl> |
|---|
| 547 | <dt>predicate_directive ::=</dt> |
|---|
| 548 | <dd>alias_directive |</dd> |
|---|
| 549 | <dd>synchronized_directive |</dd> |
|---|
| 550 | <dd>uses_directive |</dd> |
|---|
| 551 | <dd>scope_directive |</dd> |
|---|
| 552 | <dd>mode_directive |</dd> |
|---|
| 553 | <dd>meta_predicate_directive |</dd> |
|---|
| 554 | <dd>info_directive |</dd> |
|---|
| 555 | <dd>dynamic_directive |</dd> |
|---|
| 556 | <dd>discontiguous_directive |</dd> |
|---|
| 557 | <dd><i>operator_directive</i></dd> |
|---|
| 558 | </dl> |
|---|
| 559 | <dl> |
|---|
| 560 | <dt>alias_directive ::=</dt> |
|---|
| 561 | <dd>"<code>:- alias(</code>" entity_identifier "<code>,</code>" predicate_indicator "<code>,</code>" predicate_indicator "<code>).</code>" |</dd> |
|---|
| 562 | <dd>"<code>:- alias(</code>" entity_identifier "<code>,</code>" non_terminal_indicator "<code>,</code>" non_terminal_indicator "<code>).</code>"</dd> |
|---|
| 563 | </dl> |
|---|
| 564 | <dl> |
|---|
| 565 | <dt>synchronized_directive ::=</dt> |
|---|
| 566 | <dd>"<code>:- synchronized(</code>" predicate_indicator "<code>).</code>" |</dd> |
|---|
| 567 | <dd>"<code>:- synchronized(</code>" non_terminal_indicator "<code>).</code>"</dd> |
|---|
| 568 | </dl> |
|---|
| 569 | <dl> |
|---|
| 570 | <dt>uses_directive ::=</dt> |
|---|
| 571 | <dd>"<code>:- uses(</code>" object_identifier "<code>,</code>" predicate_indicator_alias_list "<code>).</code>"</dd> |
|---|
| 572 | </dl> |
|---|
| 573 | <dl> |
|---|
| 574 | <dt>scope_directive ::=</dt> |
|---|
| 575 | <dd>"<code>:- public(</code>" predicate_indicator_term | non_terminal_indicator_term "<code>).</code>" |</dd> |
|---|
| 576 | <dd>"<code>:- protected(</code>" predicate_indicator_term | non_terminal_indicator_term "<code>).</code>" |</dd> |
|---|
| 577 | <dd>"<code>:- private(</code>" predicate_indicator_term | non_terminal_indicator_term "<code>).</code>"</dd> |
|---|
| 578 | </dl> |
|---|
| 579 | <dl> |
|---|
| 580 | <dt>mode_directive ::=</dt> |
|---|
| 581 | <dd>"<code>:- mode(</code>" predicate_mode_term | non_terminal_mode_term "<code>,</code>" number_of_solutions "<code>).</code>"</dd> |
|---|
| 582 | </dl> |
|---|
| 583 | <dl> |
|---|
| 584 | <dt>meta_predicate_directive ::=</dt> |
|---|
| 585 | <dd>"<code>:- meta_predicate(</code>" meta_predicate_mode_indicator "<code>).</code>"</dd> |
|---|
| 586 | </dl> |
|---|
| 587 | <dl> |
|---|
| 588 | <dt>info_directive ::=</dt> |
|---|
| 589 | <dd>"<code>:- info(</code>" predicate_indicator | non_terminal_indicator "<code>,</code>" info_list "<code>).</code>"</dd> |
|---|
| 590 | </dl> |
|---|
| 591 | <dl> |
|---|
| 592 | <dt>dynamic_directive ::=</dt> |
|---|
| 593 | <dd>"<code>:- dynamic(</code>" predicate_indicator_term | non_terminal_indicator_term "<code>).</code>" |</dd> |
|---|
| 594 | </dl> |
|---|
| 595 | <dl> |
|---|
| 596 | <dt>discontiguous_directive ::=</dt> |
|---|
| 597 | <dd>"<code>:- discontiguous(</code>" predicate_indicator_term | non_terminal_indicator_term "<code>).</code>" |</dd> |
|---|
| 598 | </dl> |
|---|
| 599 | <dl> |
|---|
| 600 | <dt>predicate_indicator_term ::=</dt> |
|---|
| 601 | <dd><i>predicate_indicator</i> |</dd> |
|---|
| 602 | <dd>predicate_indicator_sequence |</dd> |
|---|
| 603 | <dd>predicate_indicator_list</dd> |
|---|
| 604 | </dl> |
|---|
| 605 | <dl> |
|---|
| 606 | <dt>predicate_indicator_sequence ::=</dt> |
|---|
| 607 | <dd><i>predicate_indicator</i> |</dd> |
|---|
| 608 | <dd><i>predicate_indicator</i> "<code>,</code>" predicate_indicator_sequence</dd> |
|---|
| 609 | </dl> |
|---|
| 610 | <dl> |
|---|
| 611 | <dt>predicate_indicator_list ::=</dt> |
|---|
| 612 | <dd>"<code>[</code>" predicate_indicator_sequence "<code>]</code>"</dd> |
|---|
| 613 | </dl> |
|---|
| 614 | <dl> |
|---|
| 615 | <dt>predicate_indicator_alias ::=</dt> |
|---|
| 616 | <dd><i>predicate_indicator</i> |</dd> |
|---|
| 617 | <dd><i>predicate_indicator</i> "<code>::</code>" <i>predicate_indicator</i></dd> |
|---|
| 618 | </dl> |
|---|
| 619 | <dl> |
|---|
| 620 | <dt>predicate_indicator_alias_sequence ::=</dt> |
|---|
| 621 | <dd>predicate_indicator_alias |</dd> |
|---|
| 622 | <dd>predicate_indicator_alias "<code>,</code>" predicate_indicator_alias_sequence</dd> |
|---|
| 623 | </dl> |
|---|
| 624 | <dl> |
|---|
| 625 | <dt>predicate_indicator_alias_list ::=</dt> |
|---|
| 626 | <dd>"<code>[</code>" predicate_indicator_alias_sequence "<code>]</code>"</dd> |
|---|
| 627 | </dl> |
|---|
| 628 | <dl> |
|---|
| 629 | <dt>non_terminal_indicator_term ::=</dt> |
|---|
| 630 | <dd>non_terminal_indicator |</dd> |
|---|
| 631 | <dd>non_terminal_indicator_sequence |</dd> |
|---|
| 632 | <dd>non_terminal_indicator_list</dd> |
|---|
| 633 | </dl> |
|---|
| 634 | <dl> |
|---|
| 635 | <dt>non_terminal_indicator_sequence ::=</dt> |
|---|
| 636 | <dd>non_terminal_indicator |</dd> |
|---|
| 637 | <dd>non_terminal_indicator "<code>,</code>" non_terminal_indicator_sequence</dd> |
|---|
| 638 | </dl> |
|---|
| 639 | <dl> |
|---|
| 640 | <dt>non_terminal_indicator_list ::=</dt> |
|---|
| 641 | <dd>"<code>[</code>" non_terminal_indicator_sequence "<code>]</code>"</dd> |
|---|
| 642 | </dl> |
|---|
| 643 | <dl> |
|---|
| 644 | <dt>non_terminal_indicator ::=</dt> |
|---|
| 645 | <dd><i>functor</i> "<code>//</code>" <i>arity</i></dd> |
|---|
| 646 | </dl> |
|---|
| 647 | <dl> |
|---|
| 648 | <dt>predicate_mode_term ::=</dt> |
|---|
| 649 | <dd><i>atom</i> "<code>(</code>" mode_terms "<code>)</code>"</dd> |
|---|
| 650 | </dl> |
|---|
| 651 | <dl> |
|---|
| 652 | <dt>non_terminal_mode_term ::=</dt> |
|---|
| 653 | <dd><i>atom</i> "<code>(</code>" mode_terms "<code>)</code>"</dd> |
|---|
| 654 | </dl> |
|---|
| 655 | <dl> |
|---|
| 656 | <dt>mode_terms ::=</dt> |
|---|
| 657 | <dd>mode_term |</dd> |
|---|
| 658 | <dd>mode_term "<code>,</code>" mode_terms</dd> |
|---|
| 659 | </dl> |
|---|
| 660 | <dl> |
|---|
| 661 | <dt>mode_term ::=</dt> |
|---|
| 662 | <dd>"<code>@</code>" [type] | "<code>+</code>" [type] | "<code>-</code>" [type] | "<code>?</code>" [type]</dd> |
|---|
| 663 | </dl> |
|---|
| 664 | <dl> |
|---|
| 665 | <dt>type ::=</dt> |
|---|
| 666 | <dd>prolog_type | logtalk_type | user_defined_type</dd> |
|---|
| 667 | </dl> |
|---|
| 668 | <dl> |
|---|
| 669 | <dt>prolog_type ::=</dt> |
|---|
| 670 | <dd>"<code>term</code>" | "<code>nonvar</code>" | "<code>var</code>" |</dd> |
|---|
| 671 | <dd>"<code>compound</code>" | "<code>ground</code>" | "<code>callable</code>" | "<code>list</code>" |</dd> |
|---|
| 672 | <dd>"<code>atomic</code>" | "<code>atom</code>" |</dd> |
|---|
| 673 | <dd>"<code>number</code>" | "<code>integer</code>" | "<code>float</code>"</dd> |
|---|
| 674 | </dl> |
|---|
| 675 | <dl> |
|---|
| 676 | <dt>logtalk_type ::=</dt> |
|---|
| 677 | <dd>"<code>object</code>" | "<code>category</code>" | "<code>protocol</code>" |</dd> |
|---|
| 678 | <dd>"<code>event</code>"</dd> |
|---|
| 679 | </dl> |
|---|
| 680 | <dl> |
|---|
| 681 | <dt>user_defined_type ::=</dt> |
|---|
| 682 | <dd><i>atom</i> |</dd> |
|---|
| 683 | <dd><i>compound</i></dd> |
|---|
| 684 | </dl> |
|---|
| 685 | <dl> |
|---|
| 686 | <dt>number_of_solutions ::=</dt> |
|---|
| 687 | <dd>"<code>zero</code>" | "<code>zero_or_one</code>" | "<code>zero_or_more</code>" | "<code>one</code>" | "<code>one_or_more</code>" | "<code>error</code>"</dd> |
|---|
| 688 | </dl> |
|---|
| 689 | <dl id="grammar_meta_predicate_mode_indicator"> |
|---|
| 690 | <dt>meta_predicate_mode_indicator ::=</dt> |
|---|
| 691 | <dd><i>atom</i> "<code>(</code>" meta_predicate_terms "<code>)</code>"</dd> |
|---|
| 692 | </dl> |
|---|
| 693 | <dl id="grammar_meta_predicate_terms"> |
|---|
| 694 | <dt>meta_predicate_terms ::=</dt> |
|---|
| 695 | <dd>meta_predicate_term |</dd> |
|---|
| 6 |
|---|