Keyword Counts of Popular Programming Languages

Keys.

In a previous post, 10 Problems with ‘Hello World”, I made a remark that a ‘Hello World’ program only teaches you on average a single keyword. Without doing any research, I asserted that there are hundreds or thousands or keywords in a given programming language – until someone called me out on it.

What I found couldn’t be further from the truth.

Based on a list of the Most Popular Programming Languages, I researched how many keywords and reserved words each language had. I am certain my counts are not exact and depending on specific implementations and versions of languages – the keyword counts may vary.

Here are my findings in descending keyword/reserved word count:

VB.NET

Keyword/Reserved Word Count: 159

AddHandler AddressOf Alias And AndAlso
As Boolean ByRef Byte ByVal
Call Case Catch CBool CByte
CChar CDate CDbl CDec Char
CInt Class CLng CObj Const
Continue CSByte CShort CSng CStr
CType CUInt CULng CUShort Date
Decimal Declare Default Delegate Dim
DirectCast Do Double Each Else
ElseIf End EndIf Enum Erase
Error Event Exit False Finally
For (in For…Next) For Each…Next Friend Function Get
GetType GetXMLNamespace Global GoSub GoTo
Handles If Implements Imports In
Inherits Integer Interface Is IsNot
Let Lib Like Long Loop
Me Mod Module MustInherit MustOverride
MyBase MyClass Namespace Narrowing New
Next Not Nothing NotInheritable NotOverridable
Object Of On Operator Option
Optional Or OrElse Out Overloads
Overridable Overrides ParamArray Partial Private
Property Protected Public RaiseEvent ReadOnly
ReDim REM RemoveHandler Resume Return
SByte Select Set Shadows Shared
Short Single Static Step Stop
String Structure Sub SyncLock Then
Throw To True Try TryCast
TypeOf…Is UInteger ULong UShort Using
Variant Wend When While Widening
With WithEvents WriteOnly Xor #Const
#Else #ElseIf #End #If

Source: http://msdn.microsoft.com/en-us/library/dd409611.aspx


C++

Keyword/Reserved Word Count: 144

registerreinterpret_castreturnsafecastsealed

__abstract __alignof __asm __assume __based
__box __cdecl __declspec __delegate __event
__except __fastcall __finally __forceinline __gc
__hook __identifier __if_exists __if_not_exists __inline
__int16 __int32 __int64 __int8 __interface
__leave __m128 __m128d __m128i __m64
__multiple_inheritance __nogc __noop __pin __property
__raise __sealed __single_inheritance __stdcall __super
__thiscall __try/__except __try/__finally __try_cast __unaligned
__unhook __uuidof __value __virtual_inheritance __w64
__wchar_t wchar_t abstract array auto
bool break case catch char
class const const_cast continue decltype
default delegate delete deprecated dllexport
dllimport do double dynamic_cast else
enum event explicit extern false
finally float for for each, in friend
friend_as gcnew generic goto if
initonly inline int interface interior_ptr
literal long mutable naked namespace
new noinline noreturn nothrow novtable
nullptr operator private property protected
public ref selectany short signed
sizeof static static_assert static_cast struct
switch template this thread throw
true try typedef typeid typename
union unsigned using uuid value
virtual void volatile while

Source: http://msdn.microsoft.com/en-us/library/2e6a4at9(v=VS.100).aspx


C#

Keyword/Reserved Word Count: 98

abstract as base bool break
byte case catch char checked
class const continue decimal default
delegate do double else enum
event explicit extern false finally
fixed float for foreach goto
if implicit in int interface
internal is lock long namespace
new null object operator out
override params private protected public
readonly ref return sbyte sealed
short sizeof stackalloc static string
struct switch this throw true
try typeof uint ulong unchecked
unsafe ushort using virtual void
volatile while add alias ascending
descending dynamic from get global
group into join let orderby
partial remove select set value
var where yield

Source: http://msdn.microsoft.com/en-us/library/x53a06bb(v=VS.100).aspx


PHP

Keyword/Reserved Word Count: 56

abstract and array() as break
case catch cfunction class clone
const continue declare default do
else elseif enddeclare endfor endforeach
endif endswitch endwhile extends final
for foreach function global goto
if implements interface instanceof namespace
new old_function or private protected
public static switch throw try
use var while xor __CLASS__
__DIR__ __FILE__ __LINE__ __FUNCTION__ __METHOD__
__NAMESPACE__

Source: http://php.net/manual/en/reserved.keywords.php


Java

Keyword/Reserved Word Count: 53

abstract continue for new switch
assert default goto package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp volatile
const float native super while
true false null

Source: http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html


Ruby

Keyword/Reserved Word Count: 42

BEGIN END __ENCODING__ __END__ __FILE__
__LINE__ alias and begin break
case class def defined? do
else elsif end ensure false
for if in module next
nil not or redo rescue
retry return self super then
true undef unless until when
while yield

Source: http://www.ruby-doc.org/docs/keywords/1.9/


Javascript

Keyword/Reserved Word Count: 29

break const continue delete do
while export for function if
else import in instanceOf label
let new return switch this
throw try catch typeof var
void while with yield

Source: http://www.aptana.com/reference/html/api/JSKeywords.index.html


Python

Keyword/Reserved Word Count: 29

and del for is raise
assert elif from lambda return
break else global not try
class except if or while
continue exec import pass yield
def finally in print

Source: http://docs.python.org/release/2.3.5/ref/keywords.html


If you find any errors or omissions, please let me know. If there is a particular language I did not include, please share the keyword/reserved word source and I would be happy to add it.

Tagged with: , , , , , , , ,
Posted in Technical
0 comments on “Keyword Counts of Popular Programming Languages
1 Pings/Trackbacks for "Keyword Counts of Popular Programming Languages"

Leave a Reply