Haggis (programming language)
This article, Haggis (programming language), has recently been created via the Articles for creation process. Please check to see if the reviewer has accidentally left this template after accepting the draft and take appropriate action as necessary.
Reviewer tools: Inform author |
HAGGIS is a high-level, dynamic, educational programming language used primarily to teach Computing Science to Scottish pupils taking SQA courses on the subject.[1]HAGGIS is used as a tool to bridge the gap between pseudocode and typical computer programming, allowing users to easily understand how the program is functioning.[2]
HAGGIS is not based on any one specific language but a mixture that provides easy to learn syntax. It has multiple programming paradigms of functional, imperative and object-oriented, to provide an adaptable learning environment for pupils.[3]
Online HAGGIS interpreters have been developed to provide a way for pupils to check their programmes run as expected.[4]Other third-party tools are available to download such as VisualHaggis which provides users with a visual interpretation of the programme running and the ability to translate the HAGGIS into other programming languages.[5]
History
HAGGIS was commissioned by the SQA in 2010 to provide a uniform syntax and form in which to present questions to pupils in assessments. It was developed primarily by Quintin Cutts of University of Glasgow (See 'External Links') in collaboration with Greg Michaelson (Heriot Watt University). The aim of developing HAGGIS was to emphasise the core idea of ensuring pupils could view various versions of code and then demonstrate their understanding to develop their computational thinking and programming skills.[1]
HAGGIS was first introduced into the Computing Science curriculum as part of the Scottish Government’s Curriculum for Excellence development programme in the 2013/2014 session in National 5 and new Higher courses[6]and into the new Advanced Higher curriculum in the 2015/2016 session.[7] HAGGIS was not introduced as a language to replace other languages already used in education, but to be taught in conjunction, enhancing the pupil’s understanding of mapping pseudocode like structures (HAGGIS) to other languages such as Visual Basic and Python.[6]
Features and Philosophy
Core Principles
HAGGIS was designed with 8 core principles in mind[8]:
- Not to be inspired by any existent language.
- Be adaptable to programming languages already taught in the Scottish Curriculum.
- Provide enough complexity for Advanced Higher teaching whilst being appropriately useful for earlier teaching years.
- Provide an instinctive element, eg variable types are self specified.
- Be concise in use but open to interpretation of multiple ways to solve a problem.
- Allow different constructs have different meanings when used in certain context.
- Don’t visualise the non-useful elements such as Memory being allocated.
Use within Education
It was designed to be both functional/sequential and object-oriented based in order to be simple and complex for National 5 / Higher students and Advanced Higher students simultaneously.[8]
HAGGIS was designed to allow pupils across Scotland to enhance the learning and understanding of computer programming through reading examples, and aid the step of converting from pseudocode to full programming. It was not created with the intention of asking pupils to write it in assessments but provide a uniform language in which to present code examples to students, ensuring that all pupils have a fair understanding and is not hindered by learning a different programming language different to the one exemplified in the assessment.[2]
Category:Programming language.
Syntax
Syntax and structure in HAGGIS are very similar to other programming languages and can be easily learned.
Reserved words
- Reserved words are Capitalised.
- SET, FOR, WHILE, etc.
Data types
(types do not necessarily need to be disclosed if it can be determined by context)
- Character (As opposed to string)
- Integer (Whole numbers)
- Real (Whole numbers as well as decimal numbers)
- Boolean (True or False)
Structure Types
- Array: Sequence of same data types.
- String: Array of Data Type Character.
- Record: Collection of values and is labelled.
- Class: Object Oriented Class Object with own defined structure.
Line Numbers
Each line should state its number at the beginning. For example: Line 1
Indentation
Code within other structures should be intended so it can be properly identified by the compiler and to make it easier to read for the developer and for anyone else of whom may be reading the code.
Comments
Comments can be made using the “#” character for every line of commented text, this can appear either at the beginning of a new line or after a piece of code. Large blocks of text can be specified using the “<(COMMENT TEXT>” format, this is primarily implemented for educational use to provide larger context for students.
Variable names
Variable names should be written in lowercase or, if the name is complex, in lower camelcase. Camelcase is when a name is concatenated together to form one long word, however the first letter of each word (apart from the first) is capitalised. For example variables could be called
- number
- meaningfulName
Assignment
Assignment allows the user to set values to variables. The syntax is as shown.
- SET <variable’s name> TO <value>
- If <value> is a string, it should be written within quotation marks, like this: SET phrase TO “maybe”
- If <value> is an integer, it doesn’t need quotation marks, like this: SET number TO 23
Input
Input in HAGGIS is similar to pseudocode in that you state the data type of the input the program is receiving and also where the input is coming from, like so:
- RECEIVE <variable that will store input> FROM () <INPUT DEVICE>
For example:
- RECEIVE number FROM (integer) KEYBOARD
Output
Outputs in HAGGIS can be written similarly to inputs.
- SEND <variable, value or text> TO <OUTPUT DEVICE>
For example:
- SEND meaningfulName to DISPLAY
Arithmetic Calculations
"SET" is used to assign the result of calculation. For example:
- SET number TO 32*6
This is another form of Assignment.
Procedures / Functions
A procedure is a kind of sub-program within a program. It allows the sectioning of code to make it more readable and easier to work with. You must remember to end the procedure as shown below. PROCEDURE <Procedure ID/Name>( <Variable>, <Variable>...) HAGGIS Commands END PROCEDURE
Operations
HAGGIS includes all the operations you would expect from a programming language to be able to carry out calculations and logical operations alike. For INTEGER and REAL data typed, the following operations are possible.
- “-” is subtract
- “+” is add
- “*” is multiply
- “/” is divide
- “^” is exponent
For INTEGER data types alone, the modulo is possible which is written as “MOD”.
Comparison Operators:
- “=” is equals
- “≠” is inequals
- “<” is less than
- “>” is greater than
- “≤” is less than or equal
- “>” is greater than or equal
Logical Operations:
- “AND” is Conjuction
- “OR” is Disjunction
- “NOT” is Negation
Defining a Class
Defining a class in HAGGIS is as follows. [CLASS <Class Name>()] There are various methods you can declare in HAGGIS such as:
CONSTRUCTOR( [Data Type][Data Name], [Data Type][Data Name]...) The users' HAGGIS code will then go here. END CONSTRUCTOR
FUNCTION <Function Name>() RETURN The users' HAGGIS code will then go here. RETURN THIS <Class Property> END FUNCTION “THIS” is used to reference the current object invoking the method.
PROCEDURE <Procedure Name> () The users' HAGGIS code will then go here. END FUNCTION
References
- ^ a b Cutts, Quintin. "Computing Science Education in Schools". Glasgow University. Retrieved 8 November 2016.
- ^ a b Tennant, Mark, J. "Haggis – what should it be used for?". CompEdNet. Retrieved 8 November 2016.
{{cite web}}
: CS1 maint: multiple names: authors list (link) - ^ Michaelson, Greg. "Object Oriented Programming from Procedural Programming with a little Computational Thinking" (PDF). Herriot Watt University - Mathematical Computing Science. Retrieved 8 November 2016.
- ^ Connor, Richard. "Haggis Parser". appspot. Retrieved 8 November 2016.
- ^ Ferguson, David. "VisualHaggis". Retrieved 8 November 2016.
- ^ a b "Reference language for Higher Computing Science Question Papers" (PDF). SQA. Retrieved 8 November 2016.
- ^ "Reference language for Advanced Higher Computing Science Question Papers" (PDF). SQA. Retrieved 8 November 2016.
- ^ a b "HAGGIS Working Document". Page 4. Retrieved 8 November 2016.
{{cite web}}
: Unknown parameter|authors=
ignored (help)