Untitled

Run Settings
LanguageRaku
Language Version
Run Command
#!/usr/bin/env raku my %VARS; my %FNS = '+' => { $^a + $^b }, '-' => { $^a - $^b }, '*' => { $^a * $^b }, '/' => { $^a / $^b }; grammar Simple { token TOP { <statement>* %% \n || <comment> || <code> } token statement { <comment> || <loop> || <assignement> || <call> } token comment { '#' \N* } regex loop { 'for' \s+ $<cond>=<code> \n+ $<body> = <statement>* \s* 'end' { my $cond = $<cond>; my @statements = $<statement>; while eval($cond) { eval($_) for @statements; } } } token assignement { $<identifier> = \w+ \s* '=' \s* <code> {%VARS{$<identifier>} = $<code>.made} } token call { $<args> = (\w+ %% \s+) $<fn> = \S+ {say "[call] $<fn> ($<args>)"} } token code { $<value> = [\d+|'"' <(<-["]>*)> '"'] {make $<value>} | $<identifier> = \w+ {make %VARS{$<identifier>} // 0 } } } sub eval($code) { say "[code] $code"; Simple.parse($code)<code>.made; } my $code = Simple.parse: q:to/LANG/; n = 5 z = 0 for z end LANG say $code; say %VARS;
Editor Settings
Theme
Key bindings
Full width
Lines