Squirrel language learning notes (1)

Source: Internet
Author: User

SQUIRREL is a work by a person. The author is an Italian guy, Albert to demiris. He is younger than me (as if he is less than 30 years old) and is currently developing a game in Singapore. SQUIRREL is designed to replace LUA. (If you are engaged in Game Development, You should know LUA. I am not engaged in game development, but I also know about LUA, huh, huh !), I personally think the SQUIRREL syntax is more suitable for C/C ++ programmers. Many LUA syntaxes are different from those of C/C ++. It is easy to make mistakes when writing scripts.

LUA is a niche language, and SQUIRREL is even smaller. I accidentally discovered this language and began to study it. At that time, the main purpose was to find a suitable web (server) is SQUIRREL.

 

I. Initial impressions

Squirrel is more similar to Lua like C/C ++, or C ++-Java-C #. The reserved words are basically C/C ++, the usage of control statements such as if/do/while/for is similar. This feature makes Squirrel quick to get started. I can use it if I look at it.

Squirrel is a dynamic language and weak type. You do not need to specify the type when defining variables. Squirrel is not a language for simultaneous interpretation and execution. It has a compiler and virtual machine. The code is dynamically compiled into bytecode and then executed on the virtual machine. Such compilation is much simpler than C/C ++ or Java compilation, and its virtual machine certainly does not have the "underlying" such as JVM ", squirrel's virtual machine is more like a "function execution queue", which is based on the standard libc (that is, the standard C function is a meta operation in this virtual machine ), the JVM is based on the assembly language.

Squirrel is designed to be embedded in C/C ++. Therefore, Squirrel virtual machines can work with C/C ++ in a process/thread and use virtual machine interfaces, data of C/C ++ can be accessed by embedded Squirrel Code. On the contrary, Squirrel code and data can be fully controlled by C/C ++.

It seems that squirrel is in the same line with Lua in the bones. Squirrel and Lua are based on generalized tables (or a multi-Cross Tree ), hash plays a key role in this generalized table. Squirrel code and data are organized in a generalized table. Data, functions, and classes (LUA does not support Oo, squirrel roughly supports OO) are values in a generalized table and the values are stored in the <name, value> method, you can easily find the value through the hash of the name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.