Next: , Previous: , Up: Forth Words   [Contents][Index]


5.3 Comments

Forth supports two styles of comment; the traditional in-line comment, ( and its modern cousin, the comment to end of line; \.

( ( ( compilation ’ccc<close-paren>’ – ; run-time –  ) core,file “paren”

Comment, usually till the next ): parse and discard all subsequent characters in the parse area until ")" is encountered. During interactive input, an end-of-line also acts as a comment terminator. For file input, it does not; if the end-of-file is encountered whilst parsing for the ")" delimiter, Gforth will generate a warning.

\ ( compilation ’ccc<newline>’ – ; run-time –  ) core-ext,block-ext “backslash”

Comment till the end of the line if BLK contains 0 (i.e., while not loading a block), parse and discard the remainder of the parse area. Otherwise, parse and discard all subsequent characters in the parse area corresponding to the current line.

\G ( compilation ’ccc<newline>’ – ; run-time –  ) gforth-0.4 “backslash-gee”

Equivalent to \ but used as a tag to annotate definition comments into documentation.