[Mono-dev] misc: C# request info
BGB
cr88192 at hotmail.com
Sat Feb 21 17:42:34 EST 2009
well, I was looking into C# some, and admittedly I have much less
fammiliarity with the language than with others...
(I have started looking at ECMA-334 some, but it is long and a little
awkward to answer specific questions from absent some digging...).
so, firstly, it is my guess that in order to compile C# properly, it is
required to load a whole group of files at once (I am uncertain whether the
term 'assembly' also applies to the collection of input source files, or
only to a produced DLL or EXE).
my guess is that it works like this:
the group of files is loaded;
each file is preprocessed and parsed (it is looking like C# uses a
context-independent syntax?...);
all of the namespaces and declarations are "lifted out" of the parse trees;
each file's parse tree can then be compiled.
from what I can tell, types are like this:
type = <qualifiers>* <type-name>
so, I can type:
static Foo bar;
and the parser will know that 'Foo' is the type, even if the type for Foo is
not visible at the time of parsing (in C, this can't be done since there is
no clear distinction or ordering between types and qualifiers, and so one
would not know if 'Foo' is the type, or an intended variable name with the
type being assumed to be 'int').
so, in C we can have:
unsigned int i;
int unsigned i;
int volatile i;
_Complex float f;
double _Complex g;
unsigned i;
short int j;
int long k;
..
so, my guess then is that C# code is "just parsed", with no need to lookup,
for example, is Foo a "struct or class or other typedef'ed type?" ...
as far as the parser is concerned 'int' or 'byte' is syntactically not
different from 'Foo' or 'Bar'?...
..
any comments?...
More information about the Mono-devel-list
mailing list