On Tuesday, 18 July 2017 at 12:07:27 UTC, Jacob Carlborg wrote:
During the dconf hackathon I set out to create a DUB package for DMD to be used as a library. This has finally been merged [1] and is available here [2]. It contains the lexer and the parser.

A minimal example:

#!/usr/bin/env dub
/++ dub.sdl:
name "dmd_lexer_example"
dependency "dmd" version="~master"

void main()
    import ddmd.lexer;
    import ddmd.tokens;
    import std.stdio;

    immutable sourceCode = "void test() {} // foobar";
scope lexer = new Lexer("test", sourceCode.ptr, 0, sourceCode.length, 0, 0);

    while (lexer.nextToken != TOKeof)

[1] https://github.com/dlang/dmd/pull/6771
[2] http://code.dlang.org/packages/dmd

Awesome, was waiting for this.

Reply via email to