Ring (programming language)
   HOME

TheInfoList



OR:

Ring is a dynamically typed,
general-purpose programming language In computer software, a general-purpose programming language (GPL) is a programming language for building software in a wide variety of application domains. Conversely, a domain-specific programming language is used within a specific area. For exam ...
. It can be embedded in C/C++ projects, extended using C/C++ code and/or used as a standalone language. The supported
programming paradigm Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms. Some paradigms are concerned mainly with implications for the execution model of the language, suc ...
s are imperative, procedural,
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 ...
,
functional Functional may refer to: * Movements in architecture: ** Functionalism (architecture) ** Form follows function * Functional group, combination of atoms within molecules * Medical conditions without currently visible organic basis: ** Functional sy ...
,
meta Meta (from the Greek μετά, '' meta'', meaning "after" or "beyond") is a prefix meaning "more comprehensive" or "transcending". In modern nomenclature, ''meta''- can also serve as a prefix meaning self-referential, as a field of study or end ...
, declarative using nested structures, and natural programming. The language is portable (
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for se ...
,
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
,
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
, Android,
WebAssembly WebAssembly (sometimes abbreviated Wasm) defines a portable binary-code format and a corresponding text format for executable programs as well as software interfaces for facilitating interactions between such programs and their host environmen ...
, etc.) and can be used to create
console Console may refer to: Computing and video games * System console, a physical device to operate a computer ** Virtual console, a user interface for multiple computer consoles on one device ** Command-line interface, a method of interacting with ...
,
GUI The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
,
web Web most often refers to: * Spider web, a silken structure created by the animal * World Wide Web or the Web, an Internet-based hypertext system Web, WEB, or the Web may also refer to: Computing * WEB, a literate programming system created by ...
,
game A game is a structured form of play, usually undertaken for entertainment or fun, and sometimes used as an educational tool. Many games are also considered to be work (such as professional players of spectator sports or games) or art (suc ...
and
mobile app A mobile application or app is a computer program or software application designed to run on a mobile device such as a phone, tablet, or watch. Mobile applications often stand in contrast to desktop applications which are designed to run on d ...
lications.


History

In 2009,
Mahmoud Samir Fayed Mahmoud Samir Fayed (born December 29, 1986) is a computer programmer, known as the creator of the PWCT programming language. PWCT is a free open source visual programming language for software development. He also created or designed Ring. He i ...
created a minor
domain-specific language A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging ...
called Supernova that focuses on User interface (UI) creation and uses some ideas related to
Natural Language Programming Natural-language programming (NLP) is an ontology-assisted way of programming in terms of natural-language sentences, e.g. English. A structured document with Content, sections and subsections for explanations of sentences forms a NLP docume ...
, then he realized the need for a new language that is general-purpose and can increase the
productivity Productivity is the efficiency of production of goods or services expressed by some measure. Measurements of productivity are often expressed as a ratio of an aggregate output to a single input or an aggregate input used in a production proces ...
of natural language creation. Ring aims to offer a language focused on helping the developer with building natural interfaces and declarative DSLs.


Goals

The general goals behind Ring: * Applications programming language. * Productivity and developing high quality solutions that can scale. * Small and flexible language that can be embedded in C/C++ projects. * Simple language that can be used in education and introducing Compiler/VM concepts. * General-Purpose language that can be used for creating domain-specific libraries, frameworks and tools. * Practical language designed for creating the next version of the Programming Without Coding Technology software.


Examples


Hello World program

The same program can be written using different styles. Here is an example of the standard "Hello, World!" program using four different styles. The first style:
see "Hello, World!"
The second style:
put "Hello, World!"
The third style:
load "stdlib.ring"
print("Hello, World!")
Another style: similar to
xBase xBase is the generic term for all programming languages that derive from the original dBASE ( Ashton-Tate) programming language and database formats. These are sometimes informally known as dBASE "clones". While there was a non-commercial pred ...
languages like
Clipper A clipper was a type of mid-19th-century merchant sailing vessel, designed for speed. Clippers were generally narrow for their length, small by later 19th century standards, could carry limited bulk freight, and had a large total sail area. "Cl ...
and Visual FoxPro
? "Hello, World!"


Change the Keywords and Operators

Ring supports changing the language keywords and operators. This could be done many times in the same source file, and is useful for * Translating the keywords from English to other human languages ( Non-English-based programming languages) * Customizing the language for use of a favorite style * Porting
Legacy code In computing, a legacy system is an old method, technology, computer system, or application program, "of, relating to, or being a previous or outdated computer system", yet still in use. Often referencing a system as "legacy" means that it paved ...
written in other languages Translate Ring keywords to Japanese
ChangeRingKeyword  See 手紙を出す
ChangeRingOperator + そして
改行 = nl
します。 = :します。

手紙を出す "こんにちは、世界" そして 改行 します。

ChangeRingKeyword 手紙を出す See // キーワードの復旧
ChangeRingOperator そして     + // 演算子の復旧
Translate Ring keywords to
Arabic Arabic (, ' ; , ' or ) is a Semitic language spoken primarily across the Arab world.Semitic languages: an international handbook / edited by Stefan Weninger; in collaboration with Geoffrey Khan, Michael P. Streck, Janet C. E.Watson; Walter ...
ChangeRingKeyword  See إطبع

إطبع "Hello, World!"

ChangeRingKeyword إطبع See
Use style similar to the
Pascal programming language Pascal is an imperative and procedural programming language, designed by Niklaus Wirth as a small, efficient language intended to encourage good programming practices using structured programming and data structuring. It is named in honour o ...
ChangeRingKeyword func function ChangeRingKeyword see write begin = :begin function main begin write("Hello, World!"); return 0; end ChangeRingKeyword function func ChangeRingKeyword write see


Loop Command

The Loop command can take an integer to apply the continue semantics to enclosing outer loops
changeRingKeyword loop continue
count = 2
for x in 1:5
    for y = 1 to 2
        if x = 3
            ? "About to execute 'loop', count = " + count
            continue count
        ok
        ? "x: " + x + ", y: " + y
    next
next


Object Oriented Programming

Ring supports Object Oriented Programming (Classes, Objects, Composition, Inheritance, Encapsulation, etc.)
new point                       # end of object access using braces
class point            # Define the class
x y z                  # Define the attributes (x,y,z)
func print             # Define the print() method
? x + nl + y + nl + z  # Print the attributes values (nl means printing a new line)
In Ring classes can be defined at runtime using the Eval() function
? "Creating a new class dynamically..."
eval("class DynamicClass a b")

? "Printing the instance..."
? new DynamicClass 


Implementation


Compiler and Virtual Machine

Ring programs are not interpreted directly from the textual Ring file, but are
compiled 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 tha ...
into
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
, which is then run on the Ring
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 h ...
. The compilation process is typically invisible to the user and is performed at run-time, but it can be done offline in order to increase loading performance or reduce the memory footprint of the host environment by leaving out the compiler. The
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 tha ...
and the
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 h ...
are designed using
Visual Programming In computing, a visual programming language (visual programming system, VPL, or, VPS) is any programming language that lets users create programs by manipulating program elements ''graphically'' rather than by specifying them ''textually''. A ...
through the Programming Without Coding Technology software then the C code is generated.


Extensions

The following are extensions that can be used immediately after the installation of the full installation version (with a file size of about 280 MB for Ring 1.12). Since these are officially provided and maintained on the Ring side, the users are not bothered by library dependencies that may cause problems in other languages, and there is a concern that they can not be used suddenly even if there are destructive language specification changes. The extensions are implemented in approximately 500,000 lines of C and C++ code. * RingAllegro ( Allegro Game Library) * RingConsoleColor (Text coloring library for command prompt or the terminal) * RingCurl ( CURL Library) * RingFreeGLUT ( FreeGLUT) * RingInternet (Internet related library) * RingLibUV ( LibUV-asynchronous I / O library) * RingMurMurHash ( Hash Function Library) * RingMySQL (
MySQL MySQL () is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A relational database ...
) * RingODBC (
Open Database Connectivity In computing, Open Database Connectivity (ODBC) is a standard application programming interface (API) for accessing database management systems (DBMS). The designers of ODBC aimed to make it independent of database systems and operating systems. An ...
) * RingOpenGL (
OpenGL OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardwa ...
1.1-4.6) * RingOpenSSL (
OpenSSL OpenSSL is a software library for applications that provide secure communications over computer networks against eavesdropping or need to identify the party at the other end. It is widely used by Internet servers, including the majority of HT ...
) * RingPostgreSQL (
PostgreSQL PostgreSQL (, ), also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. It was originally named POSTGRES, referring to its origins as a successor to the ...
) * RingQt (
Qt framework Qt (pronounced "cute") is cross-platform software for creating graphical user interfaces as well as cross-platform applications that run on various software and hardware platforms such as Linux, Windows, macOS, Android or embedded systems wi ...
) * RingRayLib (
raylib raylib (officially named all lowercase) is a cross-platform open-source software development library. The library was made to create graphical applications and games. The library was inspired by the Borland BGI graphics library and by the X ...
) * RingSDL ( SDL-Simple DirectMedia Layer Library) * RingSQLite (
SQLite SQLite (, ) is a database engine written in the C programming language. It is not a standalone app; rather, it is a library that software developers embed in their apps. As such, it belongs to the family of embedded databases. It is the mo ...
) * RingWinAPI (
Windows API The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
) * RingWinCREG (
Windows Registry The Windows Registry is a hierarchical database that stores low-level settings for the Microsoft Windows operating system and for applications that opt to use the registry. The kernel, device drivers, services, Security Accounts Manager, and ...
) * RingZIP ( zip file processing library)


Libraries

Ring comes with libraries written in Ring itself, some of these libraries are related to web and game development.


Applications

Ring is distributed with over 60 applications written in the language. Some of these applications are * Analog Clock application * Calculator application * The Checkers Game * The Chess Game *
Fifteen Puzzle The 15 puzzle (also called Gem Puzzle, Boss Puzzle, Game of Fifteen, Mystic Square and many others) is a sliding puzzle having 15 square tiles numbered 1–15 in a frame that is 4 tiles high and 4 tiles wide, leaving one unoccupied tile positio ...
3D Game * Game 2048 * Knight Tour Game *
Minesweeper A minesweeper is a small warship designed to remove or detonate naval mines. Using various mechanisms intended to counter the threat posed by naval mines, minesweepers keep waterways clear for safe shipping. History The earliest known usage of ...
Game *
Othello ''Othello'' (full title: ''The Tragedy of Othello, the Moor of Venice'') is a tragedy written by William Shakespeare, probably in 1603, set in the contemporary Ottoman–Venetian War (1570–1573) fought for the control of the Island of Cyp ...
Game * Sokoban Game * Sudoku Game *
Tic-tac-toe Tic-tac-toe (American English), noughts and crosses (Commonwealth English), or Xs and Os (Canadian or Irish English) is a paper-and-pencil game for two players who take turns marking the spaces in a three-by-three grid with ''X'' or ''O''. ...
3D Game * Video Music Player application * Windows Startup Manager application


Tools

Ring is distributed with a Standard IDE that contains the next tools (written in Ring itself) * Ring REPL (
Read–eval–print loop A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written ...
) * Ring2EXE ( Distributing executable applications) * RingPM (The Ring Package manager) * Ring Notepad (
Source-code editor A source-code editor is a text editor program designed specifically for editing source code of computer programs. It may be a standalone application or it may be built into an integrated development environment (IDE) or web browser. Source-co ...
) * Form Designer ( WYSIWYG GUI designer) Also Ring is distributed with extensions for many code editors (
Emacs Emacs , originally named EMACS (an acronym for "Editor MACroS"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, ...
,
Notepad++ Notepad++ is a text and source code editor for use with Microsoft Windows. It supports tabbed editing, which allows working with multiple open files in a single window. The product's name comes from the C postfix increment operator. Notepad ...
, Geany,
Atom Every atom is composed of a nucleus and one or more electrons bound to the nucleus. The nucleus is made of one or more protons and a number of neutrons. Only the most common variety of hydrogen has no neutrons. Every solid, liquid, gas, a ...
,
Sublime Text 2 Sublime may refer to: Entertainment * SuBLime, a comic imprint of Viz Media for BL manga * Sublime (band), an American ska punk band ** ''Sublime'' (album), 1996 * ''Sublime'' (film), a 2007 horror film * SubLime FM, a Dutch radio station dedic ...
, Visual Studio Code). SpaceVim (A community-driven vim distribution) support the Ring programming language.


Documentation

Ring is distributed with documentation written using Sphinix. Also there is Japanese translation.


Reception


Popularity

Ring had a rapid rise and fall in popularity as measured by the TIOBE Programming Community Index. In February 2018, Ring broke into the top 50 for the first time (position 45). As of October 2020, Ring holds position 93 on the TIOBE index. Ring is listed by GitHub in the list of programming languages that are actively developed.


Criticism

Ring critics pointed to some features in Ring that are not common in widely used programming languages. * The list index starts from 1 instead of 0 (See: Zero-based numbering) * Implicit type conversions (See: Implicit type conversions and "type punning")


The list index starts from 1 instead of 0

In Ring, the index of the first item in lists and the first character in strings is 1.
cName = "Ring"
? cName      # print R
aList =  One","Two","Three"? aList      # print One


Implicit type conversions

The language can automatically convert between numbers and strings.
/*
** Rules:
**  +  --> 
**  +  --> 
*/

x    = 10                # x is a number
y    = "20"              # y is a string
nSum = x + y             # nSum is a number (y will be converted to a number)
cMsg = "Sum = " + nSum   # cMsg is a string (nSum will be converted to a string)


See also

* Tcl * Lua * Python *
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 ...
*
Squirrel Squirrels are members of the family Sciuridae, a family that includes small or medium-size rodents. The squirrel family includes tree squirrels, ground squirrels (including chipmunks and prairie dogs, among others), and flying squirrels. ...
* Gambas


References


Further reading

* Ghanem (2021)
Developing Poet Software using Ring language (Arabic Book)
', MetaBook (Egypt - Mansoura) * Ayouni (2020)
Beginning Ring Programming
', Apress (part of Springer Nature) * Hassouna (2019)
Ring Basics (Arabic Book)
'
Hassouna Academy
* Sobain (2017)
RingWinCReg Extension Documentation
',
SourceForge SourceForge is a web service that offers software consumers a centralized online location to control and manage open-source software projects and research business software. It provides source code repository hosting, bug tracking, mirroring ...
* Fayed (2016)
The Ring Programming Language
', CodeProject


External links


Ring home page

RosettaCode samples




{{Programming languages Programming languages Cross-platform free software Programming languages created in 2016 High-level programming languages 2016 software Dynamically typed programming languages Egyptian inventions Free software projects Software using the MIT license Free software programmed in C Multi-paradigm programming languages Extensible syntax programming languages