Articles
Software
Gallery
Other works
Contacts

#Flex on the edge.html



        >NOTE: non this is technically documented behaviour
        >flex places all actions into the same function and does not error out on
          ruleless actions before the first rule
        { // The below program """works"""
            /* @BAKE
                flex -o edge.yy.c $@
                gcc edge.yy.c -o edge.out -lfl
                ./edge.out
               @STOP
            */
            %x HILL
            %%
                      { puts("Let me help you, Sisyphus!"); goto hill_top; }
            .   { hill_top: puts("There you go!"); exit(0); }
            %%
        }
        >since the first braced code block managed to slip through the parsing,
          it will be always executed
        >while the HILL should be unclimable as there are no state transitions to work
          your way up, because of the shared function scope, goto just werks™
        >this "single function state of affairs" seems to be an implementation detail,
          however since return statements must be a valid way to yield values from
          yylex() (as documented too), there is hardly any way that this could be changed