Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Squirrel

< >

Squirrel is an open source programming language created in 2003 by Alberto Demichelis.

#152on PLDB 21Years Old 2kRepos
Download source code:
git clone https://github.com/albertodemichelis/squirrel
Homepage · REPL · Try It Online · Source Code · Wikipedia · Twitter · Docs

Squirrel is a high level imperative, object-oriented programming language, designed to be a light-weight scripting language that fits in the size, memory bandwidth, and real-time requirements of applications like video games and hardware such as Electric Imp. 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. Read more on Wikipedia...


Example from Riju:
print("Hello, world!\n")
Example from hello-world:
print("Hello World");
#!/usr/bin/squirrelsh // Hello world in Squirrel printl("Hello, world!");
Example from Linguist:
//example from http://www.squirrel-lang.org/#documentation local table = { a = "10" subtable = { array = [1,2,3] }, [10 + 123] = "expression index" } local array=[ 1, 2, 3, { a = 10, b = "string" } ]; foreach (i,val in array) { ::print("the type of val is"+typeof val); } ///////////////////////////////////////////// class Entity { constructor(etype,entityname) { name = entityname; type = etype; } x = 0; y = 0; z = 0; name = null; type = null; } function Entity::MoveTo(newx,newy,newz) { x = newx; y = newy; z = newz; } class Player extends Entity { constructor(entityname) { base.constructor("Player",entityname) } function DoDomething() { ::print("something"); } } local newplayer = Player("da playar"); newplayer.MoveTo(100,200,300);
Example from Wikipedia:
class BaseVector { constructor(...) { if(vargv.len() >= 3) { x = vargv[0]; y = vargv[1]; z = vargv[2]; } } x = 0; y = 0; z = 0; } class Vector3 extends BaseVector { function _add(other) { if(other instanceof ::Vector3) return ::Vector3(x+other.x,y+other.y,z+other.z); else throw "wrong parameter"; } function Print() { ::print(x+","+y+","+z+"\n"); } } local v0 = Vector3(1,2,3) local v1 = Vector3(11,12,13) local v2 = v0 + v1; v2.Print();

Language features

Feature Supported Example Token
Strings "Hello world" "
Print() Debugging print
Line Comments // A comment //
Comments
Semantic Indentation X

- Build the next great programming language · Add · Issues · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements

Built with Scroll v154.3.0