PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Comments

Comments

Comments are a language feature.

Comments generally refer to free text ignored by the compiler that is not part of the language grammar.

Languages without Comments include JSON, Regular Expressions, JCOF

Languages with Comments include Java, JavaScript, C, Python, HTML, C++, SQL, PHP, XML, Ruby, R, Go, Perl, C#, Scala, MATLAB, Swift, MySQL, Rust, Haskell, Fortran, Lua, CSS, TypeScript, Scheme, Objective-C, COBOL, Clojure, PostgreSQL, SAS, Visual Basic, Erlang, Mathematica, ARM, Kotlin, Prolog, Julia, Pascal, Elixir, Ada, PowerShell, Tcl, OCaml, Dart, Groovy, F#, CoffeeScript, Common Lisp, Bash, D, Smalltalk, Solidity, Crystal, Racket, Nim, BASIC, APL, Delphi, Chapel, Forth, Elm, CUDA, Verilog, awk, Eiffel, Reason, PostScript, Haxe, Maple, YAML, GNU Octave, LaTeX, Emacs Lisp, fish, GraphQL, Modula-2, Dylan, Tex, VHDL, REBOL, LLVM IR, Rexx, MUMPS, Idris, Red, SPSS, PureScript, Pug, Modula-3, Simula, PL/SQL, Zig, Applescript, Vala, BCPL, WebAssembly, ANTLR, ClojureScript, Io, Visual Basic .NET, Deno, Rust MIR, HAML, Hy, Wren, Oz, MIPS architecture, J, VBScript, SVG, Oberon, Logo, Ballerina, SNOBOL, Boo, IDL, ActionScript, Hack, TOML, Yacc, V, Protocol Buffers, Sage, CIL, OpenCL, AMPL, XQuery, HCL, MoonScript, Pike, AutoIt, Fantom, Icon, PostCSS, VBA, SPARQL, Wolfram Language, QBasic, Stata, SuperCollider, Agda, Perl 6, Scilab, Falcon, Seed7, Opa, sed, Nemerle, Ceylon, Squirrel, JSON5, ColdFusion, Factor, PEG.js, Cap'n Proto, Makefile, Maxima, Xojo, X10, Bison, FLUX, Processing, Mercury, Batchfile, ABAP, Clean, Koka, Lasso, Eve, NewLisp, PureBasic, xBase, Befunge, E, PL/I, Terra, Zephir, Dafny, Frege, Java Bytecode, DOT, Smali, K, KaTeX, UNLAMBDA, B, Guile, API Blueprint, SETL, Object Pascal, Lean, Nginx, PRQL, ATS, LFE, AutoHotkey, Modelica, SystemVerilog, Clipper, Monkey, M4, Turing, Bicep, Ini, x86 Assembly, Twig, LiveScript, Nearley, Less, Pig Latin, Datalog, Fortress, Genie, GW-BASIC, Csound, LiveCode, Hjson, PicoLisp, Isabelle, unison, halide, carp, JCL, NetLogo, Sather, Transact-SQL, LPC, Flow, CIL, JAI, YASnippet, odin, CLIPS, WDL, Nextflow, Unicon, wisp, Pony, muPad, AspectJ, HOPE, Gosu, PARI/GP, BETA, FreeBASIC, FoxPRO, CWL, TLA, LotusScript, AGC, DTrace, Jison, Lily, EBNF, Fennel, QML, Lex, Cg, LilyPond, EDN, Objective-J, Classroom Object Oriented Language, SIL, Cryptol, PEG, NSIS, Dhall, Nit, Futhark, Observable, Euphoria, Cue, idyll, Felix, JADE, Alloy, Dc, ACL2, ooc, Click, Mu, Joy, S-algol, PowerBuilder, Ring, Fancy, GLSL, datascript, Flow9, OpenSCAD, Gambas, mgmt, PL/M, PL/pgSQL, Java Properties, JFlex, NetRexx, Xtend, Tea, Refal, Ch, starlark, Logica, eC, BlitzBasic, NCAR Command Language, P4, Expect, Netwide Assembler, IGOR Pro, Oberon-2, Fibonacci, Closure Templates, ArkScript, QB64, Angelscript, Filebench WML, UrWeb, Whiley, PAWN, Cypher Query Language, Mirah, Aldor, DAX, SugarSS, MiniD, Apex, Gettext Catalog, Not Quite C, Action!, KiXtart, ARexx, basic calculator, SCSS, mlir, GAP, Ragel, Lingo, Neko, Ron, Golo, Volt, Augmented Backus-Naur Form, Concise Encoding, Parser 3, Pan, spry, lispyscript, OpenEdge ABL, clay, Dockerfile, XSLT, CIR, JSL, Spatial, BlitzMax, XS, OpenVera, Logtalk, Ligo, PowerQuery M, MQL5, Argdown, OX, HLSL, mun-lang, Ren'Py, SourcePawn, Ezhil, Mask, ECL, True BASIC, Harbour, popr, DM, GDScript, Frink, Cell, Gentoo Ebuild, Hocon, CLIST, Mary, Vigil, Jasmin, MAXScript, Shen, JSON with Comments, Linden Scripting Language, MOO, Script.NET, XBase++, NESL, OCL, PowerBASIC, Strips, HiveQL, Game Maker Language, Objective C++, C shell, monte, KRL, Orc, Rescript, EuLisp, S-PLUS, Bluespec, Not eXactly C, TAL, Ion, NetLinx, Opal, Praat Script, dex, Gherkin, Eclipse Command Language, Logos, Spin, RenderScript, Mouse, Q#, WebIDL, Structured Query Reporter, BitBake, storyscript, NestedText, PIC, Cycript, LookML, Mako, SMT, COMPONENT PASCAL, POV-Ray SDL, Charity, Sophia, Quaint, c3, Xbasic, Amazon Redshift, Raku, Jsonnet, False, parasail, Rc, BLISS, Bel, Fable, CLOS, NS Basic, FutureBASIC, spiral, neut, Embedded Crystal, LoomScript, Slice, Type Language, manool, Augeas, Yoix, Judoscript, Project Mentat, carth, blockml, beads-lang, Ren, Zimpl, Z, JSLT, Tuple space, Vale, ThinBasic, Redcode, Adventure Game Studio Script, CartoCSS, Edje Data Collection, SRecode Template, ldpl, pointless, gentee, kai, Plus, winxed, SimCode, Language Server Index Format, owen-lang, Claro, dlvm, Lexon, Reia, Sweet Expressions, Caché Basic, FML, Literate Agda, Module Management System, Reactive Plan Language, Soy, Yedalog, VHDL-AMS, S3, MVEL, HAGGIS, Turbo Basic, XBLite, WxBasic, HuJSON, Grammatical Framework, Alpine Abuild, GCC Machine Description, Brightscript, ShaderLab, Nymph, tht, Fjölnir, Simple Actor Language System and Architecture, Lite-C, RLaB, silk, Heron, taf, z80, XPL0, BuddyScript, ISETL, ProbeVue, Pawn, Recfiles, fizz, Guix Workflow Language, omega, Plot, PromQL, rosette-lang, verifpal, Finite State Language, holyc, rbs, Robots.txt, SubX, Maya Embedded Language, FloScript, dedukti, Wart, Yet Another Scripting Language, PROMAL, OEM, neeilang, Urbiscript, hilvl, boa, epsilon, flagship, lain, stella, txr, GraphQL Schema Definition Language, SNOBOL4, StruQL, turnstile, xxl, CFScript, StarOffice Basic, Handel-C, Savi, Easytrieve, ActiveVFP, OptimJ, Pnuts, Action Code Script, MACRO-10, Operational Control Language, Treelang, Arden syntax, AmbientTalk, atomese, Bla, Boogie, luau, USD, wescheme, BABEL, bioscript, ca65 Assembly, ctalk-lang, dslx, Manchester syntax, Portable Bit Map Format, Netpbm grayscale image format, ppm-format, rbscript, taichi, tremor-query, Creative Basic, Parrot BASIC, Rita, KonsolScript, SARL, Spice, ddfql, sora, zephyr-asdl, blz, PkgConfig, Croc, PacmanConf, Smithy, Lighttpd configuration file

