BNF grammar for D?

Kingsley via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 17 01:13:48 PST 2014


On Wednesday, 17 December 2014 at 03:03:59 UTC, Rikki Cattermole 
wrote:
> On 17/12/2014 1:35 p.m., Kingsley wrote:
>> On Tuesday, 16 December 2014 at 23:25:02 UTC, Kingsley wrote:
>>> On Monday, 27 October 2014 at 22:40:20 UTC, landaire wrote:
>>>> On Monday, 27 October 2014 at 22:35:16 UTC, Jeremy Powers via
>>>> Digitalmars-d wrote:
>>>>> This looks eerily familiar...
>>>>>
>>>>> I took a stab at an Intellij plugin a long time ago, and 
>>>>> happened to
>>>>> pick
>>>>> the same name:
>>>>>
>>>>> https://github.com/elendel-/intelliD
>>>>>
>>>>> Been meaning to pick back up again, but haven't had the 
>>>>> chance... was
>>>>> waiting for the Eclipse plugin code to mature, then got 
>>>>> distracted.
>>>>> Feel
>>>>> free to take anything that looks useful.
>>>>>
>>>>>
>>>>> Brian Schott (Hackerpilot) has done a lot of useful work 
>>>>> grammar
>>>>> wise.  See:
>>>>>
>>>>> https://github.com/Hackerpilot/DGrammar
>>>>>
>>>>> An interesting path to take for an intellij plugin would be 
>>>>> to use his
>>>>> DCD/libdparse for all the heavy lifting, with the plugin 
>>>>> just
>>>>> farming out
>>>>> the work to external daemon process(es).  That would avoid 
>>>>> having yet
>>>>> another lexer/parser implementation to keep up to date.
>>>>>
>>>>
>>>> I actually forked yours originally to get it running in IDEA 
>>>> 14, then
>>>> decided to mess with the lexer since it was causing some 
>>>> problems and
>>>> went off from there. I saw it was somewhat inactive and tried
>>>> contacting you, but couldn't find any of your contact info 
>>>> anywhere!
>>>> Glad to see you turned up here.
>>>
>>> Hi guys,
>>>
>>> I have been working on an intellij plugin which is here:
>>> https://github.com/kingsleyh/DLanguage
>>>
>>> I only started learning D a couple of weeks ago and I haven't 
>>> written
>>> an intellij plugin before - and also I'm not very familiar 
>>> with
>>> parsing/lexing.
>>>
>>> On my first pass - I got all the infrastructure working - 
>>> e.g. run
>>> configurations, project creation, file creation etc. And I'm 
>>> working
>>> on a BNF and JFlex by hand - but I realise it will take some 
>>> time - so
>>> I have a branch which implements the DDT parser/lexer so I 
>>> could get
>>> something working while I work on the bnf - however it breaks 
>>> the
>>> contextual run configurations - which is pretty much 
>>> essential for the
>>> plugin to be useful.
>>>
>>> I'd like to get the DDT parser/lexer working but I'm not 
>>> really sure
>>> where to go from where I am now. My DDT branch is called 
>>> with_ddt.
>>>
>>> If anyone has any pointers to what I need to do next that 
>>> would be
>>> very helpful - even in terms of reading or reference 
>>> material. I guess
>>> it all comes down to the DParserDefinition class - as my 
>>> master branch
>>> uses a FlexAdapter which gives access to the context. But in 
>>> the
>>> with_ddt branch its just using the DParser - which I think 
>>> needs to
>>> have the hooks into the AST tree implemented or something 
>>> like that.
>>>
>>> Anyway let me know if you have any pointers or offers of help 
>>> :)
>>>
>>> --K
>>
>> Actually I guess what I need is a way to make the PSI 
>> structure. I'm not
>> sure how I would do that with the DDT code I have imported.
>
> I've sent you an email reguarding my own work on getting a 
> plugin together using Dscanner. As well as the source code.
> Feel free to use it.

I've successfully integrated the Psi generation stuff with the 
DDT parser/lexer now with a huge thanks to Rikki. So now I think 
I can add all the other ps related stuff - code insight, 
refactoring, completion etc etc

Of course its the first cut - so I'll have to do some code 
cleanup once I understand what I'm doing!

Thanks for your help and support :)


More information about the Digitalmars-d mailing list