Raku (programming language): Difference between revisions

Content deleted Content added
Undid revision 1227256877 by HyperAccelerated (talk) - restore material that is entirely appropriate for an encyclopedia
reFill
Line 75:
 
==Implementations==
{{As of|2017}}, only the [[Rakudo]] implementation is under active development. No implementation will be designated as the official Raku implementation; rather, "Raku is anything that passes the official test suite."<ref name="syn01">{{cite web |url=https://design.raku.org/S01.html |title=Synopsis 1: Overview |last1=Wall |first1=Larry |author1-link=Larry Wall |date=2004-08-10}}</ref>
 
Rakudo Perl 6<ref>{{cite web|url=https://github.com/rakudo/rakudo/ |title=rakudo/rakudo - GitHub |publisher=Github.com |access-date=2013-09-21}}</ref><ref>{{cite web |url=http://use.perl.org/~pmichaud/journal/35400 |title=The compiler formerly known as 'perl6' |author=Michaud, Patrick |date=2008-01-16 |url-status=dead | archive-url=https://web.archive.org/web/20120218080103/http://use.perl.org/~pmichaud/journal/35400 | archive-date=2012-02-18}}</ref> targets a number of virtual machines, such as [[MoarVM]], the [[Java virtual machine|Java Virtual Machine]], and [[JavaScript]]. MoarVM is a [[virtual machine]] built especially for Rakudo<ref>{{cite web |last=Worthington |first=Jonathan |title=MoarVM: A virtual machine for NQP and Rakudo |url=http://6guts.wordpress.com/2013/05/31/moarvm-a-virtual-machine-for-nqp-and-rakudo/ |work=6guts |date=31 May 2013 |access-date=24 July 2013}}</ref> and the NQP Compiler Toolchain.<ref>{{Cite web |url=https://github.com/Raku/nqp |title=NQP - Not Quite Perl at github |website=[[GitHub]] |date=2022-05-29 | access-date=2022-05-29}}</ref> There is a layer between Raku and the virtual machines named Not Quite Perl 6 (NQP), which implements [[Raku rules]] for parsing Raku, and an [[abstract syntax tree]] and backend-specific [[Code generation (compiler)|code generation]]. Large portions of Rakudo are written in Raku, or in its subset NQP. Rakudo is not a completely [[Self-hosting (compilers)|self-hosting implementation]], nor are there concrete plans at this point to make Rakudo a [[Bootstrapping (compilers)|bootstrapping compiler]].
Line 363:
In low-level languages, the concept of [[Macro (computer science)|macros]] has become synonymous with textual substitution of source-code due to the widespread use of the [[C preprocessor]]. However, high-level languages such as [[Lisp programming language|Lisp]] pre-dated C in their use of macros that were far more powerful.<ref>{{cite book | title=Successful Lisp: How to Understand and Use Common Lisp | author=Lamkins, David B. | date=2004-12-08 | publisher=bookfix.com | url=http://psg.com/~dlamkins/sl/chapter20.html | access-date=13 September 2006 | archive-date=12 September 2006 | archive-url=https://web.archive.org/web/20060912113327/http://www.psg.com/~dlamkins/sl/chapter20.html | url-status=dead }}</ref> It is this Lisp-like macro concept that Raku will take advantage of.<ref name="syn6"/> The power of this sort of macro stems from the fact that it operates on the program as a high-level [[data structure]], rather than as simple text, and has the full capabilities of the programming language at its disposal.
 
A Raku macro definition will look like a subroutine or method definition, and it can operate on unparsed strings, an [[Abstract syntax tree|AST]] representing pre-parsed code, or a combination of the two. A macro definition would look like this:<ref name="macros">{{citeCite web |url=https://designgithub.raku.orgcom/S06.html#Macros Raku/old-design-docs|title=MacrosRaku/old-design-docs|date=10 September 2024|via=GitHub}}</ref>
 
<syntaxhighlight lang="raku">