Example from C:

/* hello world */ // hi

Example from Python, Julia:

# This is a comment

Example from HTML:

<!-- Hello World in HTML -->

Example from Ruby:

# This is a single line comment.

Example from R, Bash, Crystal, GraphQL, LLVM IR, MIPS architecture, Boo, TOML, Sage, AMPL, Icon, SPARQL, Perl 6, Makefile, Smali, API Blueprint, Nginx, PRQL, LiveScript, Nearley, Hjson, YASnippet, WDL, Unicon, CWL, AGC, Dc, Mu, mgmt, Java Properties, Tea, starlark, Logica, Expect, ArkScript, Filebench WML, Ragel, Golo, Parser 3, Pan, spry, Dockerfile, Ren'Py, Ezhil, GDScript, Gentoo Ebuild, Vigil, C shell, S-PLUS, Praat Script, Gherkin, BitBake, storyscript, NestedText, PIC, LookML, Raku, Rc, Embedded Crystal, Zimpl, ldpl, Claro, Reia, Yedalog, Alpine Abuild, BuddyScript, rbs, Robots.txt, SubX, Wart, Yet Another Scripting Language, Portable Bit Map Format, Netpbm grayscale image format, ppm-format, tremor-query, Parrot BASIC, blz:

# A comment

Example from Go, C#:

