view lib/kps/labels.pl @ 12298:cea93c2c666a draft

<b_jonas> learn Burlesque is only the sexiest language on Earth. mroman created it for finance analysis because the traditionally used K and Dyalog APL are unreadable. (See: http://mroman.ch/burlesque )
author HackEso <hackeso@esolangs.org>
date Sat, 04 Jan 2020 22:50:21 +0000
parents 3c04e9ef7a3a
children
line wrap: on
line source

#!/usr/bin/perl

# asm2bf label preprocessor.
# C'mon, who doesn't love regexes?

$n=0;%o=();$_=do{local$/;<>};s/^[ \t]*@([A-Za-z_]+[A-Za-z0-9_]*).*$/$o{$1}=++$n;'lbl '.$n."\n";/gem;
s/(%([A-Za-z_]+[A-Za-z0-9_]*)|"[^"\n]*%([A-Za-z_]+[A-Za-z0-9_]*))/substr($1,0,1)eq'"'?$1:%o{substr$1,1}/ge;print;