until end of line
# | Awk, BourneShell, CoffeeScript, E, FishShell, GNU-bc, GNU-sed, Icon, Io, Julia, Maple, merd, Perl, Perl6, PHP, Pliant, Python, Ruby, Tcl, YAML |
// | BCPL, C#, C++, C99, Dylan, F#, Go, Io, Java, JavaScript, PHP, Pike, Scilab, YCP, Yorick |
-- | Ada, Cecil, Eiffel, Haskell, Lua, Sather, Simula, SQL92 |
; | Assembler, Common Lisp, Emacs Lisp, Logo, MUMPS, Rebol, Scheme |
% | Erlang, Matlab, Mercury, Oz, PostScript, Prolog, TeX |
rem | Basic |
' | Visual Basic |
" | Vimscript |
\ | Forth |
! | Assembler, Fortran90 |
NB. | J |
C or * in column 1 | Fortran |
nestable
(* ... *) | Beta, F#, Mathematica, Modula-3, OCaml, Pascal, SML |
%( ... %) | Matlab |
/* ... */ | Classic REXX, Dylan, Io, Oz, SQL99 |
{ ... } | Pascal, Rebol |
{- ... -} | Haskell |
#| ... |#(1) | Common Lisp, Scheme |
#= ... =# | Julia |
#[ ... ] | Perl6 |
#if 0 ... #endif | C |
comment { ... } | Rebol |
comment [ ... ] | Rebol |
[ ... ](2) | Rebol |
--[[ ... ]] | Lua |
non nestable
" ... " | Smalltalk |
/* ... */ | B, C, C#, C++, CSS, GNU-bc, Go, Java, JavaScript, Mercury, PHP, Pike, PL/I, YCP, Yorick |
<!-- ... --> | HTML, XML |
( ... ) | Forth |
### ... ### | CoffeeScript |
until end of line
/// | C#, F#, Java |
-- | | Haskell |
-- ^ | Haskell |
non nestable
/** ... */(3) | C, C#, E, Java, JavaScript, PHP |
(** ... *) | F# |
{-| ... -} | Haskell |
(** ... *) | OCaml |
/* DOCUMENT ... */ | Yorick |
indexing identifier: "..."; | Eiffel |
someClass comment: '...' | Smalltalk |
rebol [ Note: "..." ] | Rebol |
func ["..." arg] ... | Rebol |
class X: """... """ def x(): """... """(4) | Python |
(define (f para1 para2) "..." ...) | Scheme |
(defun f (para1 para2) "..." ...) | Common Lisp, Emacs Lisp |
=pod ... =cut(5) | Perl, Perl6 |
=begin ... =end | Ruby |
function MYFUNCTION %MYFUNCTION the very first comment line is displayed in the help table of contents % % the remaining lines are displayed when getting help for MYFUNCTION % | Matlab |
__LINE__ __FILE__ | C, C++, Perl, PHP, Pike, Ruby |
__LINE__ __SOURCE_FILE__ | F# |
$?LINE $?FILE | Perl6 |
__file__ | Python |
(new System.Diagnostics.StackFrame(true)).GetFileLineNumber() (new System.Diagnostics.StackFrame(true)).GetFileName() | C# |
Thread.currentThread().getStackTrace()[1].getLineNumber(); Thread.currentThread().getStackTrace()[1].getFileName(); | Java |
system/script/header/file(6) | Rebol |
SOURCELINE() / parse source OS . SOURCENAME | Classic REXX |
info frame 0 | Tcl8.5 |
thisContext lineNumber / thisContext method source | Smalltalk |
runtime.Caller(0) | Go |
case-sensitivity (keywords, variable identifiers...)
case-sensitive | Awk, B, BourneShell, C, C#, C++, CoffeeScript, F#, FishShell, Go, Haskell, Io, Java, JavaScript, Lua, Maple, Mathematica, Matlab, merd, Modula-3, OCaml, Perl, Perl6, Pike, Pliant, Prolog, Python, Ruby, Smalltalk, Tcl, XML, YAML, Yorick |
case-insensitive | Ada, Assembler, Classic REXX, Common Lisp, CSS, Eiffel, Forth, HTML, Logo, Pascal, PL/I, Rebol, SGML, SQL92, Visual Basic |
case-sensitive: variables case-insensitive: keywords, functions, constants... | PHP |
case-sensitive: identifiers case-insensitive: keywords | E |
case-sensitive: identifiers case-insensitive: commands | MUMPS |
case-sensitive: upper case disallowed | GNU-bc |
what is the standard way for scrunching together multiple words
camelCase | CoffeeScript, JavaScript |
CamelCase or camelCase | C#, E, Go, Haskell, Io, Java, JavaScript, Mathematica, Pascal, Smalltalk, Tcl, Visual Basic |
underscores | FishShell, GNU-bc, merd |
dots | Logo |
hyphens | Common Lisp, Emacs Lisp, Rebol, Scheme |
underscores for functions / types, unclear for modules / constructors | OCaml |
UPPER_CASE | BourneShell |
lowercasenoseparator | Matlab |
underscores, UPPER_CASE for class names | Eiffel |
CamelCase for classes, underscores for methods | Python |
CamelCase for types, underscores for functions, variables, ... | Pliant |
CamelCase for methods, types and modules, underscore for functions | F# |
CamelCase for modules and classes, ALL_CAPS for constants, underscores for functions, variables, ... | Ruby |
CamelCase for modules and classes, ALLCAPS for macros, underscores for methods, constants and variables | Pike |
CamelCase for modules, ALL_CAPS for constants, unclear for functions / variables | Perl, Perl6 |
CamelCase for variables, underscores for predicates | Prolog |
usually lowercase or underscores, ALL_CAPS for macros | C |
usually underscores | C++ |
Camel_Case | Ada |
variable identifier regexp
[a-zA-Z][a-zA-Z0-9]* | FishShell, Mathematica, PL/I, Smalltalk |
[a-zA-Z][_a-zA-Z0-9]* | Eiffel, Matlab, Vimscript |
[a-zA-Z](_?[a-zA-Z0-9])* | Ada |
[_a-zA-Z][_a-zA-Z0-9]* | Awk, B, C, C#, C++, E, Go, Maple, PHP, Python, Tcl |
[_a-zA-Z0-9]+ | BourneShell, Perl, Perl6 |
[a-zA-Z0-9]+ | FishShell |
[_a-zA-Z][_a-zA-Z0-9]* or '[^']*' | Pliant |
[_a-zA-Z$][_a-zA-Z0-9$]* | Java |
[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]* | CoffeeScript, JavaScript |
[a-zA-Z%][a-zA-Z0-9]* | MUMPS |
[_a-z][_a-zA-Z0-9]* | Ruby |
[_a-z][_a-zA-Z0-9]*[!?']* | merd |
[_a-z][_a-zA-Z0-9']* | Haskell, OCaml, SML |
[_a-zA-Z][_a-zA-Z0-9']* | F# |
[_A-Z][_a-zA-Z0-9]* | Mercury, Prolog |
[_a-zA-Z!0&*/:<=>?^][_a-zA-Z!0&*/:<=>?^0-9.+-]* | Scheme |
[a-zA-Z!?@#][a-zA-Z0-9!?@#]* | Classic REXX |
[_a-zA-Z?!.'+*&|=~-][_a-zA-Z0-9?!.'+*&|=~-]* or
[^0-9[](){}":;/][^ \n\t[](){}":;/]* | Rebol |
[a-z][a-z0-9_]* | GNU-bc |
anything without a space and is not a number | Common Lisp, Forth |
function identifier regexp (if different from variable identifier regexp)
[_a-zA-Z][_a-zA-Z0-9]*[!?]? | Ruby |
[_a-z][_a-zA-Z0-9]* | Mercury, Prolog |
[A-Z][_a-zA-Z0-9]*(7) | Vimscript |
[^ \t\n\r\f]+ | Tcl |
[^ \t\n\r\f/]+ | FishShell |
keyword regexp (if different from variable identifier regexp)
[A-Z]+ | Modula-3 |
type regexp (if different from variable identifier regexp)
[_A-Z][_a-zA-Z0-9']* | Haskell |
[_a-z][_a-zA-Z0-9']* | Mercury, OCaml |
constant regexp (if different from variable identifier regexp)
[A-Z][_a-zA-Z0-9]* | Ruby |
[_A-Z][_a-zA-Z0-9']* | Haskell, OCaml |
[_a-z][_a-zA-Z0-9']* | Mercury |
nothing needed | Ada, B, C, C#, C++, Common Lisp, D, Eiffel, Emacs Lisp, F#, Forth, Go, Haskell, Java, JavaScript, Maple, Mathematica, OCaml, Oz, Pascal, Perl, Perl6, PHP, PostScript, Rebol, Scheme, Smalltalk, SML, XSLT, YCP |
\ | Awk, BourneShell, C, CoffeeScript, E, FishShell, GNU-bc, Io, Python, Ruby, Tcl |
_ | Visual Basic |
, | Classic REXX |
~ | Logo |
... | Matlab |
assignment
= | Awk, B, Basic, BourneShell, C, C#, C++, Classic REXX, Erlang, Go, Icon, Io, Java, JavaScript, Lua, Mathematica, Matlab, Oz, Perl, Perl6, PHP, Pike, YCP, Yorick |
:= | Ada, BCPL, Cecil, Dylan, E, Eiffel, Maple, Mathematica, Modula-3, Pascal, Pliant, Sather, Simula, Smalltalk, SML |
<- | F#, OCaml |
_(8) | Squeak |
: | BCPL, Rebol |
->(9) | Beta |
def | PostScript |
setq | Common Lisp, Emacs Lisp |
setf | Common Lisp |
set | Common Lisp, FishShell, Rebol |
SET v=... | MUMPS |
set! | Scheme |
is | Prolog |
make "v e | Logo |
e v ! | Forth |
declaration
= | Haskell, Mercury, Prolog |
<- | Haskell |
:- | Prolog |
:= | Io |
let v = e in | F#, OCaml |
let val v = e in | SML |
let v = e(10) | BCPL, F#, Vimscript |
def v := e / var v := e | E |
my / our / local / use vars | Perl |
my / our / temp | Perl6 |
define | Dylan, Scheme |
let let* | Common Lisp, Scheme |
letrec | Scheme |
flet labels defun defmethod defvar defparameter defsetf .. | Common Lisp |
local V1 = e V2 = e2 in ... end | Oz |
global v1, v2 | Python |
global v1 v2 | Matlab, Scilab |
:@ | Beta |
NEW v | MUMPS |
v: t | Ada, Eiffel, Pascal |
t v | C, C#, C++, Java |
var v t | Go |
| v1 v2 | | Smalltalk |
auto v1, v2; extrn v3, v4; | B |
auto | GNU-bc |
var | JavaScript, Pliant |
gvar | Pliant |
variable v(11) | Forth |
e value v | Forth |
Module[{x, y = v}, ... ] | Mathematica |
Block[{x, y = v}, ... ] | Mathematica |
With[{c1 = v1, c2 = v2, ... }, ...] | Mathematica |
<xsl:variable name="v" select="e"/> | XSLT |
both
= | CoffeeScript, GNU-bc, merd, Python, Ruby |
:= | Go, merd |
set, variable | Tcl |
( ... ) | Ada, Awk, B, BCPL, Beta, C, C#, C++, Classic REXX, CoffeeScript, D, E, Eiffel, F#, GNU-bc, Go, Haskell, Io, Java, JavaScript, Julia, Logo, Lua, Maple, Mathematica, Matlab, merd, Modula-3, MSH, MUMPS, OCaml, Oz, Pascal, Perl, Perl6, PHP, Pike, Pliant, Prolog, Python, Rebol, Ruby, Scilab, Smalltalk, SML, SQL92, Tcl, Vimscript, XPath, YCP, Yorick |
[ ... ] | Rebol |
indentation | merd |
$ ... | Haskell |
begin ... end | F#, FishShell, OCaml, Ruby |
space(12) | merd |
{ ... } | Awk, BCPL, BourneShell, GNU-bc, GNU-sed, JavaScript, PHP, Pike, Tcl, Yorick |
{ ... }(13) | B, C, C#, C++, E, Go, Haskell, Java, Modula-3, Perl, Perl6, YCP |
( ... )(13) | BourneShell |
[ ... ](14) | Logo, Smalltalk |
"..." | Tcl |
begin ... end(13) | Ada, Pascal |
(begin ...) | Scheme |
BEGIN ... END | Modula-3 |
do ... end | Classic REXX |
do ... end(13) | Lua, PL/I |
indentation | CoffeeScript, F#, MUMPS, Pliant, Python |
indentation(13) | Haskell, merd |
foo ... end where foo in { if, do, ... } | Modula-2, Ruby |
foo ... end where foo in { if, for, while, ... } | Matlab, Scilab |
foo ... end where foo in { if, loop, ... } | Eiffel |
foo ... end foo where foo in { if, do, ... } | Ada, Fortran90 |
(* ... *)(15) | BCPL |
(# ... #) | Beta |
valof | BCPL |
do | Perl, Perl6 |
proc() .. end proc | Maple |
shallow
== != | Awk, B, C, C++, CoffeeScript, F#, Go, Io, Java, OCaml, Perl, Perl6, Pike, Yorick |
= /= | Eiffel, Fortran90 |
= <> | Forth, Logo, Maple, Modula-2, Pliant, Rebol |
= #(16) | Modula-2, Modula-3 |
= != | BourneShell, FishShell |
== === != !==(17) | JavaScript, PHP |
=== !== | Perl6, PHP5 |
== ~= | Lua |
== ~~ | Smalltalk |
== ~== | Dylan |
= '= | MUMPS |
= ~= neqv(15) | BCPL |
f= f<> | Forth |
is_equal(18) | Eiffel |
eq ne | Emacs Lisp, PostScript |
eq, eql | Common Lisp |
eq? eqv? | Scheme |
.EQ. .NE. | Fortran |
is / is not | Python |
is / isnot | Vimscript |
deep
== != | Awk, C#, C++, E, merd, PHP5, Python, Ruby, Tcl, Vimscript, YCP |
== <> | Python |
== /= | Haskell |
== \= | Oz |
== \== | Classic REXX, Prolog |
= /= | Ada |
= != | Maple, XPath |
= <> | Beta, F#, OCaml, Pascal, Rebol, SML, SQL92, Visual Basic |
= ~= | Dylan, Smalltalk |
== ~= eq ne isequal isequalwithequalnans | Matlab |
== ~= eq ne isequal | Scilab |
=@= \=@= / = \= / =:= =\=(19) | Prolog |
=== =!= / == !=(20) | Mathematica |
.eq | Logo |
equal? | Scheme |
equals | Java |
equal | Common Lisp, Emacs Lisp, Pike |
equalp | Common Lisp |
eqv | Perl6 |
deep_is_equal | Eiffel |
isEqual | Objective-C |
< > <= >= | Ada, Awk, Awk, B, Beta, C, C#, C++, Classic REXX, CoffeeScript, Common Lisp, Dylan, E, Eiffel, Emacs Lisp, F#, Forth, Go, Haskell, Io, Java, JavaScript, Logo, Lua, Maple, Mathematica, Matlab, merd, Modula-3, OCaml, Pascal, Perl, Perl6, PHP, Pike, Pliant, Python, Rebol, Ruby, Scheme, Scilab, Smalltalk, SML, SQL92, Tcl, Vimscript, Visual Basic, XPath, YCP, Yorick |
< > =< >= | Mercury, Oz |
< > '> '< | MUMPS |
<< >> <<= >>=(21) | Classic REXX |
@< / @=< / @> / @>= | Prolog |
lt gt le ge | Perl, Perl6, PostScript |
-lt -gt -le -ge | BourneShell, FishShell, MSH |
.LT. .GT. .LE. .GE. | Fortran |
u< u> u<= u>= | Forth |
f< f> | Forth |
returns 3 values (i.e. inferior, equal or superior)
a <=> b | merd, Perl, Perl6, Ruby |
cmp | Perl, Perl6, Python |
compare | F#, Forth, Haskell, Mercury, OCaml, Pliant, Prolog, Smalltalk |
strcmp | C, PHP |
three_way_comparison | Eiffel |
string compare | Tcl |
compareTo | Java |
strings.Compare() | Go |
returns 4 values (i.e. inferior, equal, superior or not comparable)
compare | Pliant |
compareTo | E |
min / max (binary or more)
min / max | Beta, C++, Common Lisp, Dylan, E, Eiffel, F#, Forth, Haskell, Io, Java, Lua, Maple, Matlab, merd, OCaml, PHP5, Pike, Pliant, Prolog, Python, Rebol, Scheme, Scilab, Smalltalk, SQL92, Tcl8.5, Yorick |
min minstr / max maxstr(22) | Perl |
Min / Max | Mathematica, Oz |
MIN / MAX | Classic REXX, Modula-3 |
measure-object -min / measure-object -max | MSH |
fmin / fmax | Forth |
Integer'min / Integer'max | Ada |
eval | BourneShell, Common Lisp, Emacs Lisp, FishShell, JavaScript, Matlab, Perl, Perl6, PHP, Python, Ruby, Scheme, Tcl, YCP |
CoffeeScript.eval(23) | CoffeeScript |
exec | Python |
evstr / execstr | Scilab |
dostring | Lua |
doString | Io |
evaluate | Forth |
Compiler evaluate: | Smalltalk |
runtime_compile / compile + execute | Pliant |
Compiler.evalExpression or Compiler.parseOzVirtualString | Oz |
compile_string | Pike |
interpret | Classic REXX |
ToExpression | Mathematica |
run | Logo |
XECUTE | MUMPS |
do / reduce / compose / load | Rebol |
[...] | Tcl |
=..(24) | Prolog |
allocation
malloc | C |
allocate throw | Forth |
new | Ada |
deallocation
free | C |
free throw | Forth |
doGC | Beta |
GC.start | Ruby |
gc | Logo, Maple, Pike |
System.gc() | Java |
System.gcDo | Oz |
System.GC.Collect() | C#, F# |
gc.collect() | Python |
gc_collect_cycles(25) | PHP5 |
full_collect | Eiffel |
garbage_collect | Mercury, Prolog |
collectgarbage | Lua |
Collector collect | Io |
VM.garbageCollect() | JavaScript |
Gc.full_major() | OCaml |
Smalltalk garbageCollect | Smalltalk |
System.Mem.performGC | Haskell |
incremental garbage collection => not needed | Perl, Perl6 |
recycle | Rebol |
interp.gc() | E |
(ext:gc) | Common Lisp |
runtime.GC() | Go |