// This is a comment

Example from Perl:

# This is a comment in perl =begin comment This is all part of multiline comment. You can use as many lines as you like These comments will be ignored by the compiler until the next =cut is encountered. =cut

Example from MATLAB:

% This is a comment

Example from MySQL, PostgreSQL, Idris, PL/SQL, MoonScript, Agda, Terra, Frege, Pig Latin, unison, Transact-SQL, Classroom Object Oriented Language, Dhall, Aldor, OCL, HiveQL, Opal, dex, Amazon Redshift, manool, Literate Agda, VHDL-AMS, Grammatical Framework, ISETL, omega, Bla, luau, zephyr-asdl:

-- A comment

Example from Rust:

// https://doc.rust-lang.org/reference/comments.html // a comment

Example from Haskell:

-- a single line comment {- A multiline comment which can continue for many lines -}

Example from Fortran:

C C Lines that begin with 'C' (in the first or 'comment' column) are comments C

Example from CSS:

/* This is a single-line comment */ p { color: red; }

Example from TypeScript, Objective-C, Groovy, Solidity, Reason, Pug, Vala, BCPL, ANTLR, Deno, Rust MIR, Wren, Ballerina, Hack, Yacc, V, Protocol Buffers, CIL, OpenCL, HCL, Fantom, SuperCollider, Ceylon, JSON5, PEG.js, Bison, FLUX, Koka, Eve, xBase, Zephir, Dafny, Java Bytecode, DOT, ATS, Modelica, SystemVerilog, Clipper, Bicep, Less, halide, LPC, Flow, CIL, JAI, odin, AspectJ, BETA, QML, Cg, Objective-J, SIL, Cue, idyll, Felix, JADE, Alloy, Click, PowerBuilder, Flow9, eC, P4, IGOR Pro, Angelscript, Whiley, PAWN, Cypher Query Language, DAX, SugarSS, MiniD, Not Quite C, SCSS, mlir, Ron, Volt, Concise Encoding, CIR, JSL, Spatial, OpenVera, Ligo, PowerQuery M, MQL5, Argdown, OX, mun-lang, Mask, Harbour, DM, Cell, Hocon, JSON with Comments, Linden Scripting Language, Script.NET, XBase++, Strips, Game Maker Language, Objective C++, KRL, Rescript, Not eXactly C, NetLinx, Logos, Q#, Cycript, POV-Ray SDL, Sophia, c3, Jsonnet, Fable, NS Basic, FutureBASIC, spiral, LoomScript, Slice, Type Language, Yoix, Judoscript, beads-lang, Tuple space, Vale, Adventure Game Studio Script, CartoCSS, gentee, kai, winxed, SimCode, Language Server Index Format, owen-lang, dlvm, Soy, MVEL, HuJSON, ShaderLab, Nymph, tht, Lite-C, silk, Heron, fizz, verifpal, Finite State Language, holyc, Maya Embedded Language, OEM, neeilang, hilvl, epsilon, flagship, StruQL, xxl, CFScript, OptimJ, Pnuts, Action Code Script, Operational Control Language, Treelang, ctalk-lang, dslx, rbscript, taichi, ddfql, sora:

