Pseudo Code English
Introduction
If you install this extension, here's an example of the code you could write with it:
We have the version of this extension for French Algorithm available here: Extension French Version.
When you have the both versions you can in file with extension .algo choose your target language version by changing the language as below:
Choose:
- Algo when the file contains the French keywords
- Algorithm English when the file contains the English keywords
Description
This extension is Syntax highlighting of English pseudo code.
This extension will allow you to color keywords in Algorithm like If, Else....
When the extension is installed, syntax highlighting is triggered on files of type .algo.
Syntax highlighting is applied to the keywords used in the algorithmic french course provided by Ismaël Maurice davailable here: Cours Algorithme.
Syntax highlighting is applied to keywords when they are written in lowercase, uppercase or uppercase first letter. Except for the keywords to and in, which are always collored if in lowercase.
For example If...EndIf or if...endif or IF...ENDIF will be treated as the same keyword.
When the extension is activated, you should see a view like the one below.
If you have any questions, please contact us at: yo@edigrp.com
Keywords
The list of keywords you can use are:
Keywords |
Where to use |
And |
boolean condition for tests a = 1 And b = 2 |
Array |
to declare an array Array tab in Integer |
Arrays |
to declare several arrays of the same type Arrays tab1, tab2 as Integers |
Begin |
specifies the start of an algorithm Begin ... End |
Boolean |
variable type Variable a in Boolean |
Booleans |
type of variables Variables a, b in Booleans |
Character |
variable type Variable a in Character |
Characters |
type of variables Variables a, b in Characters |
Do |
in loop While condition Do ... |
Else |
specifies the alternative condition of a test If condition Then ... Else ... |
ElseIf |
specifies the alternative condition of a test If condition Then ... ElseIf condition Then ... |
End |
specifies the end of an algorithm Begin ... End |
EndFunction |
specifies the end of function Function ... EndFunction |
EndIf |
specifies the end of test If condition ... EndIf |
EndProcedure |
specifies the end of procedure Procedure ... EndProcedure |
EndWhile |
specifies the end of while loop While condition ... EndWhile |
False |
value of a boolean variable Variable a in Boolean ... a <- False |
Float |
variable type Variable a in Float |
Floats |
type of variables Variables a, b in Floats |
For |
in loop For i <- 0 to 10 Step 1 |
Function |
specifies the begin of function Function ... EndFunction |
If |
specifies the begin of test If condition ... EndIf |
in |
link between the variable name and his type Variable a in Integer |
Integer |
variable type Variable a in Integer |
Integers |
type of variables Variables a, b in Integers |
Length |
to get the size of table n <- Length(tab) |
Next |
specifies the end of loop For For i <- 0 to 10 Step 1 ... Next |
Not |
boolean condition for tests Not(a=1) is true if the variable a doesn't contain value 1 |
Or |
boolean condition for tests a = 1 Or b = 1 |
Procedure |
specifies the begin of procedure Procedure ... EndProcedure |
Read |
reads the user's input and stores it in a variable Read a |
Repeat |
in loop Repeat ... While condition |
Resend |
specifies the type of return value for a Function |
Return |
specifies the return value of a Function |
Size |
to get the size of table n <- Size(tab) |
Step |
in For loops to specify the number of jumps For i <- 0 to 10 Step 1 |
String |
variable type Variable a in String |
Strings |
type of variables Variables a, b in Strings |
Table |
to declare an array Table tab in Integer |
Tables |
to declare several arrays of the same type Tables tab1, tab2 as Integers |
Then |
in the test If condition Then ... |
to |
in For loop |
True |
value of a boolean variable Variable a in Boolean ... a <- True |
Variable |
to declare a variable Variable a in Integer |
Variables |
to declare multiple variables with same type Variable a, b in Integers |
While |
in loop While While i <- 0 to 10 Step 1 |
Write |
displays the contents of a variable on the screen Write a |
Xor |
boolean condition for tests a = 1 Xor b = 1 |
Coloring rules
In the examples below, we use capitalized words in the description of keywords (capitalization at the beginning of the word).
Note that keywords can be written in upper or lower case.
When you write a keyword, in most cases the whole format will be generated, but you'll need to replace anything written with underscores _ with the correct values.
For example, if you enter the keyword For, the following format is generated:
After adpation of the template, we obtain:
We recommend using the following characters for strings "{message_here}" or '{message_here}'.
We also advise you to use the same delimiters for comments when you write your programs, i.e. "..." or '...' or """..."" or '''...''.
If you decide not to use the recommended delimiters when using keywords, you must enclose them in single quotation marks '' or double quotation marks "" to avoid them being treated as keywords.
Start/End point
To start an algorithm we use Begin as the start keyword and End to specify the end.
Variables
To declare a variable, you can use either:
- The keyword Variable or Variables when you want to declare a variable of type Integer or Float or Character or String or Boolean.
- The Array or Table keyword to declare an array variable.
The following types can be associated with a variable:
- integer or integers or Integer or Integers or INTEGER or INTEGERS.
- float or Float or FLOAT or floats or Floats or FLOATS
- Character or Characters or CHARACTER or CHARACTERS or character or characters
- String or Strings or STRING or STRINGS or string or string or strings
- Boolean or Booleans or boolean or booleans or BOOLEANS or BOOLEAN
Expression and operations
All mathematical operators are accepted, but for affection you'll use <- and for equality verification you'll use =.
Reading and writing
To display the contents of a variable or a message, use the Write keyword; to wait for user input, use the Read keyword.
The tests
To specify tests, use the keywords If, Else or ElseIf. All tests must end with EndIf.
An example using Boolean variables:
Loops
To specify conditional or unconditional loops, use the following keywords:
Tables
Arrays are declared with the words Table or Array with a specific type that gives a description of the type of values in the array.
Functions
To declare a function you can use the keywords Function, Return, Resend and EndFunction.
Procedures
Procedures, sometimes called methods, execute without returning anything after execution. To declare them, you can use the keywords Procedure and EndProcedure.
Other keywords
In addition to the keywords described above, we also take into account:
- And, Or, Xor, Not to manage logical conditions
- Size or Length to specify that you want to retrieve the size of an array variable. For example n <- Size(tab) will set variable n to the size of array tab.
If you have any questions, please contact us at: yo@edigrp.com
Release Notes
The latest version is 1.1.0.
1.1.0
- Removal of braces in code generation
- Adding keywords to the README
- Add summary to README
- Add example with And, Or, Or and Not
- Add example with Size
- Add example with True and False
- Add demo video
- Add generation code for Write and Read
1.0.1
- Replace the logo and file icon
1.0.0
- Init the language
- Define the properties of extension
- Define the logo and file logo
- Define the keyword
- Define the generation of keyword template
- Add link of French version
- Write readme