syntax across languages (One Big Page) (original) (raw)

Introduction

What's this about?

This is of course incomplete. I welcome contributions!

You may also have a look at this information sorted by languages.

Light Version

Same content split into multiple html files

Categories


Various

| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| // | 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

Functions


Control Flow


Types


Object Oriented & Reflexivity


Package, Module


Strings

| #"z" | Rebol, SML |
| &z; | Oz |
| ?z | Emacs Lisp, Ruby |
| char z, [char] z(75) | Forth |

| ${#v} | BourneShell |
| dup(89) | Forth |


Booleans

| n | YAML |
| nil | Common Lisp, Emacs Lisp, Io, Lua, Ruby |
| no | CoffeeScript, Tcl, YAML |
| No | Prolog |
| none | Rebol |
| None | Python |
| null | CoffeeScript, JavaScript |
| NULL | C, C++, C99, PHP |
| off | CoffeeScript, Tcl, YAML |
| undef | Perl, Perl6 |
| undefined | CoffeeScript, JavaScript |
| fail | Prolog |
| FAIL | Maple |
| array containing at least one false value | Matlab |
| exit status different from 0 | BourneShell |
| 0(93) | Awk, B, C, C++, C99, Classic REXX, CoffeeScript, Forth, JavaScript, Matlab, MUMPS, Perl, Perl6, PHP, Pike, Python, Tcl, Visual Basic, XPath, Yorick |
| 0.0 | Matlab, Perl, PHP |
| NaN | CoffeeScript, JavaScript, XPath |
| "" | Awk, CoffeeScript, JavaScript, Perl, Perl6, PHP, Python, XPath |
| "0" | Awk, Perl, Perl6, PHP |
| '' | CoffeeScript, Matlab, Perl |
| '\0' | C, C++, C99 |
| () | Perl, Perl6, Python |
| [] | Matlab, Python |
| {} | Matlab, Python |
| array() | PHP |

| y | YAML |
| yes | CoffeeScript, Tcl, YAML |
| Yes | Prolog |
| on | CoffeeScript, Tcl, YAML |
| exit status 0 | BourneShell |
| anything not false | Awk, B, C, C++, Common Lisp, Dylan, Emacs Lisp, Matlab, MUMPS, Perl, Perl6, Pike, Python, Rebol, Ruby, Scheme, XPath, Yorick |
| 1 | Classic REXX, MUMPS |
| non zero number | Tcl |
| non-zero-numbers | Visual Basic |
| -1 | Forth |


Bags and Lists

| #(a b c)(99) | Smalltalk |
| { a. b. c } | Squeak |
| [ a ; b ; c ] | F#, OCaml |
| [ a b c ] | Logo, Oz, Rebol |
| ({ a, b, c }) | Pike |
| '(a b c) | Common Lisp, Emacs Lisp, Scheme |
| << a, b, c >> | Eiffel |
| list(a, b, c) | Io |
| list | Common Lisp, Dylan, Emacs Lisp, Scheme, Tcl |
| array(a, b, c) | PHP |
| new t[] { a, b, c } | C# |
| new[] { a, b, c } | C#3 |
| new List { a, b, c} | C#3 |
| Array(a, b, c)(100) | JavaScript |
| [NSArray arrayWithObjects:a, b, c, nil] | Objective-C |
| set l a b c | FishShell |
| - a - b - c | YAML |
| []t{a, b, c} | Go |

| len(l) | Go |


Various Data Types

| Nothing | Prolog |
1-uple

a or [a] Ruby
a, Perl6, Python
tuple([a]) Python
(a) Perl
((a)) merd
{a} Smalltalk
using a tuple for a function call
t merd, Perl
------------------------------ ------------
*t Python, Ruby
t{:} Matlab
f @@ t Mathematica
L =.. [ F | Args ], call(L) Prolog

| (empty) / ~ / null | YAML |
value

v Ada, C#, CoffeeScript, Common Lisp, Eiffel, Emacs Lisp, Java, JavaScript, Lua, Perl, Perl, Python, Ruby, Scheme, Smalltalk
*v(114) C, C++
Just v Haskell
Some v F#, OCaml
SOME v SML
type name
option F#, OCaml, SML
------ --------------
Maybe Haskell
null coalescing
COALESCE SQL92
--------------- ----------------------
?: PHP
|
//(116) Perl
?? C#
if(a, b) Visual Basic
or Python, Scheme

| normal function call | Common Lisp, Dylan, Haskell, Io, Smalltalk |


Mathematics

| 2^^1, 8^^7, 16^^f | Mathematica |
| 2r1, 8r7, 16rf | Smalltalk |
| #2r1, #8r7, #16rf | Common Lisp, Emacs Lisp |
| 1b, Fh | Pliant |
| '1'B, 'F'X | Classic REXX |
| B'1', X'F' | SQL92 |
| $f | Forth |
integer thousand-separator

1_000, 10_00, 100_0 Ada, E, Eiffel, OCaml, Perl, Perl6, Ruby
1'000, 10'00, 100'0 Rebol
1_000 merd
floating point
1000., 1E3 C, C++, Classic REXX, CoffeeScript, E, F#, Go, Java, JavaScript, Logo, Maple, OCaml, Python, Scheme, SQL92, Tcl
------------------------------ ---------------------------------------------------------------------------------------------------------------
1000., 1E3, 1,0 Rebol
1000., 1.E3 Eiffel, Oz
1000.0, 1E3 C#, Common Lisp, Emacs Lisp, PHP, Pike, Prolog, Ruby, Smalltalk
1000.0, 1.0E3 Ada, Haskell
1000, 1000.0, 1E3(127) Awk, merd, Perl, Perl6
1000., 1*^3, 1000` Mathematica
1000e, 1e3 Forth

| mod | F#, Forth, Lua, OCaml, Oz, Pascal, PostScript, Prolog, XPath |
| remainder | Logo, Ruby, Scheme |
| rem | Ada, BCPL, Haskell, Matlab, Smalltalk |
| // | Classic REXX, Rebol |
| \\ | Eiffel |


Threads


Remarks

Similar Pages

References

Credits


Pixel

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.0 Generic License.
Generated from <syntax-across-languages.html.pl>