From: plugge AT biv7 DOT sr DOT fh-mannheim DOT de (Michel) Newsgroups: comp.os.msdos.djgpp Subject: Re: Writing a simple compiler Date: 7 Jul 1998 06:34:23 GMT Organization: Fachhochschule Mannheim - Hochschule fuer Technik und Gestaltung, Germany Distribution: world Message-ID: <6nsfhf$g2j@noxi.rz.fh-mannheim.de> References: <359eebbc DOT 5439034 AT news DOT uow DOT edu DOT au> <35a720ea DOT 2211979 AT news DOT Austria DOT EU DOT net> Reply-To: plugge AT axp3 DOT sr DOT fh-mannheim DOT de NNTP-Posting-Host: axp5.sr.fh-mannheim.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Lines: 38 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <35a720ea DOT 2211979 AT news DOT Austria DOT EU DOT net>, sparhawk AT eunet DOT at (Gerhard Gruber) writes: |>Destination: blp01 AT uow DOT edu DOT au (Brett Porter) |>From: Gruber Gerhard |>Group: comp.os.msdos.djgpp |>Date: Sun, 05 Jul 1998 03:03:04 GMT: |> |>Is you parser able to handle the continuation of sourclines via the "\" |>character? I tried to figure that one out but I have problems defining a |>syntax for lex. |> |>In C it is legal to write a line like this: |>#i\ |>n\ |>c\ |>lude\ |>.h> |> |>Dou you have any idea (or anybody else) how to solve this? |>I checked out the sources for gcc but they wrote their own lexer so I can't |>see anything there. |> This is not done by the compiler, but rather by the preprocessor; the compiler would get the complete line #include , (if this wasn't a preprocessor line). So it is no problem: for the preprocessor just write a pattern "\\\n" with no action code, and this will eat up the line breaks. Note that the preprocessor worksrecursively: if has to check the generated code if there are still more preprocessor statements, and then handle these too. In this case, the file stdio.h would be read in _by the preprocessor_. Best regards Michel