C parser in Javascript

前端 未结 3 1525
别跟我提以往
别跟我提以往 2021-02-15 17:00

I\'d like to parse C header files in Javascript. Is there any such library available? Otherwise, any tips to help me get started?

Update: My ultimate go

3条回答
  •  我在风中等你
    2021-02-15 17:33

    Well I'll answer my own question since I found something interesting:

    http://www.swig.org/Doc2.0/SWIGDocumentation.html#SWIG_nn2

    Swig can output an XML representation of C header files that I could then load from Javascript.

    For example:

    swig -module yaml -xmlout yaml.xml yaml.h
    

    Generates the following file (snippet below for the yaml_token_delete function):

    ...
    
    
        
            
            
            
            
            
            
            
            
            
                
                    
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
    
    ...
    

提交回复
热议问题