Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 5675405ac5936f0ba3000002

Create bison tokens

Create tokens for bison out of a known list of words

Start file
call real integer write read while end do if then else program var begin return include
End file
call {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Call;
}
real {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Real;
}
integer {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Integer;
}
write {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Write;
}
read {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Read;
}
while {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return While;
}
end {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return End;
}
do {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Do;
}
if {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return If;
}
then {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Then;
}
else {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Else;
}
program {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Program;
}
var {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Var;
}
begin {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Begin;
}
return {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Return;
}
include {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Include;
}

View Diff

1c1,80
< call real integer write read while end do if then else program var begin return include
---
> call {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Call;
> }
> real {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Real;
> }
> integer {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Integer;
> }
> write {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Write;
> }
> read {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Read;
> }
> while {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return While;
> }
> end {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return End;
> }
> do {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Do;
> }
> if {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return If;
> }
> then {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Then;
> }
> else {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Else;
> }
> program {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Program;
> }
> var {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Var;
> }
> begin {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Begin;
> }
> return {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Return;
> }
> include {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Include;
> }

Solutions by @braxler:

Unlock 3 remaining solutions by signing in and submitting your own entry
Created by: @BotticelliAlex

18 active golfers, 47 entries

Solutions by @braxler:
85
#3 - John Braxler / @braxler

08/10/2018 at 01:53PM

86
#>6 - John Braxler / @braxler

02/12/2016 at 07:02PM

88
#>7 - John Braxler / @braxler

12/21/2015 at 03:47PM