Skip to content
0:00 / 0:00

#raku#rakuast#ast

Jonathan Worthington - RakuAST - Raku Keynote

The Perl and Raku Conference - Greenville, SC 2026

3.7K subscribers • 5 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Jonathan Worthington

Advanced. Deep dive for people who know the field.

1.9K views6 years ago1 recommendation

Programming languagesSystems programmingLanguage design and type systemsCompilers and interpreters

Jonathan Worthington introduces RakuAST, a document object model for Raku code that enables robust compile-time manipulation and macro support.

Raku already invites the programmer to participate in compile time, for example by implementing trait handlers, customizing meta-classes, producing meta-objects in an EXPORT, or using BEGIN blocks directly. These are utilized by a range of modules, such as Red (an ORM), Cro (used for building web applications) and ASN::META (parsing an ASN specification and exporting Raku classes based on the specification). The key limitation today is that there’s no document object model for Raku code itself. For example, it would be desirable in a web framework to have a Raku regex used for validation on the server side be translated into one usable on the HTML5 pattern attribute - however that would only be achieved today by a program choosing to re-parse the Raku regex syntax itself! Similarly, modules that produce Raku code and EVAL it would be far more robust if they could instead build a tree of objects representing the Raku program. Macros, too, will only reach their potential if the programmer can work with the AST passed in. Therefore, I’m currently working on RakuAST, a user-facing Abstract Syntax Tree for Raku programs. In this talk, I’ll share the design and implementation progress on that so far, and some of the things it will enable.

Why it's here

1 person recommends this

What people say. Recommended as a demonstration of Raku's powerful compile-time capabilities, macro system, and language-oriented programming features.

Moments people linked to

u/raiphin r/ProgrammingLanguages • Recommends

On “Does a language like this exist?”

Raku is a well designed shape-shifting Ship of Theseus which can be morphed into any PL. (In principle. *Relatively* easily. Though it can still be not realistically worthwhile or viable to do so!). And, more to your/Jef's point, *any combination* of PLs. Raku is thus automatically a candidate for turning into, or hosting, any PL or PL mashup anyone wishes existed. And the unification can be as seamless or as chalk and cheese as a PL mixer prefers. To (over)simplify Raku's connections with the 5 Jef suggested oh so long ago: * **Lisp** One of the first programming languages Larry Wall used in a $dayjob around 1980 was Lisp. Its influence runs deep, even if his views on syntax were arguabl…

u/raiphin r/ProgrammingLanguages • Recommends

On “Simple Macros”

> My relationship with macros in other languages (OK, C) has not been positive. C macros are text substitution macros. They amply demonstrate how *not* to do things. "We decide we don't want to have magic numbers in our code ... oops" shows how: #define header_size = 2 #define body_size = 3 #define total_size = header_size + body_size ... leads to disaster. > As typically implemented elsewhere, they are just too complicated, too powerful, and too enticing Maybe in *older* PLs, or rather *most* of them. But Lisp showed the right way (hygienic AST macros) a *long* time ago, and the macro systems I've seen in recent PLs seem to have gotten the message. > I just don't lik…
15View on Reddit

u/raiphin r/ProgrammingLanguages • Recommends

On “How can I create a language?”

There are three sections in this comment covering quickly creating your first, second, and third programming languages, with each being more ambitious, using the programming language creation tool Raku. It's just a suggestion for a fun easy way to get going. Ultimately, whatever tech you choose to use, don't forget to apply the -Ofun compiler option. 🤩 # Your *first* toy language Use an online Raku evaluator such as replit's to follow this **4 minutes 20 second** live coding video in which Andrew starts a programming language from scratch and successfully runs its first couple programs, typing and explaining everything, no cheating. He: * Introduces Raku (which used to be called Perl…

u/raiphin r/ProgrammingLanguages • Recommends

On “Where to start for self-learning of the basics?”

*(Edited to replace the fishing rod (camas is currently 404ing), replace 'raku' for searching years prior to introduction of that name, and other tweaks.)* ---- Hi. I focus on Raku, another "language oriented programming" language that *might* be of interest. (Think Racket, but then think again.) I've commented about it many times in this sub over the last decade, including many comments about its use for folk in your situation. I do so again in this comment. But let me first given you a fishing rod in the form of a way to search this sub (or indeed the entire of reddit) for comments about aspects of Racket, self-learning, Raku, or whatever. ---- Not a lot of people are aware of pushsh…

u/raiphin r/ProgrammingLanguages • Recommends

On “Video resources to help learn”

This 4 minute video should change open minded folks' thinking about what is possible. When this video was produced (2018), the languages ecosystem underlying the builder it demonstrates wasn't mature enough to change the rules of the game. (Moreover, in the end, the rules of the programming game, and thus the programming of programming languages game, is all just nomics.) But I think it's well worth a watch to: * **See what's possible for PL lovers** The language developed in those 4 minutes is just the creamy filling of a Twinkie. But if you imagine a Twinkie as a form of food, and let your imagination soar rather than cynicism overrule your heart, you should begin to see *possibiliti…

u/raiphin r/ProgrammingLanguages • Recommends

On “Literature about mixing compile time and runtime code.”

Some lisps have addressed this to a degree. I daresay there will have been some academic papers written in the last 30 years or so about relevant lisp capabilities. Perl has supported mixing compile-time and run-time since shortly after its first release in 1987. Perl has traditionally offended most academics (not to mention most non-academics), but I daresay its mixing of compile phase and run phase capabilities (including run-time within compile phase and compile-time within run-phase) will have been mentioned in papers in the 1990s. \---- I focus on Larry Wall's new PL Raku. In Raku the notion of multi-phase programming subsumes multi-stage programming which in turn subsumes compile-t…