# HG changeset patch # User Aziz K?ksal # Date 1196978378 -3600 # Node ID d13502b6fa5f2751cdaba4a531fe250cae1c57ed # Parent 9c208925a3d4bd98c89ae5f8026fbaa4814b0d87 Added code to the Parser and edited main.wiki. diff -r 9c208925a3d4 -r d13502b6fa5f trunk/src/dil/Parser.d --- a/trunk/src/dil/Parser.d Thu Dec 06 22:19:55 2007 +0100 +++ b/trunk/src/dil/Parser.d Thu Dec 06 22:59:38 2007 +0100 @@ -3651,9 +3651,14 @@ T.Delegate, T.Super, T.Return: + case_Const_Invariant: specTok = token; nT(); break; + case T.Const, T.Invariant: + if (peekNext() != T.LParen) + goto case_Const_Invariant; + // Fall through. It's a type. default: specType = parseType(); } diff -r 9c208925a3d4 -r d13502b6fa5f wiki/main.wiki --- a/wiki/main.wiki Thu Dec 06 22:19:55 2007 +0100 +++ b/wiki/main.wiki Thu Dec 06 22:59:38 2007 +0100 @@ -1,21 +1,26 @@ +Note: the Subversion repository is out of date. The code was migrated to [http://hg.sharesource.org/dil/ Mercurial]. =Purpose= -dil is a hand-crafted compiler implementation for the D programming language written in D 1.0. The lexer and the parser are fully implemented, but no semantic analysis is done at the moment. The backend will most probably be gcc or [http://llvm.org LLVM]. +dil is a hand-crafted compiler implementation for the D programming language written in D 1.0. The lexer and the parser are fully implemented. Semantic analysis is being worked on. The backend will most probably be gcc or [http://llvm.org LLVM]. What dil can do at the moment: * dil is fully internationalized and can output compiler messages in English, German, Turkish and Finnish. You can determine which language to use with a setting in config.d. * Generate XML or HTML documents. You can choose to generate tags for tokens only or you can also have the whole parse tree unparsed. The whitespace of the original source file is preserved. You can view the HTML documents in any browser you like. The XML documents can only be viewed in W3C-standards compatible browsers(`*`) in combination with an XML formatting CSS document. dil provides two ordinary CSS documents (for XML/HTML) which can be customized to one's heart's content. (`*`Note: Internet Explorer is the only browser that spectacularly fails at this job.) - * Generate module dependency graphs in the dot format. Demo [http://dil.googlecode.com/files/main.dot dot file]: rendered in [http://dil.googlecode.com/files/main.svg SVG], [http://dil.googlecode.com/files/main.png PNG] (1.3MB) or [http://dil.googlecode.com/files/main.gif GIF]. Cyclic edges and nodes are highlighted in red. + * Generate module dependency graphs in the dot format. Demo [http://dil.googlecode.com/files/main.dot dot file]: rendered in [http://dil.googlecode.com/files/main.svg SVG], [http://dil.googlecode.com/files/main.png PNG] (1.3MB) or [http://dil.googlecode.com/files/main.gif GIF]. Cyclic edges and nodes are highlighted in red. (Note: the images are old. [http://dsource.org/projects/tango Tango] is used instead of Phobos now.) * Generate simple code statistics (lines of code, number of whitespace characters etc.) When dil has advanced enough [http://www.aivosto.com/project/help/pm-oo-ck.html OO-metrics] will be supported. * dil can parse D 2.0 additions: * Delimited and token [http://www.digitalmars.com/d/lex.html#StringLiteral string literals]. * [http://www.digitalmars.com/d/statement.html#ForeachRangeStatement ForeachRangeStatement]. * Optional [http://www.digitalmars.com/d/expression.html#IsExpression TemplateParameterList in IsExpression]. + * const and invariant in !IsExpressions. + * [http://www.digitalmars.com/d/template.html#TemplateThisParameter TemplateThisParameter]. * Cast expressions: cast(const) and cast(invariant). * Type constructors: const(Type) and invariant(Type). + * const and invariant attributes after the parameter list of a function (C++ style.) + * typeof(return). * Traits expressions: `__`traits(Identifier) and `__`traits(Identifier, !TemplateArguments). * const/invariant/final/scope/static as storage classes in parameter lists (e.g. void func(final scope Foo f);). - * invariant as storage class for declarations (e.g. invariant Foo f;). + * invariant as a storage class for declarations (e.g. invariant Foo f;). * The identifier `__EOF__` is interpreted as the end of file. Features you will or might see in dil: