D front end implementation

Rainer Schuetze via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 18 02:18:21 PST 2016



On 16.11.2016 10:11, Timon Gehr wrote:
> On 15.11.2016 14:11, Rainer Schuetze wrote:
>>
>>
>>
>> Coincidentally, I've tried compiling your front end with latest dmd just
>> yesterday. There is one file missing, though: cent_.d. Could you please
>> commit this, too?
>> ...
>
> Oops. Thanks for pointing this out, I have committed it. (It's just a
> stub anyway: It's a wrapper around a long.)

Thanks.

>
>> The cent code commented out, I noticed your code is suffering from the
>> same issue as the OP (also happens for AAs, e.g. T[int]). A workaround
>> is to use void[] and wrap it in property functions.
>>
>> I've fixed/worked around a number of issues in dmd with respect to
>> incomplete semantic analysis that happen with template mixins, but more
>> still pop up afterwards.
>> ...
>
> DMD 2.060 is the only version of DMD that builds the code.

I've read that, but I don't want to go back that much in time...

>
>> Are there limitations to what the front end understands?
>
> Yup. There are many features missing that are quite easy to implement
> but require work, and a few that are somewhat messy to specify (e.g.
> 'protected'). An incomplete list:
>
> * UDA's
> * Built-in members (init, stringof, min, max, ...)
> * various forms of import statements
>   - static, selective, renaming, ...
> * Initialization of union fields
> * anonymous structs & unions
>   - Analysis & Lowering
> * additional import paths & implicit object.d
> * implicit inheritance from Object
> * version declarations
> * Associative arrays/Associative array literals
> * module declarations
> * (implicit) super constructor calls
>   - default constructor call insertion
>   - flow analysis
> * Destructor and postblit calls
>   - use flow analysis to optimize moves
> * with statements
> * associative arrays
> * foreach statements
>   - automatic decoding for string types
>   - foreach over associative arrays
>   - foreach over delegates
>   - foreach over AliasSeq
> * pattern matching in old-style template constraints
> * explicit casts from/to class references
>   - eg. to/from void* and to bool
> * try-catch-finally statements
> * scope guards
> * initialization crossing check
> * multi-argument struct constructors.
> * struct postblit & destructors
> * finish operator overloading support
> * opDispatch
> * member alias declarations aliasing members
>   - correctly provide a this pointer
> * visibility
>   - package, protected
> * alias this

Quite a list, but the issues that are likely to affect symbol lookup 
might not be too complicated to implement. I'm looking for candidates 
that might replace the semantic engine in Visual D, as D_Parser is 
unlikely to be developed further at the moment.

>> Is it able to digest itself?
>
> Not yet. (Mostly because of missing language features.)
>
>> That would be pretty impressive ;-)
>
> I want to get there eventually. :)
> Unfortunately I haven't had a lot of time to spend on this lately. Also,
> DMD 2.060 has quite many annoying bugs that slow down development.
>

I hope to get the forward reference bugs solved in current dmd. That 
might also help your motivation to continue the front end ;-)


More information about the Digitalmars-d mailing list