// A comment

Example from Erlang:

% hello world program

Example from ARM, Emacs Lisp, MUMPS, Red, Hy, Guile, LFE, x86 Assembly, Csound, carp, NetLogo, CLIPS, wisp, Fennel, datascript, NCAR Command Language, Netwide Assembler, Action!, KiXtart, Augmented Backus-Naur Form, lispyscript, Jasmin, EuLisp, SMT, Bel, CLOS, neut, Project Mentat, carth, SRecode Template, Sweet Expressions, Reactive Plan Language, GCC Machine Description, Fjölnir, taf, z80, Guix Workflow Language, Plot, rosette-lang, PROMAL, lain, stella, turnstile, MACRO-10, atomese, wescheme, ca65 Assembly:

; A comment

Example from Pascal:

{ This is a single line comment in pascal. But needs to be closed. }

Example from Elixir:

# this is a comment

Example from OCaml:

(* This is a single-line comment. *) (* This is a * multi-line * comment. *)

Example from Dart:

// Hi /* Assume address is not null. */

Example from BASIC:

REM This BASIC program shows the use of the PRINT and GOTO Statements.

Example from CUDA, ActionScript, PostCSS, Opa, X10, PL/I, B, Nextflow, PARI/GP, DTrace, Jison, Lex, PL/M, JFlex, Xtend, Closure Templates, ARexx, XS, SourcePawn, CLIST, RenderScript, WebIDL, blockml, Edje Data Collection, Plus, Simple Actor Language System and Architecture, ProbeVue, Handel-C, Arden syntax, bioscript:

/* A comment */

Example from Tex, Mercury, KaTeX, Turing, Datalog, Mary, Eclipse Command Language, Charity:

% A comment

Example from Rexx:

* => 1000000000 */

Example from SPSS:

* A comment where first character must be *.

Example from Visual Basic .NET, Monkey, QB64, PowerBASIC, Spin, Xbasic, ThinBasic, Caché Basic, Turbo Basic, XBLite, WxBasic, Brightscript, StarOffice Basic, Creative Basic:

' A comment

Example from HAML:

-# A comment

Example from Oberon, Fortress, Isabelle, EBNF, UrWeb, Bluespec, COMPONENT PASCAL:

(* A comment *)

Example from SNOBOL, Refal, ActiveVFP:

* A comment

Example from XQuery:

(: Hello World with XQuery :)

Example from Wolfram Language:

(* A comment *)

Example from Batchfile:

REM A comment

Example from Object Pascal:

(* This is a multi-line comments and it will span multiple lines. *) { This is a single line comment in pascal }

Example from Ini:

# a '#' or ';' character indicates ; a comment

Example from Twig:

{# A comment #}

Example from HOPE:

--- A comment

Example from TLA:

\* A comment

Example from S-algol, True BASIC, Structured Query Reporter, BLISS, Module Management System:

! A comment

Example from Fibonacci:

(* query examples *)

Example from popr:

__ A comment

Example from Orc:

{- A comment -}

Example from Mouse:

~ A comment

Example from Quaint:

;; A comment

Example from Z:

-- A simple function, that is used inside the macro below. defun ap x y ++ x y defmacro : input z:string input -- Example with print: print : Hello, World! What's going on in here?

Example from Lexon:

COMMENT A comment

Example from FML:

# This is a line comment ### This is a block comment ###

Example from S3:

@ a comment @

Example from HAGGIS:

''' A comment '''

Example from Recfiles:

# Blah blah… # Unlike some file formats, comments in recfiles must be complete lines. You cannot start a comment in the middle of a line.

Example from dedukti:

(; This is a comment ;)

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements · Email · GitHub