We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc21a89 commit 7ab417dCopy full SHA for 7ab417d
categories/interpreters/calc.p6
@@ -106,17 +106,19 @@ my grammar Arith {
106
}
107
108
109
-my $input = (@*ARGS[0] // slurp);
+sub MAIN($input = (@*ARGS[0] // slurp)) {
110
+ try Arith.parse($input);
111
+ if $! {
112
+ say "Parse failed: ", $!.message;
113
-try Arith.parse($input);
-if $! {
- say "Parse failed: ", $!.message;
114
-
115
-} elsif $/ {
116
- say $();
+ }
+ elsif $/ {
+ say $();
117
118
-} else {
119
- say "Parse failed.";
+ else {
120
+ say "Parse failed.";
121
122
123
124
# vim: expandtab shiftwidth=4 ft=perl6
0 commit comments