Squirrel is a high level
imperative,
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming l ...
, designed to be a
lightweight
Lightweight is a weight class in combat sports and rowing.
Boxing
Professional boxing
The lightweight division is over 130 pounds (59 kilograms) and up to 135 pounds (61.2 kilograms) weight class in the sport of boxing.
Notable lightweight b ...
scripting language
A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled.
A scripti ...
that fits in the size, memory bandwidth, and real-time requirements of applications like
video game
Video games, also known as computer games, are electronic games that involves interaction with a user interface or input device such as a joystick, game controller, controller, computer keyboard, keyboard, or motion sensing device to gener ...
s.
MirthKit, a simple toolkit for making and distributing open source, cross-platform 2D games, uses Squirrel for its platform. It is used extensively by
Code::Blocks for scripting and was also used in ''
Final Fantasy Crystal Chronicles: My Life as a King''.
It is also used in ''
Left 4 Dead 2
''Left 4 Dead 2'' is a 2009 first-person shooter game developed and published by Valve. The sequel to Turtle Rock Studios's ''Left 4 Dead'' (2008) and the second game in the ''Left 4 Dead'' series, it was released for Microsoft Windows and Xbo ...
'', ''
Portal 2
''Portal 2'' is a 2011 puzzle-platform video game developed by Valve for Windows, Mac OS X, Linux, PlayStation 3, and Xbox 360. The digital PC version is distributed online by Valve's Steam service, while all retail editions were distributed b ...
'' and ''
Thimbleweed Park'' for scripted events and in
NewDark, an unofficial ''
Thief 2: The Metal Age'' engine update, to facilitate additional, simplified means of scripting mission events, aside of the regular
C scripting.
Language features
*
Dynamic typing
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
*
Delegation
Delegation is the assignment of authority to another person (normally from a manager to a subordinate) to carry out specific activities. It is the process of distributing and entrusting work to another person,Schermerhorn, J., Davidson, P., Poole ...
*
Classes,
inheritance
Inheritance is the practice of receiving private property, titles, debts, entitlements, privileges, rights, and obligations upon the death of an individual. The rules of inheritance differ among societies and have changed over time. Offici ...
*
Higher order functions
*
Generators
*Cooperative threads (
coroutines
Coroutines are computer program components that generalize subroutines for non-preemptive multitasking, by allowing execution to be suspended and resumed. Coroutines are well-suited for implementing familiar program components such as cooperative ...
)
*
Tail recursion
In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion. Tail recur ...
*
Exception handling
In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, a ...
*Automatic memory management (mainly
reference counting
In computer science, reference counting is a programming technique of storing the number of references, pointers, or handles to a resource, such as an object, a block of memory, disk space, and others.
In garbage collection algorithms, refer ...
with backup
garbage collector)
*
Weak reference
In computer programming, a weak reference is a reference that does not protect the referenced object from collection by a garbage collector, unlike a strong reference. An object referenced ''only'' by weak references – meaning "every chain of r ...
s
*Both
compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
and
virtual machine
In computing, a virtual machine (VM) is the virtualization/ emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized har ...
fit together in about 7k lines of
C++ code
*Optional
16-bit
16-bit microcomputers are microcomputers that use 16-bit microprocessors.
A 16-bit register can store 216 different values. The range of integer values that can be stored in 16 bits depends on the integer representation used. With the two mos ...
character
strings
Syntax
Squirrel uses a C-like syntax.
;Factorial in Squirrel:
function factorial(x)
;Generators:
function not_a_random_number_generator(max)
local randtor = not_a_random_number_generator(100);
for(local i = 0; i < 10; i += 1)
print(">"+resume randtor+"\n");
;Classes and inheritance:
class BaseVector
class Vector3 extends BaseVector
local v0 = Vector3(1,2,3)
local v1 = Vector3(11,12,13)
local v2 = v0 + v1;
v2.Print();
Applications
Applications using Squirrel
*
Code::Blocks, integrated development environment
*
Enduro/X
Enduro/X is an open-source middleware platform for distributed transaction processing. It is built on proven APIs such as X/Open group's XATMI and XA. The platform is designed for building real-time microservices based applications with a clu ...
, cluster application server
*
Electric Imp
Electricity is the set of physical phenomena associated with the presence and motion of matter that has a property of electric charge. Electricity is related to magnetism, both being part of the phenomenon of electromagnetism, as described by ...
, an end-to-end IoT platform
Games using Squirrel
* ''
Alien Swarm''
* ''
Antinomy of Common Flowers
, often abbreviated to AoCF, is a fighting video game developed by Twilight Frontier and published by Team Shanghai Alice for Microsoft Windows in 2017. It is the latest fighting game in the ''Touhou Project'' series, being a continuation of th ...
''
* ''
Apex Legends
''Apex Legends'' is a free-to-play battle royale- hero shooter game developed by Respawn Entertainment and published by Electronic Arts. It was released for PlayStation 4, Windows, and Xbox One in February 2019, for Nintendo Switch in March ...
''
* ''
Battle Brothers
''Battle Brothers'' is a tactical role-playing game developed and published by Overhype Studios. It was released on the PC in 2017, and console versions were released in 2021 and 2022.
Gameplay
Players establish a mercenary company in a fantas ...
''
* ''
Contagion''
(PC)
* ''
Counter Strike: Global Offensive''
* ''
CRSED: F.O.A.D.''
* ''
Final Fantasy Crystal Chronicles: My Life as a King''
* ''
GTA IVs IV-MP
* ''
Left 4 Dead 2
''Left 4 Dead 2'' is a 2009 first-person shooter game developed and published by Valve. The sequel to Turtle Rock Studios's ''Left 4 Dead'' (2008) and the second game in the ''Left 4 Dead'' series, it was released for Microsoft Windows and Xbo ...
''
* ''Liberty Unleashed''
* ''
Mafia II
''Mafia II'' is a 2010 action-adventure game developed by 2K Czech and published by 2K Games. It was released in August 24 2010 for PlayStation 3, Windows, and Xbox 360. The game is a standalone sequel to 2002's ''Mafia'', and the second install ...
s M2-Multiplayer
* ''
Nuclear Dawn
''Nuclear Dawn'' is a hybrid first-person shooter real-time strategy video game. It was originally announced in February 2006 as an amateur mod for the Source engine, but in April 2009 was revealed to have become Source-based project for Windows a ...
''
* ''
OpenTTD''
* ''
Portal 2
''Portal 2'' is a 2011 puzzle-platform video game developed by Valve for Windows, Mac OS X, Linux, PlayStation 3, and Xbox 360. The digital PC version is distributed online by Valve's Steam service, while all retail editions were distributed b ...
''
* ''
Shadow Warrior''
* ''
Simutrans''
* ''
Sonic Unleashed'' (PS2/Wii)
* ''
SuperTux
''SuperTux'' is a free and open-source two-dimensional platform video game published under the GNU General Public License (GPL). The game was inspired by Nintendo's '' Super Mario Bros.'' series; instead of Mario, the hero in the game is Tux ...
''
* ''
Team Fortress 2
''Team Fortress 2'' is a 2007 multiplayer first-person shooter game developed and published by Valve Corporation. It is the sequel to the 1996 ''Team Fortress'' mod for '' Quake'' and its 1999 remake, ''Team Fortress Classic''. The game was rel ...
''
* ''
Thimbleweed Park''
* ''
Thief II'' (unofficial NewDark engine update)
* ''
Titanfall
''Titanfall'' is a series of video games that mainly feature first-person shooter games. The series was created by Respawn Entertainment and debuted on Xbox and Microsoft Windows; it has expanded to other consoles and platforms.
Gameplay
In ' ...
''
* ''Vice City Multiplayer'', a mod for ''
Grand Theft Auto: Vice City''
* ''
War Thunder
''War Thunder'' is a free-to-play vehicular combat multiplayer video game developed and published by Gaijin Entertainment. Announced in 2011, it was first released in November 2012 as an open beta with a worldwide release in January 2013; it h ...
''
* ''
Zero no Tsukaima - Maigo no Period to Ikusen no Symphony
0 (zero) is a number representing an empty quantity. In place-value notation such as the Hindu–Arabic numeral system, 0 also serves as a placeholder numerical digit, which works by multiplying digits to the left of 0 by the radix, usually ...
'' (PS2)
* ''
Zero no Tsukaima - Muma ga Tsumugu Yokaze no Nocturne
0 (zero) is a number representing an empty quantity. In place-value notation such as the Hindu–Arabic numeral system, 0 also serves as a placeholder numerical digit, which works by multiplying digits to the left of 0 by the radix, usually ...
'' (PS2)
* ''
Zero no Tsukaima - Shou-akuma to Harukaze no Concerto
0 (zero) is a number representing an empty quantity. In place-value notation such as the Hindu–Arabic numeral system, 0 also serves as a placeholder numerical digit, which works by Multiplication, multiplying digits to the left of 0 by th ...
'' (PS2)
History
The language was made public in 2003 under the
zlib/libpng license.
In November 2010, the license was changed to the
MIT license
The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license co ...
to enable the project to be hosted on
Google Code
Google Developers (previously Google Code) , application programming interfaces (APIs), and technical resources. The site contains documentation on using Google developer tools and APIs—including discussion groups and blogs for developers usi ...
.
It is developed and maintained by Alberto Demichelis.
See also
*
Lua
Lua or LUA may refer to:
Science and technology
* Lua (programming language)
* Latvia University of Agriculture
* Last universal ancestor, in evolution
Ethnicity and language
* Lua people, of Laos
* Lawa people, of Thailand sometimes referred t ...
*
AngelScript
*
Python
*
ECMAScript
ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262
ECMAScript is commonly used for client-side scriptin ...
*
Ruby
A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum (aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sapp ...
References
External links
*
{{DEFAULTSORT:Squirrel (Programming Language)
2003 software
Cross-platform free software
Free computer libraries
Free software programmed in C
Object-oriented programming languages
Procedural programming languages
Programming languages
Programming languages created in 2003
Scripting languages
Software using the MIT license