[erlang-questions] Re: sending extra information to leex or yecc? (or how to know the name of the file I'm parsing in them)

Robert Virding <>
Sun Jun 6 16:54:42 CEST 2010


Do you mean the name of the source files used to generate a leex
scanner or a yecc parser? Or do you mean the name of a file scanned by
a leex scanner or parsed by a yecc parser?

For a description of how a scanner/parser is integrated into the i/o
system check out the i/o part of the Erlang Rationale found at:

http://forum.trapexit.org/viewtopic.php?t=15022

In short neither know who calls them. When generating a scanner/parser
there is no direct way to get the source file names, indirectly the
source name is used to generate the module and file name of the
resultant scanner/parser.

What is that you want to do?

Robert

On 5 June 2010 20:52, Mariano Guerra <> wrote:
> On Sat, Jun 5, 2010 at 2:45 PM, Mariano Guerra
> <> wrote:
>> the subject is rather long but that's what I need.
>>
>> I need to get the name of the file I'm parsing in leex or yecc it
>> doesn't matter in which.
>>
>> If there isn't a way to get that, then is there a way to pass extra
>> information to leex or yecc when I start running them with a file?
>
> I reply myself, correct me if I'm wrong.
>
> erlang starts a server[1] that holds the information and the functions
> that want to know the values for the predefined macros send a message
> to that process right?
>
> [1] http://github.com/erlang/otp/blob/dev/lib/stdlib/src/epp.erl#L232
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>


More information about the erlang-questions mailing list