Skip to content

Instantly share code, notes, and snippets.

View snarkyboojum's full-sized avatar
🧠
Probably not on a plane

Adrian White snarkyboojum

🧠
Probably not on a plane
  • Sydney, Australia
View GitHub Profile
# Read Makefile.in, edit, write Makefile
my $maketext = slurp( 'Makefile.in' );
$maketext .= subst( .key, .value ) for
'Makefile.in' => 'Makefile',
'To be read' => 'Written',
'replaces <TOKENS>' => 'defined these',
# Maintainer note: keep the following in sync with pod#VARIABLES below
'<PERL6>' => $perl6,
'<PERL6LIB>' => $perl6lib,
'<PERL6BIN>' => $perl6bin,
se v6;
# parse cmdline opts and run tardis
while (my $cmd = prompt '> ') {
given $cmd {
when /look/ { say 'look...' }
#!/usr/bin/perl
# NOTE: this script must be run from the root of the local Rakudo git repository
# This script wraps up all the bits and pieces used to get, build, and spec test
# Rakudo.
#
# The script optionally takes a single date argument of the format YYYY-mm-dd
# and builds a spectest summary for each day from that date to the last full day
# commit made to Rakudo. This is useful when generating spectest summary data
From 8e0cc2e7104bebfa25bc89155267661ee3beea0e Mon Sep 17 00:00:00 2001
From: snarkyboojum <snarkyboojum@gmail.com>
Date: Fri, 2 Apr 2010 23:49:54 +1100
Subject: [PATCH] An attempt at making the 'say' op go through an object with a .say method
---
lib/Yapsi.pm | 11 ++++++++++-
yapsi | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
#!/usr/bin/alpha
use v6;
use Tardis;
use Yapsi;
my $program;
if @*ARGS == 2 && @*ARGS[0] eq '-e' {
$program = @*ARGS[1];
}
elsif @*ARGS == 1 {
use v6;
my $VERSION = '2010.05';
grammar Yapsi::Perl6::Grammar {
regex TOP { ^ <statementlist> $ }
regex statementlist { <statement> ** <eat_terminator> }
token statement { <expression> }
token eat_terminator { <?after '}'> \n || <.ws> ';' <.ws> }
token expression { <assignment> || <binding> || <variable> || <literal>
perl -MExtUtils::Embed -e xsinit -- -o src/pmc/init_with_xs.h
cc -c -o src/pmc/blizkost_group.o -I/Users/adrian/Development/Perl6/rakudo/parrot_install/include/2.3.0-devel -I/Users/adrian/Development/Perl6/rakudo/parrot_install/include/2.3.0-devel/pmc -fno-common -no-cpp-precomp -pipe -fstack-protector -I/usr/local/include -I/opt/local/include -pipe -fno-common -DHASATTRIBUTE_CONST -DHASATTRIBUTE_DEPRECATED -DHASATTRIBUTE_MALLOC -DHASATTRIBUTE_NONNULL -DHASATTRIBUTE_NORETURN -DHASATTRIBUTE_PURE -DHASATTRIBUTE_UNUSED -DHASATTRIBUTE_WARN_UNUSED_RESULT -DDISABLE_GC_DEBUG=1 -DNDEBUG -DHAS_GETTEXT -falign-functions=16 -fvisibility=hidden -funit-at-a-time -maccumulate-outgoing-args -W -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wextra -Wformat -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline -Winvalid-pch -Wmissing-braces -Wmissing-field-initializers -Wn
cc -c -o src/pmc/bkmarshal.o -I/Users/adrian/Development/Perl6/rakudo/parrot_install/include/2.3.0-devel -I/Users/adrian/Development/Perl6/rakudo/parrot_install/include/2.3.0-devel/pmc -fno-common -no-cpp-precomp -pipe -fstack-protector -I/usr/local/include -I/opt/local/include -pipe -fno-common -DHASATTRIBUTE_CONST -DHASATTRIBUTE_DEPRECATED -DHASATTRIBUTE_MALLOC -DHASATTRIBUTE_NONNULL -DHASATTRIBUTE_NORETURN -DHASATTRIBUTE_PURE -DHASATTRIBUTE_UNUSED -DHASATTRIBUTE_WARN_UNUSED_RESULT -DDISABLE_GC_DEBUG=1 -DNDEBUG -DHAS_GETTEXT -falign-functions=16 -fvisibility=hidden -funit-at-a-time -maccumulate-outgoing-args -W -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wextra -Wformat -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline -Winvalid-pch -Wmissing-braces -Wmissing-field-initializers -Wno-missing-format-attribute -Wmissing-include-dirs -Wmultichar -Wpac
$ yapsi -e '{{}; my $a = 5; { say $a }; say $a; { say $a; {}; }}; {}'
SIC emitted for this:
This is SIC v2010.05
block 'main':
`lexicals: <>
$0 = fetch-block 'main_1'
call $0
$ALPHA yapsi --target=sic -e 'my $test = 5; { say $test }; {}; {}; {{{}};{}}'
This is SIC v2010.05
block 'main':
`lexicals: <$test>
$0 = 5
$1 = fetch '$test'
store '$test', $0
$2 = fetch-block 'main_1'
call $2