Migrated first 6 gists.
This commit is contained in:
1
rmfen.l/README.md
Normal file
1
rmfen.l/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Flex lexer for rithmomachia boards represented in reduced modified FEN notation.
|
||||
20
rmfen.l/rmfen.l
Normal file
20
rmfen.l/rmfen.l
Normal file
@@ -0,0 +1,20 @@
|
||||
%{
|
||||
#include <stdio.h>
|
||||
%}
|
||||
|
||||
%option outfile="rmfen.c"
|
||||
%option always-interactive
|
||||
%option nounput noinput
|
||||
|
||||
space [1-7]
|
||||
piece (c|s|t|C|S|T)([1-9][0-9]{0,2})"."
|
||||
pyramid (p|P){piece}+"."
|
||||
boardpiece ({pyramid}|{piece})
|
||||
row (({space}|{boardpiece}){0,7}{boardpiece})?
|
||||
board ({row}"/"){15}{row}
|
||||
|
||||
%%
|
||||
|
||||
{board} { printf("Valid board: %s\n", yytext); }
|
||||
|
||||
. { printf("Unknown text %s\n", yytext); }
|
||||
Reference in New Issue
Block a user