how to use dmd.lexer.Lexer
    jonatjano 
    jonatjano at gmail.com
       
    Fri Jan  6 15:25:14 UTC 2023
    
    
  
Hello,
I'm trying to write a script which parse a c header and then 
ouput basic bindings for multiple languages.
I read from the forum some times ago that the D compiler could be 
used as a library and found [the lexer page in the 
documentation](https://dlang.org/library/dmd/lexer/lexer.html)
but `import dmd.lexer: Lexer` fails with the following error :
```
modlibBinder.d(3): Error: unable to read module `lexer`
modlibBinder.d(3):        Expected 'dmd/lexer.d' or 
'dmd/lexer/package.d' in one of the following import paths:
import path[0] = .
import path[1] = /usr/include/dmd/phobos
import path[2] = /usr/include/dmd/druntime/import
Failed: ["/usr/bin/dmd", "-v", "-o-", "modlibBinder.d", "-I."]
```
What are the steps to take to be able to call the lexer (and 
maybe also the parser) over a C header file ?
    
    
More information about the Digitalmars-d-learn
mailing list