<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: On parsing the C standard library headers</title>
	<atom:link href="http://eli.thegreenplace.net/2008/10/10/on-parsing-the-c-standard-library-headers/feed/" rel="self" type="application/rss+xml" />
	<link>http://eli.thegreenplace.net/2008/10/10/on-parsing-the-c-standard-library-headers/</link>
	<description>Eli Bendersky's personal website</description>
	<lastBuildDate>Wed, 10 Mar 2010 17:32:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Fix Runtime Library</title>
		<link>http://eli.thegreenplace.net/2008/10/10/on-parsing-the-c-standard-library-headers/comment-page-1/#comment-161243</link>
		<dc:creator>Fix Runtime Library</dc:creator>
		<pubDate>Sat, 14 Mar 2009 12:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1012#comment-161243</guid>
		<description>MS visual c++ runtime library runtime error occurs when a software application currently running on your PC encounters a problem. Programming glitches that were not rectified during the development of an application are known to be the main reason behind these errors.

Microsoft visual c++ runtime library runtime error usually happen due to incomplete installation. Incomplete installation would also mean that certain files or folders required to run the program have gone missing or are not found in the directory. It is impossible to replace the missing files manually, and as such, the only way to solve this problem is to uninstall and reinstall the program in question. However, just remember to keep a back up copy of all the files or documents just in case something unexpected happens while reinstalling the program.</description>
		<content:encoded><![CDATA[<p>MS visual c++ runtime library runtime error occurs when a software application currently running on your PC encounters a problem. Programming glitches that were not rectified during the development of an application are known to be the main reason behind these errors.</p>
<p>Microsoft visual c++ runtime library runtime error usually happen due to incomplete installation. Incomplete installation would also mean that certain files or folders required to run the program have gone missing or are not found in the directory. It is impossible to replace the missing files manually, and as such, the only way to solve this problem is to uninstall and reinstall the program in question. However, just remember to keep a back up copy of all the files or documents just in case something unexpected happens while reinstalling the program.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: _Mark_</title>
		<link>http://eli.thegreenplace.net/2008/10/10/on-parsing-the-c-standard-library-headers/comment-page-1/#comment-134161</link>
		<dc:creator>_Mark_</dc:creator>
		<pubDate>Wed, 15 Oct 2008 02:54:35 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1012#comment-134161</guid>
		<description>&quot;I see no reason to use the #line directive unless a file was included, and why would a file be included in the middle of a struct spec.&quot;

That&#039;s why I suggested the yacc output example; the #line directives in the generated C code lead to debugging information and error messages that point to lines in the higher level source, which don&#039;t line up neatly with C data structures.  include directives are just one special case of that...</description>
		<content:encoded><![CDATA[<p>&#8220;I see no reason to use the #line directive unless a file was included, and why would a file be included in the middle of a struct spec.&#8221;</p>
<p>That&#8217;s why I suggested the yacc output example; the #line directives in the generated C code lead to debugging information and error messages that point to lines in the higher level source, which don&#8217;t line up neatly with C data structures.  include directives are just one special case of that&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John D. Mitchell</title>
		<link>http://eli.thegreenplace.net/2008/10/10/on-parsing-the-c-standard-library-headers/comment-page-1/#comment-133612</link>
		<dc:creator>John D. Mitchell</dc:creator>
		<pubDate>Sat, 11 Oct 2008 16:34:09 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1012#comment-133612</guid>
		<description>The C programming language is a fair bit different than what&#039;s described in K&amp;R2.  If you&#039;re looking to make your parser support the language, you might want to get a copy of the C89 version of the language standard and if you want to be current you&#039;ll need a version of the C99 standard as well.

Also, beware that GCC plays games with a slew of extensions that are not part of the C language standards and that can play havoc with your grammars.

In terms of things like #line, I suggest looking at Antlr&#039;s (http://antlr.org/) notion of having multiple channels. I.e., things like #line go into a side-channel separate from the mainline code.</description>
		<content:encoded><![CDATA[<p>The C programming language is a fair bit different than what&#8217;s described in K&amp;R2.  If you&#8217;re looking to make your parser support the language, you might want to get a copy of the C89 version of the language standard and if you want to be current you&#8217;ll need a version of the C99 standard as well.</p>
<p>Also, beware that GCC plays games with a slew of extensions that are not part of the C language standards and that can play havoc with your grammars.</p>
<p>In terms of things like #line, I suggest looking at Antlr&#8217;s (<a href="http://antlr.org/" rel="nofollow">http://antlr.org/</a>) notion of having multiple channels. I.e., things like #line go into a side-channel separate from the mainline code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2008/10/10/on-parsing-the-c-standard-library-headers/comment-page-1/#comment-133601</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Sat, 11 Oct 2008 11:34:20 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1012#comment-133601</guid>
		<description>@Yossi,

I considered this possibility, but rejected it because handling #line at the level of the lexer is &quot;hackish&quot;. While at the parser level I can simply have the rules (PLY syntax):

&lt;pre&gt;
&quot;&quot;&quot; pp_line_spec    : INT_CONST_DEC STRING_LITERAL 
                            &#124; INT_CONST_DEC 
        &quot;&quot;&quot;

&quot;&quot;&quot; pp_line  : PPHASH PPLINE pp_line_spec PPEND
&quot;&quot;&quot;
&lt;/pre&gt;

At the lexer level I will be forced to parse forward manually after I&#039;ve detected #line. It&#039;s pretty simple to pass the line number from the parser to the lexer (by holding an offset) and get all the line numbers correctly in this manner.

But what you&#039;re saying regarding the complete freedom of #line&#039;s location is true, and perhaps I will be now forced to reconsider this design decision and do it at the lexer level.</description>
		<content:encoded><![CDATA[<p>@Yossi,</p>
<p>I considered this possibility, but rejected it because handling #line at the level of the lexer is &#8220;hackish&#8221;. While at the parser level I can simply have the rules (PLY syntax):</p>
<pre>
""" pp_line_spec    : INT_CONST_DEC STRING_LITERAL
                            | INT_CONST_DEC
        """

""" pp_line  : PPHASH PPLINE pp_line_spec PPEND
"""
</pre>
<p>At the lexer level I will be forced to parse forward manually after I&#8217;ve detected #line. It&#8217;s pretty simple to pass the line number from the parser to the lexer (by holding an offset) and get all the line numbers correctly in this manner.</p>
<p>But what you&#8217;re saying regarding the complete freedom of #line&#8217;s location is true, and perhaps I will be now forced to reconsider this design decision and do it at the lexer level.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yossi Kreinin</title>
		<link>http://eli.thegreenplace.net/2008/10/10/on-parsing-the-c-standard-library-headers/comment-page-1/#comment-133599</link>
		<dc:creator>Yossi Kreinin</dc:creator>
		<pubDate>Sat, 11 Oct 2008 10:43:15 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1012#comment-133599</guid>
		<description>When I parse the output of cpp, I usually deal with #line at the lexer level, not the parser, exactly because #line is valid everywhere, including things like:

`&lt;code&gt;int
#line 5 __abENT__quot;file__abENT__quot;
n = 9;&lt;/code&gt;`

Basically it&#039;s independent of the language grammar (for example, I run cpp on source files which aren&#039;t C); the idea to me is that you have a token stream, and each token remembers its definition location (file, line), and #line &quot;escapes&quot; the normal token stream and modifies the current file and line maintained by the lexer, but never gets past the lexer.</description>
		<content:encoded><![CDATA[<p>When I parse the output of cpp, I usually deal with #line at the lexer level, not the parser, exactly because #line is valid everywhere, including things like:</p>
<div class="backtick"><pre><code>int
#line 5 &quot;file&quot;
n = 9;</code></pre></div>
<p>Basically it&#8217;s independent of the language grammar (for example, I run cpp on source files which aren&#8217;t C); the idea to me is that you have a token stream, and each token remembers its definition location (file, line), and #line &#8220;escapes&#8221; the normal token stream and modifies the current file and line maintained by the lexer, but never gets past the lexer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2008/10/10/on-parsing-the-c-standard-library-headers/comment-page-1/#comment-133537</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Sat, 11 Oct 2008 07:08:23 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1012#comment-133537</guid>
		<description>It&#039;s not unusual, but it isn&#039;t specified as valid in K&amp;R2, I think. And I used the grammar provided there as a basis for the parser.

I see no reason to use the #line directive unless a file was included, and why would a file be included in the middle of a struct spec.</description>
		<content:encoded><![CDATA[<p>It&#8217;s not unusual, but it isn&#8217;t specified as valid in K&#038;R2, I think. And I used the grammar provided there as a basis for the parser.</p>
<p>I see no reason to use the #line directive unless a file was included, and why would a file be included in the middle of a struct spec.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: _Mark_</title>
		<link>http://eli.thegreenplace.net/2008/10/10/on-parsing-the-c-standard-library-headers/comment-page-1/#comment-133512</link>
		<dc:creator>_Mark_</dc:creator>
		<pubDate>Fri, 10 Oct 2008 21:52:33 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1012#comment-133512</guid>
		<description>Why do you think there&#039;s anything unusuabl about that #line directive? if you have any interesting macro expansions, or any C generated by other language tools (look at yacc output, for example.)

newlib is a good &quot;easy&quot; choice, since it&#039;s based on an old BSD libc so it started out fairly cross-platform and not especially gcc-centric like linux headers tend to be.  Depending on what you plan to do with this parser (programmatic augmentation of C code with additional checks? automatic conversion of headers to pyrex or ctypes declarations?) you might consider treating that as merely a starting point and trying GNU libc as your next challenge...</description>
		<content:encoded><![CDATA[<p>Why do you think there&#8217;s anything unusuabl about that #line directive? if you have any interesting macro expansions, or any C generated by other language tools (look at yacc output, for example.)</p>
<p>newlib is a good &#8220;easy&#8221; choice, since it&#8217;s based on an old BSD libc so it started out fairly cross-platform and not especially gcc-centric like linux headers tend to be.  Depending on what you plan to do with this parser (programmatic augmentation of C code with additional checks? automatic conversion of headers to pyrex or ctypes declarations?) you might consider treating that as merely a starting point and trying GNU libc as your next challenge&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
