Skip to content

Instantly share code, notes, and snippets.

--- src/Perl6/Actions.pm.orig 2011-08-24 13:34:35.000000000 +0000
+++ src/Perl6/Actions.pm 2011-08-24 13:36:30.000000000 +0000
@@ -3790,17 +3790,18 @@ class Perl6::Actions is HLL::Actions {
sub wrap_return_handler($past) {
PAST::Op.new(
:pirop('perl6_type_check_return_value 0P'),
- PAST::Stmts.new( :signature('0Pv'),
- PAST::Op.new(:pasttype<lexotic>, :name<RETURN>,
- # If we fall off the bottom, decontainerize if
- # rw not set.
@masak
masak / description.md
Created September 13, 2012 08:50
Mini-challenge: parsing indented input into an AST

Yesterday I wanted to parse something like this:

alpha
  beta
  gamma
delta
  epsilon
    zeta

And end up with an AST nested like this: (alpha(beta, gamma), delta(epsilon(zeta))). The actual type of the AST could be just a list of lists of strings, or actual Node objects; it's all isomorphic. That is, the AST contains exactly the same hierarchy as the text. Assume for simplicity that we want to hardcode indentation as being two spaces.