Ring/Lessons/Features

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Features[edit | edit source]

The Ring language comes with the next features

.. tip:: One of the main goals behind the first release is creating a useful language ready for production!

  • Free Open Source (MIT License)
  • Interpreter - Hybrid Implementation (Compiler+VM)
  • Declarative programming on the top of Object-Oriented programming
  • No explicit end for statements (No ; or ENTER is required)
  • A small language (Around 100,000 lines of code)

* The compiler + The Virtual Machine are 15,000 lines of C code * The other 85,000 lines of code are related to libraries! * 10,000 lines of C code * 50,000 lines of C++ code * 25,000 lines of Ring code

  • Written in ANSI C (The code is generated)
  • Developed using Visual Programming (PWCT)
  • Optional Printing for Tokens/Grammar/Byte-Code during execution
  • Portable (Windows, Linux & Mac OS X)
  • Comments (One line & Multi-lines)
  • Not Case-Sensitive
  • Dynamic Typing
  • Weakly typed
  • Lexical Scoping (Global, Local & Object State)
  • Default scope for variables inside functions (Local)
  • Default scope for variables outside functions (global)
  • Garbage Collector - Automatic Memory Management (Escape Analysis and Reference Counting)
  • Structure Programming
  • Rich control structures & Operators
  • For in get item by reference not value, you can read/edit the item
  • Use exit to go outside from more than one loop
  • Procedures/Functions
  • Main Function (optional)
  • Call Function before the definition
  • Recursion
  • Multi-line literals
  • Access (read/write) string letter by index
  • The list index start by 1
  • No keyword to end Functions/Classes/Packages
  • Range operator ex: 1:10 and "a":"z"
  • First Class Variables, Lists, Objects and Functions
  • Store/Copy Lists/Objects by value (Deep Copy)
  • Pass Lists/Objects by reference
  • Native Object-Oriented Support

* Encapsulation * Setter/Getter (optional) * private state (optional) * Instantiation * Polymorphism * Composition * Inheritance (Single Inheritance) * Operator Overloading * Packages

  • using { } to access objects and use attributes/methods as variables/functions
  • Reflection and Meta-programming
  • Clear program structure (Statements then functions then packages & classes)
  • Exception Handling
  • Eval() to execute code during run-time
  • 8-bit clean, work on binary data directly
  • I/O commands
  • Math functions
  • String functions
  • List functions
  • File processing functions
  • Database support (ODBC & MySQL)
  • Security Functions (OpenSSL)
  • Internet Functions (LibCurl)
  • CGI Library (Written in Ring)

* HTTP Get * HTTP Post * File upload * Cookies * URL Encode * HTML Templates * HTML Special Characters * HTML Generation using Functions * HTML Generation using Classes * CRUD Example (using MVC) * Users Example (Register, Login and Check)

  • Extension using C/C++ (Simple API)
  • Embedding the language in C/C++ programs
  • Comes with code generator (Written in Ring) to quickly wrap C/C++ Libraries

* Used to Support Allegro by creating RingAllegro * Used to Support Qt by creating RingQt

  • Create 2D Games (Using the Allegro Library)
  • Create GUI Applications for Desktop and Mobile (Using the Qt Framework)