您的位置:首页 > 编程语言

流行编程语言及其注释方式一览表

2017-04-06 15:22 676 查看


1.各种编程语言的注释符号比较

编程语言分类
 
按平台
.NET框架平台语言C++/CLI 
C# 
F# 
IronPython 
IronRuby 
J# 
Visual C# 
VB.NET 
Small Basic

 
Java虚拟机上的语言Java 
Jython 
JRuby 
JScheme 
Groovy 
Kawa 
Scala 
Clojure 
Kotlin

 
按家族
C/C++语言C 
C++ 
Turbo C++ 
Borland C++ 
C++ Builder - C++/CLI 
Visual C++组件扩展 
Objective-C 
Visual C++

 
BASIC语言
有行号BASIC 
BASICA 
GW-BASIC 
ETBASIC 
GVBASIC

 
无行号QBASIC 
QuickBASIC 
True BASIC 
Turbo BASIC 
PowerBASIC 
FreeBasic 
DarkBASIC 
Visual Basic 
Gambas 
VB.NET 
VBScript 
VBA 
REALbasic 
Small Basic

 
Pascal/Delphi语言Pascal 
Turbo Pascal 
Object Pascal 
Free Pascal 
Delphi 
Lazarus

 
范式
声明式
函数式
Lisp家族LISP 
Scheme 
Common Lisp 
Clojure 
Racket

 
ML家族ML 
Standard ML 
OCaml 
F#

 
Haskell 
Scala 
Erlang 
Elixir 
Clean 
Miranda 
Logo

 
逻辑式Prolog

 
命令式
结构化
程序式BASIC 
Fortran 
C 
Pascal 
Go

 
面向对象Smalltalk 
Java 
C# 
Objective-C 
C++ 
Eiffel 
Python 
Ruby 
Rust 
Swift

 
非结构化
COBOL

 
元编程
泛型
模板C++ 
D

 
Ada 
C# 
Delphi 
Eiffel 
Java 
Swift 
Visual Basic .NET

 
反射化C# 
ECMAScript 
Java 
Perl 
PHP 
Python 
R 
Ruby

 
脚本语言
Lua 
Perl 
PHP 
Python 
Ruby 
ASP 
JSP 
Tcl/Tk 
VBScript 
AppleScript 
AAuto(基于Lua)

 
ECMAScript衍生语言ActionScript 
CoffeeScript 
Dart 
DMDScript 
ECMAScript 
JavaScript 
JScript 
TypeScript

 
Shell语言sh 
bash 
sed 
awk 
PowerShell 
csh 
tcsh 
ksh 
zsh

 
专业工具语言
科学与统计计算FORTRAN 
SAS 
MATLAB 
Scilab 
GNU Octave 
R 
S-Plus 
Mathematica 
Maple 
Julia

 
GPU用着色器语言Cg 
GLSL 
HLSL

 
数据库相关编程语言xBase 

 

Clipper 
Visual FoxPro 

  
SQL 

 

PL/SQL 
T-SQL 
SQL/PSM 

  
LINQ 
XQuery

 
标记语言
SGML家族
XML家族XML 
SVG 
XML Schema 
XSLT 
XHTML 
MathML 
XAML 
SSML

 
SGML 
HTML

 
Curl

 
工业与辅助设计AutoCAD

 
其它汇编语言 
ALGOL 
APL/J 
Falcon 
Forth 
Io 
MUMPS 
PL/I 
PostScript 
REXX 
SAC 
Self 
Simula


2.程语言的注释:

Comment comparison

There is a wide variety of syntax styles for declaring comments in source code.
BlockComment
in italics is used here to indicate block comment style.
InlineComment

in italics is used here to indicate inline comment style.

 
Language(编程语言)In-line comment(行注释)Block comment(块注释)
Ada,Eiffel,Euphoria,Occam,SPARK,
ANSI
SQL, and
VHDL
-- InlineComment
 
ALGOL 60 
comment BlockComment;
ALGOL 68 
¢ BlockComment ¢

comment
BlockComment comment

co BlockCommentco

# BlockComment #

£ BlockComment £


AppleScript
-- InlineComment
(* BlockComment *)
Assembly language (varies)
; InlineComment
   one example (most assembly languages use line comments only)
 
