[ragel-users] Splitting common definitions and actions implementation
Manoj Rajagopalan
ma... at nanorex.com
Mon Mar 31 15:08:32 UTC 2008
I'm working on something like this. To ensure that your constants in
core appear to your c/java.rl make sure you include them in the correct
order - core.rl first.
I have a .cpp file in which I include all my .rl files and then declare
and define functions which I call from my equivalent of core.rl. The
declarations occur above the %% write exec for my machines otherwise the
the 'include' statement for your .rl files could go any place (I
think, because you'll be running Ragel before the C preprocessor).
Because Ragel simply translates text from a pattern-recognition language
to C/Java, your code will compile if the resulting .c/.java files have
the declarations in the correct order.
You might need to create one or two more intermediate files to solve the
problem.
cheers!
Manoj
Martin Pirker wrote:
> Hello ragel-users...
>
> I was pondering, if I want to use the same Ragel machine with different
> language backends, how would it be possible to seperate common logic
> from language dependent action implementation.
>
> E.g., I have a core.rl file with the bulk of common logic and I want a
> c.rl and java.rl file which "include core.rl".
> In core I need to reference actions which are not defined there, in the
> language dependent files I need to reference constants/states of the
> common logic.
>
>
> Do I have to duplicate common definitions if I want to develop two
> language implementations simultaneously, or am I missing a way to
> workaround this circular dependency problem?
>
>
> Thanks,
> Martin
>
>
> PS: Did anybody read the ~500 lines of Google Terms of Service to create a
> Google account, just to be able to join this list/group to ask a question? :-/
>
>
> >
More information about the ragel-users
mailing list