Ring (programming language)
{{Short description|Dynamically typed, general-purpose programming language}}
{{infobox programming language
| logo = Ringlogo transparent.png
| paradigm = Multi-paradigm: object-oriented, imperative, functional, procedural, reflective, declarative, natural language programming
| year = {{Start date and age|2016|01|25}}
| designer = Mahmoud Samir Fayed{{cite web |url=https://link.springer.com/content/pdf/bbm%3A978-1-4842-5833-0%2F1.pdf |title=A Dialogue with Mahmoud Fayed |author= M. Ayouni|date=29 July 2020 |publisher=Springer}}
| developer = The Ring Development Team
| latest release version = {{wikidata|property|edit|reference|P348}}
| latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}}
| latest_test_version =
| latest_test_date =
| typing = Dynamic
| influenced_by = Lua, Python, Ruby, C, C#, BASIC, QML, xBase, Supernova
| influenced = SimpleLang,{{cite web |url=https://simple-lang.sourceforge.io |title=The Simple programming language |author=Azeez Adewale}} DragonLang {{cite web |url=https://www.dragon-lang.org/ |title=The Dragon programming language |author= Aavesh Jilani}}
| programming language = C
| operating_system = Windows, Linux and macOS
| license = MIT License
| website = http://ring-lang.net
| file_ext = .ring, .rh, .rform
| wikibooks = Ring
}}
Ring is a dynamically typed, general-purpose programming language. It can be embedded in C/C++ projects, extended using C/C++ code or used as a standalone language.{{cite web |url=https://www.rangakrish.com/index.php/2021/08/07/first-encounter-with-the-ring-programming-language/ |title=First Encounter with the Ring Programming Language |author= Dr. Rangarajan Krishnamoorthy |date=7 August 2021 |publisher=rangakrish.com|archive-url=https://web.archive.org/web/20210809074142/https://www.rangakrish.com/index.php/2021/08/07/first-encounter-with-the-ring-programming-language/ |archive-date=2021-08-09 }} The supported programming paradigms are imperative, procedural, object-oriented, functional, meta, declarative using nested structures, and natural programming.{{cite web |url=https://bimarabia.com/download/BIMarabia_Arabic/BIMarabia27.pdf |title=The Ring programming language Review |author=Omar Selim |date=January 2018 |publisher=BIMArabia Magazine |access-date=2024-03-24 |archive-date=2023-11-17 |archive-url=https://web.archive.org/web/20231117130807/https://bimarabia.com/download/BIMarabia_Arabic/BIMarabia27.pdf |url-status=bot: unknown }}{{cite web |url=https://ring-lang.github.io/ref/ArabicBook_YourWayToProgramming_TalkAboutRing.pdf |title=Your way to programming (Arabic Book, Pages 56-57) talk about Ring |author=Ahmed Tartour |date=January 2020 |publisher=Kotobna}} The language is portable (Windows, Linux, macOS, Android,{{cite web |url=https://www.dotnetpro.de/diverses/sprachen/ring-flexibel-einfach-schnell-1571947.html |title=Ring: flexible, simple, fast |author= Bernhard Lauer |date=14 August 2018 |publisher=Dotnetpro}} WebAssembly,{{cite web |url=https://www.infoworld.com/article/3572395/ring-language-upgrade-focuses-on-webassembly.html |title=Ring language upgrade focuses on WebAssembly |author= Paul Krill|date=24 August 2020 |publisher=InfoWorld}} etc.){{cite book |last=Ghanem |first=Mohamed |title=Developing Poet Software using Ring language |url= https://ring-lang.github.io/ref/GhanemBookAboutRing.pdf |publisher=MetaBook (Egypt - Mansoura)|date=2021|isbn=978-977-6928-38-1 }} and can be used to create console, GUI, web, game and mobile applications.{{Cite book|url=https://www.apress.com/gp/book/9781484258323|title=Beginning Ring Programming - From Novice to Professional {{!}} Mansour Ayouni {{!}} Apress|language=en}}{{cite news |url=https://www.youm7.com/story/2016/1/11/%D9%81%D9%89-25-%D9%8A%D9%86%D8%A7%D9%8A%D8%B1-%D8%A7%D9%84%D9%85%D9%82%D8%A8%D9%84-%D9%84%D8%BA%D8%A9-%D8%A8%D8%B1%D9%85%D8%AC%D8%A9-%D8%AC%D8%AF%D9%8A%D8%AF%D8%A9-%D8%A8%D9%85%D9%88%D8%A7%D8%B5%D9%81%D8%A7%D8%AA-%D8%B9%D8%A7%D9%84%D9%85%D9%8A%D8%A9-%D9%85%D9%86/2532713 |title= Ring: A New programming language |author=Hany Salah |date=11 January 2016 |work=youm7.com |publisher=youm7}}{{Cite news|title=Ring: A programming language developed by Arab|url=https://muslims-res.com/%D9%84%D8%BA%D8%A9-%D8%A8%D8%B1%D9%85%D8%AC%D9%8A%D8%A9-%D8%AC%D8%AF%D9%8A%D8%AF%D8%A9-%D8%A8%D8%A3%D9%8A%D8%AF%D9%8D-%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9-%D9%88%D9%84%D9%82%D8%A7%D8%A1-%D8%AD%D8%B5%D8%B1/|access-date=2020-09-28|newspaper=الباحثون المسلمون|author=Ahmed Mohammed Hassan|date=12 December 2015 }}{{Cite news|title=A book about the Ring programming language|url=https://muslims-res.com/%D9%84%D8%BA%D8%A9-%D8%B1%D9%8A%D9%86%D8%AC-%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%8A%D8%A9-ring-programming/|access-date=2020-09-28|newspaper=الباحثون المسلمون|author=Abedallah Salehani|date=18 March 2020 }}
History
In 2009, Mahmoud Samir Fayed created a minor domain-specific language called Supernova that focuses on User interface (UI) creation and uses some ideas related to Natural Language Programming, then he realized the need for a new language that is general-purpose and can increase the productivity of natural language creation. Ring aims to offer a language focused on helping the developer with building natural interfaces and declarative DSLs.{{cite web |url=https://ring-lang.github.io/doc1.16/faq.html |title=Ring Language - Frequently Asked Questions (FAQ) |author=Ring Team|date=September 2021 |publisher=Ring Team}}{{cite web |url=https://www.codeproject.com/Articles/66996/Supernova-Programming-Language |title=Supernova programming language |author=Fayed|date=April 2010 |publisher=Code Project}}{{cite web |url=https://www.youm7.com/story/2011/12/24/%D8%B4%D8%A7%D8%A8-%D9%85%D8%B5%D8%B1%D9%89-%D9%8A%D8%A8%D8%AA%D9%83%D8%B1-%D8%B3%D9%88%D8%A8%D8%B1-%D9%86%D9%88%D9%81%D8%A7-%D9%88%D8%AA%D9%82%D9%86%D9%8A%D8%A9-%D8%A8%D8%B1%D9%85%D8%AC%D8%A9-%D8%A8%D8%AF%D9%88%D9%86-%D9%83%D9%88%D8%AF/562415 |title=Supernova language by Egyptian programmer|author=Omnia|date=December 2011 |publisher=Youm7}}{{cite web |url=https://www.softpedia.com/get/Programming/Coding-languages-Compilers/Fayed-Ring.shtml |title=Ring 1.16 review |author= Softpedia Team|date=23 October 2021 |publisher=Softpedia}}
Goals
The general goals behind Ring:{{cite web |url=https://medium.com/sitesonic/ring-programming-language-what-do-you-need-to-know-23c51b315e4d |title=Ring Programming Language: What Do You Need To Know? |author=Naveen Verma |date=14 Aug 2018 |publisher=Medium}}
{{cite news |url=https://www.youm7.com/story/2018/5/29/%D9%85%D8%B5%D8%B1%D9%89-%D9%8A%D9%81%D9%88%D8%B2-%D9%81%D9%89-%D9%85%D8%B3%D8%A7%D8%A8%D9%82%D8%A9-%D8%A7%D9%84%D8%B3%D9%88%D8%B1%D8%B3-%D9%81%D9%88%D8%B1%D8%AC-%D9%84%D9%84%D9%85%D8%B4%D8%A7%D8%B1%D9%8A%D8%B9-%D9%85%D9%81%D8%AA%D9%88%D8%AD%D8%A9-%D8%A7%D9%84%D9%85%D8%B5%D8%AF%D8%B1/3812107 |title= Progress in developing PWCT 2.0 using Ring|author=Mones Hawas |date=29 May 2018 |work=youm7.com |publisher=youm7}}
- 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.{{cite journal |last1=Fayed |first1=Mahmoud S. |last2=Al-Qurishi |first2=Muhammad |last3=Alamri |first3=Atif |last4=Hossain |first4=M. Anwar |last5=Al-Daraiseh |first5=Ahmad A. |title=PWCT: a novel general-purpose visual programming language in support of pervasive application development |journal=CCF Transactions on Pervasive Computing and Interaction |date=October 2020 |volume=2 |issue=3 |pages=164–177 |doi=10.1007/s42486-020-00038-y |s2cid=225395711}}
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:
print("Hello, World!")
Another style: similar to xBase languages like Clipper 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 written in other languages
Translate Ring keywords to Japanese
ChangeRingKeyword See 手紙を出す
ChangeRingOperator + そして
改行 = nl
します。 = :します。
手紙を出す "こんにちは、世界" そして 改行 します。
ChangeRingKeyword 手紙を出す See // キーワードの復旧
ChangeRingOperator そして + // 演算子の復旧
Translate Ring keywords to Arabic
ChangeRingKeyword See إطبع
إطبع "Hello, World!"
ChangeRingKeyword إطبع See
Use style similar to the Pascal programming language
ChangeRingKeyword func function
ChangeRingKeyword see write
begin = :begin
function main
begin
write("Hello, World!");
return 0;
end
ChangeRingKeyword function func
ChangeRingKeyword write see
{{cite web |url=https://www.codeproject.com/Tips/1222859/Different-styles-for-writing-Hello-World-program-i |title=Different styles for writing Hello World program in the Ring programming language |author=Rubin Liu |date=28 December 2017 |work=codeproject.com |publisher=Code Project}}{{cite web |url=https://www.youtube.com/watch?v=7BqoQldx0Pk&list=PL8SruvH85P0uA8ggijCQUR9tXAXF4bmtu&index=2 |title=Ring programming tutorial |author=Roshan Ali |date=4 June 2018 |publisher=YouTube}}{{cite web | url=https://ring-lang.github.io/doc1.19/getting_started3.html | title=Getting Started - Third Style — Ring 1.19 documentation }}
=Loop command=
The Loop command can take an integer to apply the continue semantics to enclosing outer loops{{cite web |url=https://www.rangakrish.com/index.php/2021/08/21/loop-command-in-ring-programming-language/ |title="Loop" Command in Ring Programming Language |author= Dr. Rangarajan Krishnamoorthy |date=21 August 2021 |publisher=rangakrish.com|archive-url=https://web.archive.org/web/20230323171354/https://www.rangakrish.com/index.php/2021/08/21/loop-command-in-ring-programming-language/ |archive-date=2023-03-23 }}
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.){{Cite web|url=https://ring-lang.github.io/doc1.16/oop.html|title = Object Oriented Programming (OOP) — Ring 1.16 documentation}}
new point { # Create new object from the Point class the access the object using braces
x=10 y=20 z=30 # Set the object attributes
print() # Call the print() method
} # 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{{cite web |url=https://www.rangakrish.com/index.php/2021/09/04/ring-language-dynamic-behavior-of-classes-and-objects/ |title=Ring Language: Dynamic Behavior of Classes and Objects |author= Dr. Rangarajan Krishnamoorthy |date=4 September 2021 |publisher=rangakrish.com|archive-url=https://web.archive.org/web/20230529153208/https://www.rangakrish.com/index.php/2021/09/04/ring-language-dynamic-behavior-of-classes-and-objects/ |archive-date=2023-05-29 }}
? "Creating a new class dynamically..."
eval("class DynamicClass a b")
? "Printing the instance..."
? new DynamicClass {a=1 b=2}
Implementation
=Compiler and virtual machine=
Ring programs are not interpreted directly from the textual Ring file, but are compiled into bytecode, which is then run on the Ring virtual machine. 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 and the virtual machine are designed using visual programming through the Programming Without Coding Technology software then the C code is generated.
=Extensions=
File:Ringlang shot8.png Implementation using Ring Game Engine for 2D Games]]
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)
- RingODBC (Open Database Connectivity)
- RingOpenGL (OpenGL 1.1-4.6)
- RingOpenSSL (OpenSSL)
- RingPostgreSQL (PostgreSQL)
- RingQt (Qt framework)
- RingRayLib (raylib)
- RingSDL (SDL-Simple DirectMedia Layer Library)
- RingSQLite (SQLite)
- RingWinAPI (Windows API)
- RingWinCREG (Windows Registry)
- RingZIP (zip file processing library)
{{cite web |url=https://www.codeproject.com/Articles/1096942/Squares-Puzzle-using-RingAllegro |title=Squares Puzzle using RingAllegro |author=Majdi Sobain |date=2 May 2017 |work=codeproject.com |publisher=Code Project}}
=Libraries=
Ring comes with libraries written in Ring itself, such as libraries related to web and game development.
class="wikitable" |
Library Name
! Description |
---|
Standard Library
| General Classes and functions. |
GUI Library
| Classes and functions for creating GUI applications |
Objects Library
| Classes and functions for creating GUI applications using the MVC design pattern |
Web Library
| Simple framework for developing web applications using the MVC design pattern |
Game Engine
| Support developing 2D Games for Desktop and Mobile using Declarative Programming based on Allegro and LibSDL |
Natural Library
| General-Purpose Natural Language Programming Library. |
Trace Library
| A library for debugging applications. |
Type Hints
| A library for adding type hints to functions. |
Big Number Library
| Support arithmetic operations on huge numbers. |
Fox Ring Library
| Contains functions similar to Visual FoxPro. |
ZeroLib Library
| Contains classes where the Index starts from 0 instead of 1. |
{{cite web |url=https://www.codeproject.com/Articles/1200766/Using-the-Natural-Language-Programming-Library-NLP |title=Using the Natural Language Programming Library (NLPL) in the Ring Programming Language |author=Fayed |date=11 August 2017 |work=codeproject.com |publisher=Code Project}}{{cite web |url=https://www.codeproject.com/Articles/1138605/Natural-Language-Programming-in-the-Ring-Programmi |title=Natural Language Programming in the Ring Programming Language |author=Fayed |date=12 October 2016 |work=codeproject.com |publisher=Code Project}}
=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 3D Game
- Game 2048
- Knight Tour Game
- Minesweeper Game
- Othello Game
- Sokoban Game
- Sudoku Game
- Tic-tac-toe 3D Game
- Video Music Player application
- Windows Startup Manager application
{{cite web |url=https://ring-lang.github.io/resources.html |title=Applications written in Ring|author=Open Source Developers |date=15 June 2019 |publisher=Ring Team}}{{cite web |url=https://store.steampowered.com/app/939200/Gold_Magic_800/ |title=Gold Magic 800 Game by Etqan Company |author=Etqan Company |date=25 September 2018 |publisher=Steam (software)}}
=Tools=
Ring is distributed with a Standard IDE that includes the following tools:
- Ring REPL (Read–eval–print loop)
- Ring2EXE (Distributing executable applications)
- RingPM (The Ring Package manager)
- Ring Notepad (Source-code editor)
- Form Designer (WYSIWYG GUI designer)
Ring is also distributed with extensions for many code editors such as Emacs, Notepad++, Geany, Atom, Sublime Text 2, and Visual Studio Code.
=Documentation=
Ring is distributed with documentation written using Sphinx. A Japanese translation of the documentation is also available.{{Cite web|url=http://ring-lang-081.osdn.jp/docs-1.16/index.html|title=ようこそ Ring 取扱説明書へ! — プログラミング言語 Ring 1.16 取扱説明書|access-date=2021-10-30|archive-date=2021-10-30|archive-url=https://web.archive.org/web/20211030103530/http://ring-lang-081.osdn.jp/docs-1.16/index.html|url-status=dead}}
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).{{cite web |url=https://www.tiobe.com/tiobe-index/ |title=TIOBE Index | TIOBE - the Software Quality Company |website=www.tiobe.com |access-date=28 February 2022 |archive-url=https://web.archive.org/web/20180221113115/https://www.tiobe.com/tiobe-index/ |archive-date=21 February 2018 |url-status=dead}} As of October 2020, Ring holds position 93 on the TIOBE index.{{Cite web|title=Top 100 Programming Languages|url=https://www.bairesdev.com/blog/top-100-programming-languages/|access-date=2020-10-06|website=BairesDev|author=Emma White|date=6 October 2020 }} Ring is listed by GitHub in the list of programming languages that are actively developed.{{Cite web|url=https://github.com/collections/programming-languages|title = Build software better, together|website = GitHub}}
=Criticism=
Ring critics pointed to some features in Ring that are not common in widely used programming languages.{{cite web |url=https://www.ciklum.com/blog/new-programming-languages-a-hype-or-reality/ |title=New Programming Languages – A Hype Or Reality? |author=Ciklum |date=12 December 2017 |work=ciklum.com |publisher=Ciklum |access-date=1 February 2024 |archive-date=7 December 2017 |archive-url=https://web.archive.org/web/20171207084845/https://www.ciklum.com/blog/new-programming-languages-a-hype-or-reality/ |url-status=bot: unknown }}
- 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[1] # print R
aList = ["One","Two","Three"]
? aList[1] # print One
==Implicit type conversions==
The language can automatically convert between numbers and strings.{{Cite web|url=https://ring-lang.github.io/doc1.16/variables.html#implicit-conversion|title = Variables — Ring 1.16 documentation}}
/*
- 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
References
{{reflist}}
Further reading
- Ghanem (2021) [https://ring-lang.github.io/ref/GhanemBookAboutRing.pdf Developing Poet Software using Ring language (Arabic Book)], MetaBook (Egypt - Mansoura)
- Ayouni (2020) [https://www.apress.com/gp/book/9781484258323 Beginning Ring Programming], Apress (part of Springer Nature)
- Hassouna (2019) [https://ring-lang.github.io/ref/RingBasics_ArabicBook.pdf Ring Basics (Arabic Book)], [https://www.hassouna-academy.com/ringcourses Hassouna Academy]
- Sobain (2017) [http://ring-wincreg.sf.net/docs/ RingWinCReg Extension Documentation], SourceForge
- Fayed (2016) [https://www.codeproject.com/Articles/1089887/The-Ring-Programming-Language The Ring Programming Language], CodeProject
External links
{{Wikibooks|Ring}}
- [http://www.ring-lang.net/ Ring home page]
- [https://rosettacode.org/wiki/Category:Ring RosettaCode samples]
- [http://ring-lang-081.osdn.jp/docs-1.16/index.html Ring Documentation (Japanese)] {{Webarchive|url=https://web.archive.org/web/20211030103530/http://ring-lang-081.osdn.jp/docs-1.16/index.html |date=2021-10-30 }}
- [https://ring-lang.github.io/web/formdesigner/project.html Online Form Designer (WebAssembly)]
{{FOSS}}
{{Programming languages}}
Category:Programming languages
Category:Cross-platform free software
Category:Programming languages created in 2016
Category:High-level programming languages
Category:Dynamically typed programming languages
Category:Free software projects
Category:Software using the MIT license
Category:Free software programmed in C