<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Compiler overview (III)</title>
	<link>http://blog.ngedit.com/2005/06/12/compiler-overview-iii/</link>
	<description>A blog on the development of the NGEDIT text editor</description>
	<pubDate>Fri, 30 Jul 2010 00:03:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: J</title>
		<link>http://blog.ngedit.com/2005/06/12/compiler-overview-iii/#comment-153495</link>
		<dc:creator>J</dc:creator>
		<pubDate>Sat, 12 Jul 2008 14:23:10 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/06/12/compiler-overview-iii/#comment-153495</guid>
		<description>shankar, I'm glad you found this interesting. I've often thought about recasting these articles into proper compiler-writing articles, but meanwhile here there are to help out whoever needs them!

Writing a compiler is not as difficult as it's often thought to be, and I believe any serious programming should write at least one to become comfortable with all the concepts.

I haven't written more than I did in the few articles in the blog. I will be working in the language in the near future again, as I plan to base ViEmu-scripting on it, so I might post a bit more, but unfurtunately I hardly have any time left from my main development work.

Best wishes with your project!

  - Jon</description>
		<content:encoded><![CDATA[<p>shankar, I&#8217;m glad you found this interesting. I&#8217;ve often thought about recasting these articles into proper compiler-writing articles, but meanwhile here there are to help out whoever needs them!</p>
<p>Writing a compiler is not as difficult as it&#8217;s often thought to be, and I believe any serious programming should write at least one to become comfortable with all the concepts.</p>
<p>I haven&#8217;t written more than I did in the few articles in the blog. I will be working in the language in the near future again, as I plan to base ViEmu-scripting on it, so I might post a bit more, but unfurtunately I hardly have any time left from my main development work.</p>
<p>Best wishes with your project!</p>
<p>  - Jon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shankar</title>
		<link>http://blog.ngedit.com/2005/06/12/compiler-overview-iii/#comment-143178</link>
		<dc:creator>shankar</dc:creator>
		<pubDate>Sat, 24 May 2008 15:37:57 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/06/12/compiler-overview-iii/#comment-143178</guid>
		<description>Hi,

I found this very useful.  In fact I read this page many years ago, now that i am writing my own compiler for my software, i used google to find you again and refresh the knowledge.  Have you done any further work on this? Would appreciate if you put up see also: links. 

Thank you.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I found this very useful.  In fact I read this page many years ago, now that i am writing my own compiler for my software, i used google to find you again and refresh the knowledge.  Have you done any further work on this? Would appreciate if you put up see also: links. </p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://blog.ngedit.com/2005/06/12/compiler-overview-iii/#comment-24</link>
		<dc:creator>J</dc:creator>
		<pubDate>Tue, 14 Jun 2005 18:32:14 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/06/12/compiler-overview-iii/#comment-24</guid>
		<description>You understood it well. The question is actually a good question. Your idea is actually doable (and done). The pointer-based language tradition (such as C and C++) would need such an approach, if only to shuffle around pointer type variable values. But, many other languages don't offer pointers, and in such case it is simpler to just implement the LOAD/STORE model to bring stuff on to the stack and send it back to assignment destinations, and you can do without allowing pointers on the stack.

Take into account that it's not only about object members, variables are read and written via specific instructions.

CLR, Microsoft's .NET runtime, actually supports pointer values on the stack. It makes the VM quite a lot more complex. I'll be guessing that they needed to provide it only in order to implement managed C++, which is plain old C++ compiled to a stack-based VM (with some extensions thrown in for the new model, but by and large compatible with standard C++).</description>
		<content:encoded><![CDATA[<p>You understood it well. The question is actually a good question. Your idea is actually doable (and done). The pointer-based language tradition (such as C and C++) would need such an approach, if only to shuffle around pointer type variable values. But, many other languages don&#8217;t offer pointers, and in such case it is simpler to just implement the LOAD/STORE model to bring stuff on to the stack and send it back to assignment destinations, and you can do without allowing pointers on the stack.</p>
<p>Take into account that it&#8217;s not only about object members, variables are read and written via specific instructions.</p>
<p>CLR, Microsoft&#8217;s .NET runtime, actually supports pointer values on the stack. It makes the VM quite a lot more complex. I&#8217;ll be guessing that they needed to provide it only in order to implement managed C++, which is plain old C++ compiled to a stack-based VM (with some extensions thrown in for the new model, but by and large compatible with standard C++).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomás Fernández</title>
		<link>http://blog.ngedit.com/2005/06/12/compiler-overview-iii/#comment-22</link>
		<dc:creator>Tomás Fernández</dc:creator>
		<pubDate>Tue, 14 Jun 2005 18:11:40 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/06/12/compiler-overview-iii/#comment-22</guid>
		<description>Hi, I would say that i have found very interisting your explanation (actually I saved the page to ensure I have it for further study) Although I am having a little problems to understand the TChainReference class (But finally sure i will success :-). Anyway, reading it i found a doubt:

If I have undertood well, an assigment like this This.Obj1.Obj2.Obj3 = 0 would generate code like this:

PUSH_CONST '0'
PUSH_VAR 'This'
READ_MEMBER 'Obj1'
READ_MEMBER 'Obj2'
WRITE_MEMBER 'Obj3'

Each "READ_MEMBER" insturction will read the memeber belonging to the previous object in the TOS and put it in the TOS.

So to achieve the "address" of the inner member it is neccessary to "calculate" all the reference chain each time it is needed to be accesed.

Could it be posissible to pre-calculate the iner member reference?, so that the code generated could be not neccessary the READ and WRITE instructions. Could be it possible use only in this way the generic PUSH and POP instructions set. In other words if a pre-calculation of the reference of the inner member woul be possible then could be possible to use the PUSH_REFERENCE 'Calculated-var-reference" and the same with the POP.

Than you very much for your useful explanations.

Best regards.
Tomás.</description>
		<content:encoded><![CDATA[<p>Hi, I would say that i have found very interisting your explanation (actually I saved the page to ensure I have it for further study) Although I am having a little problems to understand the TChainReference class (But finally sure i will success :-). Anyway, reading it i found a doubt:</p>
<p>If I have undertood well, an assigment like this This.Obj1.Obj2.Obj3 = 0 would generate code like this:</p>
<p>PUSH_CONST &#8216;0&#8242;<br />
PUSH_VAR &#8216;This&#8217;<br />
READ_MEMBER &#8216;Obj1&#8242;<br />
READ_MEMBER &#8216;Obj2&#8242;<br />
WRITE_MEMBER &#8216;Obj3&#8242;</p>
<p>Each &#8220;READ_MEMBER&#8221; insturction will read the memeber belonging to the previous object in the TOS and put it in the TOS.</p>
<p>So to achieve the &#8220;address&#8221; of the inner member it is neccessary to &#8220;calculate&#8221; all the reference chain each time it is needed to be accesed.</p>
<p>Could it be posissible to pre-calculate the iner member reference?, so that the code generated could be not neccessary the READ and WRITE instructions. Could be it possible use only in this way the generic PUSH and POP instructions set. In other words if a pre-calculation of the reference of the inner member woul be possible then could be possible to use the PUSH_REFERENCE &#8216;Calculated-var-reference&#8221; and the same with the POP.</p>
<p>Than you very much for your useful explanations.</p>
<p>Best regards.<br />
Tomás.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