AutoHotkey
; InlineComment
/* BlockComment */
AWK,Bash,Bourne
shell,
C shell,
Maple,
R,
Tcl, and
Windows PowerShell
# InlineComment
<# BlockComment #>
BASIC (various dialects):
'InlineComment
(not all dialects) 
REM InlineComment

 
C (K&R, ANSI/C89/C90),CHILL,PL/I,
and
REXX
 
/* BlockComment */
C (C99),C++,Go,
and
JavaScript
// InlineComment
/* BlockComment */
C#
// InlineComment

/// InlineComment
(XML documentation comment)
/* BlockComment */

/** BlockComment */
(XML documentation comment)
COBOL
InlineComment
(when * or / is in column 7)
*> InlineComment

 
Curl
||InlineComment
|#
BlockComment #|

|foo#BlockComment #|

Cobra
# InlineComment
/# BlockComment #/
(nestable)
D
// InlineComment

/// Documentation InlineComment
(ddoc comments)
/* BlockComment */

/** Documentation BlockComment */
(ddoc comments)
/+ BlockComment +/
(nestable)
/++ Documentation BlockComment +/
(nestable,ddoc comments)
DCL
$! InlineComment
 
ECMAScript (JavaScript,ActionScript,
etc.)
// InlineComment
/* BlockComment */
Forth
\ InlineComment
( BlockComment )
(single line as well as multiline)
( before --
after )
stack comment convention
Fortran 66/77
C InlineComment
(the letter 'C' in the first column makes the entire line a comment).
 
Fortran 90
! InlineComment
(all characters on the line, from the exclamation mark onwards, are comments)
 
Haskell
-- InlineComment
{- BlockComment -}
Java
// InlineComment
/* BlockComment */

/** BlockComment */
(Javadoc documentation comment)
Lisp andScheme
; InlineComment
#|BlockComment|#
Lua
-- InlineComment
--[==[
BlockComment]==]
(variable number of = signs)
Maple
# InlineComment
(* BlockComment *)
Mathematica 
(* BlockComment *)
Matlab
% InlineComment
%{
BlockComment (nestable)

%}


Note: Both percent–bracket symbols must be the only non-whitespace characters on their respective lines.
Object Pascal (Delphi)
// InlineComment
(* BlockComment *)

{ BlockComment }
OCaml 
(* BlockComment (* nestable *) *)
Pascal,Modula-2,Modula-3,Oberon,
and
ML:
 
(* BlockComment *)
Perl andRuby
# InlineComment

=begin
BlockComment

=cut
(
=end
in Ruby) (POD documentation comment)
__END__
Comments after end of code

PHP
# InlineComment

// InlineComment
/* BlockComment */

/** Documentation BlockComment */
(PHP Doc comments)
PILOT
R:InlineComment
 
PLZ/SYS 
! BlockComment !
PL/SQL andTSQL
-- InlineComment
/* BlockComment */
Python
# InlineComment

'''BlockComment'''

""" BlockComment """

(Documentation string when first line of module, class, method, or function)
Rust
// InlineComment

/// InlineComment
("Outer" rustdoc comment)
//! InlineComment
("Inner" rustdoc comment)
/* BlockComment */
(nestable)
/** BlockComment */
("Outer" rustdoc comment)
/*! BlockComment */
("Inner" rustdoc comment)
SAS 
* BlockComment;

/* BlockComment */
Seed7
# InlineComment
(* BlockComment *)
Simula 
comment BlockComment;

! BlockComment;
Smalltalk 
"BlockComment"
Smarty 
{* BlockComment *}
Standard ML 
(* BlockComment *)
TeX,LaTeX,PostScript,Erlang,
and
S-Lang
% InlineComment
 
Texinfo
@c InlineComment

@comment InlineComment

 
TUTOR
* InlineComment

command $$ InlineComment
 
Visual Basic
'InlineComment

Rem InlineComment
 
Visual Basic .NET
'InlineComment

'''InlineComment
(XML documentation comment)
Rem InlineComment

 
Visual Prolog
% InlineComment
/* BlockComment */
Wolfram Language 
(* BlockComment *)
Xojo
' InlineComment

// InlineComment

rem InlineComment
 
文章内容来自:
https://zh.wikipedia.org/wiki/Template:程序设计语言 https://en.wikipedia.org/w/index.php?title=Comparison_of_programming_languages_(syntax)&action=edit§ion=23
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  编程语言 注释