Editing style in this wiki:
Specification[]
- Specifications may be written in an easy to moderately easy to understand manner, suited for beginners.
- Derivative specs may be written assuming the reader knows the 'base' specs. For example, SVG, an XML format, may be explained assuming the reader already understands the XML format.
- Go straight to the point. Do not clarify or comment on anything outside the topic. (Minor comments can be added as a side note. (Like this one))
Programming languages[]
PL syntax must be summarized in this table format (with examples):
Property/code construct | Syntax |
---|---|
General | |
Paradigm | Object-oriented |
Genre | Scripting |
Basic methods | |
Subroutine call | subroutine_identifier(param1[,param2][...]) |
Function call | function_identifier(param1[,param2][...]) |
Subroutine block declaration | void subroutine_identifier(param1[,param2][...]) { ... } |
Function block declaration | Function FunctionIdentifier(param1[,param2][...]) ... End Function |
Main method call | int main(int argc, int argv[]) |
Function termination | return expr |
Subroutine termination | Return |
Line separation and character significance | |
Line separator | ;, line break for directives, none for block |
Line continuation | none |
Single line statement separator | ; |
Standard statement block | { ... } |
Block statements visual prefix | Tab (recommended) |
Insignificant characters | Whitespace |
Comments and documentation | |
Single line comment | // ... |
Multiline comment | /* ... */ |
Documentation | /// <summary>...</summary> |
Variables | |
Type declaration and initialization | var variable_identifier = init_value |
Object declaration and initialization | Dim var As New obj_type() |
Reference declaration | type * variable_identifier |
Allocation | variable_identifier = (type *)malloc(size_of_variable) |
Comparison | |
Equality / logical biconditional | var1 == var2 |
Inequality | var1 != var2 |
Type and value equality | var1 === var2 |
Reference equality | var1 Is var2 |
Reference inequality | var1 IsNot var2 |
Greater than | var1 > var2 |
Less than | var1 < var2 |
Greater than or equal to | var1 >= var2 |
Less than or equal to | var1 <= var2 |
Logical and bitwise operations | |
Logical conjunction | var1 And var2 |
Logical disjunction | var1 || var2 |
Logical negation | Not var |
Sheffer stroke | N/A |
Joint denial | N/A |
Logical exclusive or | var1 Xor var2 |
Short-circuit logical conjunction | var1 && var2 |
Short-circuit logical disjunction | var1 OrElse var2 |
Bitwise conjunction | var1 & var2 |
Bitwise disjunction | var2 |
Bitwise negation | !var1 |
Built-in data types | |
Boolean type | bool |
Integer types | Byte (8-bit), Short (16-bit), Integer (32-bit), Long (64-bit) |
Floating point and fractional types | Single, Double, Decimal |
Base type | Object |
Text types | Char, String |
Date types | Date (64-bit) |
Discrete data structures | Defined in framework |
Arrays | Type() |
Array declaration and initialization | type var[dimension1[,dimension2]...] = { e1[,e2][...] } |
Array element retrieval | var[index] |
Other constructs | N/A |
Conditionals | |
Single line conditional | if (condition_expr_bool) statement_if_true [else if (condition_expr_bool2) statement_if_true2][...][else statement_if_false] |
Conditional block declaration | if (condition_expr_bool) { ... } [else if (condition_expr_bool2) { ... }][...][else { ... }] |
Conditional block skip | N/A |
Ternary conditional | condition ? retval_true : retval_false |
Short-circuit ternary conditional | If(condition, retval_true, retval_false) |
Case evaluation | |
Case evaluation block declaration | Select Case expr |
Case evaluation break | break |
Basic arithmetic | |
Addition | var1 + var2 |
Subtraction | var1 - var2 |
Multiplication | var1 * var2 |
Division | var1 / var2 (resulting type is the type of the operands) |
Modulo (Remainder) | var1 Mod var2 |
Increment by one | var++ |
Decrement by one | var-- |
Pre-increment by one | ++var |
Pre-decrement by one | --var |
Addition in place | var += expr |
Subtraction in place | var -= expr |
Multiplication in place | var *= expr |
Division in place | var /= expr |
Modulo in place | var %= expr |
Iteration and looping | |
Preconditional loop block declaration | while (expr) { ... } |
Postconditional loop block declaration | do { ... } while (expr) |
Conditional control variable iteration | for (var = initial_val_expr; iteration_condition; iteration_step) { ... } |
Collection iteration | For Each var [As collection_item_type] In collection |
Loop break | break |
Loop iteration continuation | Continue For (For...Next, For Each...Next), Continue Do (Do...While) |
Exceptions and handling | |
Exception handling block declaration | try { statements that may throw exceptions } catch (exception_type exception_var) { statements to handle exception } [catch (exception_type2 exception_var) { ... }] [...] [finally { ... }] |
Exception (base) type | System.Exception |
Exception handling line/subroutine declaration | Gosub line_number) |
Exception handling line/subroutine reset | On Error Goto 0 |
Exception throwing | Throw exception_var |
Events | |
Event declaration | Event event_name(params/eventargs) |
Event handler subroutine declaration | Sub ... Handles event_name |
Object events declaration | Dim WithEvents ... |
Handler attachment | AddHandler event_name, delegate_subroutine |
Handler detachment | RemoveHandler event_name, delegate_subroutine |
Event raise | RaiseEvent event_name |
Classes and modules | |
Class block declaration | class class_name { ... } |
Class constructor | New() |
Class destructor | Finalize() |
Structure block declaration | struct struct_name { ... } |
Module block declaration | Module module_name |
Class-level component declaration | static var_type var |
Object-level component declaration | Shared dec |
Constant | const var = constant_expression |
Current object instance reference | Me |
Encapsulation | |
Public encapsulation | public method_dec |
Protected encapsulation | protected method_dec |
Assembly encapsulation | method_dec |
Private encapsulation | private method_dec |
Inheritance, overloading and shadowing | |
Inheriting class inheritance declaration | class dec Inherits base_class |
Inheritable class declaration | class dec |
Non-inheritable class declaration | NotInheritable class dec |
Abstract class declaration | MustInherit class dec |
Overridable method declaration | Overridable method_dec |
Overriding method declaration | Overrides method_dec |
Non-overridable method declaration | [NotOverridable] method_dec |
Abstract method declaration | MustOverride method_ded |
Shadowing method declaration | Shadows method_dec |
Base class reference | MyBase |
Forced current class reference | MyClass |
Inheritance scheme | Single inheritance |
Interface block declaration | Interface interface_name |
Overloading | |
Method overloading declaration | |
Properties | |
Property block declaration | type property_name { get { }; set { } } |
Read-only property block declaration | type property_name { get { } } |
Write-only property block declaration | type property_name { set { } } |
Setter value keyword | value |
Enumerations | |
Enumeration block declaration | enum enum_name { ... } |
Namespaces | |
Namespace block declaration | namespace ns_name { ... } |
Namespace import | imports ns_name; |
Polymorphism | |
Conversion with defined widening or narrowing conversion method | (convert_to_type)var |
Conversion from/to a subtype or sub-implementation | DirectCast(var) |
Widening conversion method declaration | Shared Widening Operator CType(obj As convert_from_type) |
Narrowing conversion method declaration | Shared Narrowing Operator CType(obj As convert_from_type) |
- Sections not applicable for the language (e.g. you are dealing with an esoteric PL) can be omitted.
Code[]
- Code for some formats may be placed in a /code subpage. One or more of the following must be used: Visual Basic (.NET), C#, pseudocode, and Java.
- More to come...