Pseudo-code Syntax - Dr. Nicholas Duchon

Elements:
• ; or // - rest of line is a comment
• /* .. */ - stuff between is a comment
• Structure:
• Main <Statements> End Main
• Subprogram (<Parameter Declarations>) <Statements> End Subprogram
• Function <name> (<Parameter Declarations>) as <Type> <Statements> End Function
• I/O:
• Write <String> or <Variable> [+ <S> or <V>] or [, <V>]
• Writennl - as Write, no new line
• Input <Variable> [, <Variable>]
• Sequential statements:
• Declare <Variable> [, <Variable>] as <Type>
• Set <Variable> = <Expression>
• Flow control:
• Call ([<Parameters>])
• If (<Condition>) <statements> [Else <Statements>] End If
• Select Case of <Variable> [Case <value>: <Statements>] End Case
• Repeat <Statements> Until <Condition>
• While <Condition> <Statements> End While
• For (<init>; <Condition>; <update>) <Statements> End For
• Type:
• Character
• String
• Integer
• Float
• Boolean
• Operators:
• +, -, * : These work as expected for integers and floats
• <int> / <int> : no remainder, truncation division
• / if either side is float --> float result
• % : a%b, a and b are integers, result is remainder after b divides a, result is in the range [0, b-1]
• ^ : exponentiation
• <String> + <String> : concatenation "abc"+"def" --> "abcdef"
• <variable> = <expression> - assignment statement
• variable is left hand side (LHS), result is put into this location
• expression is evaluated to a value, right hand side (RHS)
• Expression
• <token> <operator> <token>
• tokens can be variables or constants
• types must be appropriate to operator, and mostly must match each other
• Conditions
• <, <=, >, >=, ==, != : Compare arithmetic expressions, sometimes Strings and characters
• AND, OR and NOT : boolean operations
• Parameter Declarations:
• <Type> <name> - I also suggest using [IN], [OUT] or [IN/OUT] notation
• use commas between <Type> <name> declarations
• Parameters
• <variable> or <constant>
• Type of token in call must match type in parameter declaration
Flow chart symbols:
 Use Symbols Use Symbols Input Output Loop Repeat / Until or For / End For or While / End While Process Assignment Defining a subroutine or function Selection If / Else / End If or Select Case / End Case Calling a subroutine of function