8

मैं संभव उपकरणों मुझे पता चला कि LLVM से बजना उपकरण एएसटी डंप कर सकते हैं में देखने के बाद ऑब्जेक्टिव-सी स्थिर कोड, मुख्य रूप से एएसटी, विश्लेषण करने की जरूरत है, इसलिए मैं इस आदेश का उपयोग कर यह परीक्षण करने के लिए टर्मिनल का उपयोग किया:उद्देश्य-सी कोड से एएसटी निकालने के लिए कैसे?

clang -cc1 -ast-dump ~/SomeTest.m 

In file included from /Users/myusername/SomeTest.m:9: 
/Users/myusername/SomeTest.h:9:9: fatal error: 'UIKit/UIKit.h' file not found 
#import <UIKit/UIKit.h> 
     ^
typedef __int128_t __int128_t; 
typedef __uint128_t __uint128_t; 
typedef SEL *SEL; 
typedef id id; 
typedef Class *Class; 
struct __va_list_tag { 
    unsigned int gp_offset; 
    unsigned int fp_offset; 
    void *overflow_arg_area; 
    void *reg_save_area; 
}; 
typedef struct __va_list_tag __va_list_tag; 
typedef __va_list_tag __builtin_va_list[1]; 
@interface [email protected] 
@implementation just4testViewController 
- (void) dealloc (CompoundStmt 0x7f86b183b110 </Users/myusername/SomeTest.m:14:1, line:16:1>) 


- (void) didReceiveMemoryWarning (CompoundStmt 0x7f86b183b2a0 </Users/myusername/SomeTest.m:19:1, line:24:1>) 


- (void) viewDidUnload (CompoundStmt 0x7f86b183b430 </Users/myusername/SomeTest.m:37:1, line:41:1>) 


- (id) shouldAutorotateToInterfaceOrientation:(id)interfaceOrientation (CompoundStmt 0x7f86b183b648 </Users/myusername/SomeTest.m:44:1, line:47:1>) 


@end 
1 error generated. 

किसी भी विचार मैं ऐसा क्यों हो रही है:

लेकिन मैं इस त्रुटि हो रही है? जब तक यह विश्वसनीय नहीं है और आउटपुट

+0

हाय, क्या आप उद्देश्य-सी स्रोत कोड से एएसटी निकालने के लिए एक पार्सर ढूंढने में कामयाब रहे? धन्यवाद! – ramo

उत्तर

2

के लिए प्रलेखन प्रदान करने के लिए किसी भी उपकरण का उपयोग करने से कोई फर्क नहीं पड़ता है, तो कंपाइलर को UIKit ढांचे नहीं मिलते हैं।

clang -framework UIKit -cc1 -ast-dump ~/SomeTest.m 
+0

अभी भी यह क्लैंग प्राप्त हो रहा है: चेतावनी: संकलन के दौरान अप्रयुक्त तर्क: '-cc1' क्लैंग: चेतावनी: संकलन के दौरान अप्रयुक्त तर्क: '-ast-dump' फ़ाइल में /Users/myusername/SomeTest.m:9 से शामिल फ़ाइल में: /Users/myusername/SomeTest.h:9:9: घातक त्रुटि: 'UIKit/UIKit.h' फ़ाइल नहीं मिली # आयात ^ 1 त्रुटि उत्पन्न हुई। –

0

-Xclang -ast-dump बजाय -cc1 -ast-dump प्रयास करें: आप इसे उपयोग करने के लिए यह बताने के लिए है। (मानक अस्वीकरण: कुछ भी -Xclang या -cc1 का उपयोग कर संकलक करने के लिए एक अस्थिर इंटरफ़ेस का उपयोग कर रहा है।)

+0

अभी भी प्रश्न में पोस्ट की गई वही त्रुटियां प्राप्त कर रहा है :( –

+0

एक कमांड लें जो फ़ाइल को प्रश्न में संकलित करने के लिए काम करता है, फिर उस आदेश में -Xclang -ast-dump जोड़ें। अन्यथा, आप अजीब परिणामों के साथ समाप्त होने जा रहे हैं ; ओबीजेसी फ़ाइल के लिए एएसटी कमांड लाइन विकल्पों पर निर्भर करता है। – servn

+0

मुझे आपकी बात नहीं मिली। क्या आप इसे मेरे लिए दोबारा दोहरा सकते हैं? –

0

ओपी कहते मैं ऑब्जेक्टिव-सी कोड से एएसटी को निकालने के लिए किसी भी उपकरण का उपयोग कर कोई आपत्ति नहीं है ...

हमारा DMS Software Reengingineering Toolkit उद्देश्य-सी के लिए ऐसा कर सकता है।

डीएमएस उत्पन्न पार्सर "domainparser" करने के लिए इस कमांड लाइन के लिए:

run \DMS\Domains\C\ObjectiveCv2\Tools\Parser\domainparser ++AST "C:\temp\test.m" 

इस उद्देश्य सी फ़ाइल "test.m":

@implementation GTLClientLoginAuthorizationArgs 

@synthesize request = request_, 
    delegate = delegate_, 
    selector = sel_, 
    completionHandler = completionHandler_, 
    thread = thread_, 
    error = error_; 

+ (GTLClientLoginAuthorizationArgs *)argsWithRequest:(NSMutableURLRequest *)req 
        delegate:(id)delegate 
        selector:(SEL)sel 
       completionHandler:(id)completionHandler 
         thread:(NSThread *)thread { 
    GTLClientLoginAuthorizationArgs *obj; 
    obj = [[[GTLClientLoginAuthorizationArgs alloc] init] autorelease]; 
    obj.request = req; 
    obj.delegate = delegate; 
    obj.selector = sel; 
    obj.completionHandler = completionHandler; 
    obj.thread = thread; 
    return obj; 
} 

- (void)dealloc { 
    self.request = nil; 
    self.delegate = nil; 
    self.selector = NULL; 
    self.completionHandler = nil; 
    self.thread = nil; 
    self.error = nil; 
    [super dealloc]; 
} 
@end 

एक एएसटी के साथ इस उत्पादन का उत्पादन:

Domain Parser for C~ObjectiveCv2 2.4.4 
Copyright (C) Semantic Designs 1996-2012; All Rights Reserved 
([email protected]~ObjectiveCv2=2#422f080^0 Line 1 Column 1 File C:/temp/test.m 
([email protected]~ObjectiveCv2=1048#422f140 Line 1 Column 1 File C:/temp/test.m 
    ([email protected]~ObjectiveCv2=1270#4228b40[`GTLClientLoginAuthorizationArgs'] Line 1 Column 17 File C:/temp/test.m)IDENTIFIER 
    ([email protected]~ObjectiveCv2=1046#4228b80 Line 3 Column 1 File C:/temp/test.m)super_class_option 
    ([email protected]~ObjectiveCv2=1061#4228bc0 Line 3 Column 1 File C:/temp/test.m)instance_variables 
    ([email protected]~ObjectiveCv2=1079#422f0a0 Line 3 Column 1 File C:/temp/test.m 
    ([email protected]~ObjectiveCv2=1079#422e8c0 Line 3 Column 1 File C:/temp/test.m 
    |([email protected]~ObjectiveCv2=1079#42290a0 Line 3 Column 1 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=1078#4228c00 Line 3 Column 1 File C:/temp/test.m)implementation_definition_list 
    | ([email protected]~ObjectiveCv2=1131#4229080 Line 3 Column 1 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=1134#4229060 Line 3 Column 13 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=1134#4228fc0 Line 3 Column 13 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=1134#4228f40 Line 3 Column 13 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1134#4228e80 Line 3 Column 13 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1134#4228de0 Line 3 Column 13 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1133#4228d00 Line 3 Column 13 File C:/temp/test.m 
    | | |([email protected]~ObjectiveCv2=1136#4228cc0 Line 3 Column 13 File C:/temp/test.m 
    | | | ([email protected]~ObjectiveCv2=1270#4228c40[`request'] Line 3 Column 13 File C:/temp/test.m)IDENTIFIER 
    | | | ([email protected]~ObjectiveCv2=1270#4228c80[`request_'] Line 3 Column 23 File C:/temp/test.m)IDENTIFIER 
    | | |)property_synthesize_item 
    | | )property_synthesize_list 
    | | ([email protected]~ObjectiveCv2=1136#4228dc0 Line 4 Column 13 File C:/temp/test.m 
    | | |([email protected]~ObjectiveCv2=1270#4228d80[`delegate'] Line 4 Column 13 File C:/temp/test.m)IDENTIFIER 
    | | |([email protected]~ObjectiveCv2=1270#4228da0[`delegate_'] Line 4 Column 24 File C:/temp/test.m)IDENTIFIER 
    | | )property_synthesize_item 
    | | )property_synthesize_list 
    | | ([email protected]~ObjectiveCv2=1136#4228e60 Line 5 Column 13 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#4228e20[`selector'] Line 5 Column 13 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1270#4228e40[`sel_'] Line 5 Column 24 File C:/temp/test.m)IDENTIFIER 
    | | )property_synthesize_item 
    | |)property_synthesize_list 
    | | ([email protected]~ObjectiveCv2=1136#4228f20 Line 6 Column 13 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#4228ea0[`completionHandler'] Line 6 Column 13 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1270#4228f00[`completionHandler_'] Line 6 Column 33 File C:/temp/test.m)IDENTIFIER 
    | |)property_synthesize_item 
    | |)property_synthesize_list 
    | |([email protected]~ObjectiveCv2=1136#4228fa0 Line 7 Column 13 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#4228f60[`thread'] Line 7 Column 13 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1270#4228f80[`thread_'] Line 7 Column 22 File C:/temp/test.m)IDENTIFIER 
    | |)property_synthesize_item 
    | )property_synthesize_list 
    | ([email protected]~ObjectiveCv2=1136#4229040 Line 8 Column 13 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=1270#4228fe0[`error'] Line 8 Column 13 File C:/temp/test.m)IDENTIFIER 
    | |([email protected]~ObjectiveCv2=1270#4229020[`error_'] Line 8 Column 21 File C:/temp/test.m)IDENTIFIER 
    | )property_synthesize_item 
    | )property_synthesize_list 
    |)property_implementation 
    |)implementation_definition_list 
    |([email protected]~ObjectiveCv2=1087#422ea00 Line 10 Column 1 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=1103#4229200 Line 10 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=647#42291c0 Line 10 Column 4 File C:/temp/test.m 
    | (AMBIGUITY<type_specifier=388>@C~ObjectiveCv2=1390#4228ca0{2} Line 10 Column 4 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=1144#4229100 Line 10 Column 4 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#42290c0^2#4228ca0:2#4229100:1[`GTLClientLoginAuthorizationArgs'] Line 10 Column 4 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1057#42290e0 Line 10 Column 36 File C:/temp/test.m)protocol_option 
    | |)type_specifier 
    | |([email protected]~ObjectiveCv2=1270#42290c0^2#4228ca0:2#4229100:1... [ALREADY PRINTED] ...) 
    | )AMBIGUITY 
    | ([email protected]~ObjectiveCv2=640#4229120 Line 10 Column 36 File C:/temp/test.m)ptr_operator 
    | )type_id 
    |)method_type 
    | ([email protected]~ObjectiveCv2=1095#4229940 Line 10 Column 38 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=1095#4229720 Line 10 Column 38 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=1095#42296a0 Line 10 Column 38 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=1095#4229580 Line 10 Column 38 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1094#42294a0 Line 10 Column 38 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1099#4229480 Line 10 Column 38 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#42291e0[`argsWithRequest'] Line 10 Column 38 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1103#4229440 Line 10 Column 54 File C:/temp/test.m 
    | | |([email protected]~ObjectiveCv2=647#42293c0 Line 10 Column 55 File C:/temp/test.m 
    | | | (AMBIGUITY<type_specifier=388>@C~ObjectiveCv2=1390#4229300{2} Line 10 Column 55 File C:/temp/test.m 
    | | | ([email protected]~ObjectiveCv2=1144#42292a0 Line 10 Column 55 File C:/temp/test.m 
    | | | ([email protected]~ObjectiveCv2=1270#4229220^2#4229300:2#42292a0:1[`NSMutableURLRequest'] Line 10 Column 55 File C:/temp/test.m)IDENTIFIER 
    | | | ([email protected]~ObjectiveCv2=1057#4229260 Line 10 Column 75 File C:/temp/test.m)protocol_option 
    | | | )type_specifier 
    | | | ([email protected]~ObjectiveCv2=1270#4229220^2#4229300:2#42292a0:1... [ALREADY PRINTED] ...) 
    | | |)AMBIGUITY 
    | | | ([email protected]~ObjectiveCv2=640#42293a0 Line 10 Column 75 File C:/temp/test.m)ptr_operator 
    | | |)type_id 
    | | )method_type 
    | | ([email protected]~ObjectiveCv2=1270#42293e0[`req'] Line 10 Column 77 File C:/temp/test.m)IDENTIFIER 
    | | )keyword_declarator 
    | |)keyword_selector 
    | | ([email protected]~ObjectiveCv2=1099#4229600 Line 11 Column 45 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#4229460[`delegate'] Line 11 Column 45 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1103#4228d40 Line 11 Column 54 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1143#42294e0 Line 11 Column 55 File C:/temp/test.m 
    | | |([email protected]~ObjectiveCv2=1057#4229500 Line 11 Column 57 File C:/temp/test.m)protocol_option 
    | | )type_specifier 
    | | )method_type 
    | | ([email protected]~ObjectiveCv2=1270#4228d20[`delegate'] Line 11 Column 58 File C:/temp/test.m)IDENTIFIER 
    | |)keyword_declarator 
    | |)keyword_selector 
    | |([email protected]~ObjectiveCv2=1099#4229680 Line 12 Column 45 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#42295a0[`selector'] Line 12 Column 45 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1103#4229280 Line 12 Column 54 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1141#42295c0 Line 12 Column 55 File C:/temp/test.m)simple_type_specifier 
    | |)method_type 
    | | ([email protected]~ObjectiveCv2=1270#4229560[`sel'] Line 12 Column 59 File C:/temp/test.m)IDENTIFIER 
    | |)keyword_declarator 
    | )keyword_selector 
    | ([email protected]~ObjectiveCv2=1099#4229700 Line 13 Column 36 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=1270#4229520[`completionHandler'] Line 13 Column 36 File C:/temp/test.m)IDENTIFIER 
    | |([email protected]~ObjectiveCv2=1103#42294c0 Line 13 Column 54 File C:/temp/test.m 
    | | (t[email protected]~ObjectiveCv2=1143#42296c0 Line 13 Column 55 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1057#42296e0 Line 13 Column 57 File C:/temp/test.m)protocol_option 
    | |)type_specifier 
    | |)method_type 
    | |([email protected]~ObjectiveCv2=1270#4228c60[`completionHandler'] Line 13 Column 58 File C:/temp/test.m)IDENTIFIER 
    | )keyword_declarator 
    | )keyword_selector 
    | ([email protected]~ObjectiveCv2=1099#4229920 Line 14 Column 47 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=1270#4229760[`thread'] Line 14 Column 47 File C:/temp/test.m)IDENTIFIER 
    | ([email protected]~ObjectiveCv2=1103#4229900 Line 14 Column 54 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=647#4229860 Line 14 Column 55 File C:/temp/test.m 
    | | (AMBIGUITY<type_specifier=388>@C~ObjectiveCv2=1390#4229320{2} Line 14 Column 55 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1144#42297e0 Line 14 Column 55 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#42297c0^2#4229320:2#42297e0:1[`NSThread'] Line 14 Column 55 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1057#4229740 Line 14 Column 64 File C:/temp/test.m)protocol_option 
    | | )type_specifier 
    | | ([email protected]~ObjectiveCv2=1270#42297c0^2#4229320:2#42297e0:1... [ALREADY PRINTED] ...) 
    | |)AMBIGUITY 
    | | ([email protected]~ObjectiveCv2=640#4229840 Line 14 Column 64 File C:/temp/test.m)ptr_operator 
    | |)type_id 
    | )method_type 
    | ([email protected]~ObjectiveCv2=1270#42298c0[`thread'] Line 14 Column 66 File C:/temp/test.m)IDENTIFIER 
    | )keyword_declarator 
    |)keyword_selector 
    | ([email protected]~ObjectiveCv2=1085#4229980 Line 14 Column 73 File C:/temp/test.m)declaration_star 
    | ([email protected]~ObjectiveCv2=403#422e920 Line 14 Column 73 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=405#422e3e0 {8} Line 15 Column 3 File C:/temp/test.m 
    | (AMBIGUITY<statement=332>@C~ObjectiveCv2=1390#4229780{2} Line 15 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=400#422e200 Line 15 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=209#4229e60 Line 15 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#42299e0^3#42297a0:1#4229a80:1#4229e60:1[`GTLClientLoginAuthorizationArgs'] Line 15 Column 3 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1270#4229ca0^2#4229d60:2#4229e60:2[`obj'] Line 15 Column 36 File C:/temp/test.m)IDENTIFIER 
    | |)multiplicative_expression 
    | |)expression_statement 
    | |([email protected]~ObjectiveCv2=515#422e1e0 Line 15 Column 3 File C:/temp/test.m 
    | | (AMBIGUITY<type_specifier=388>@C~ObjectiveCv2=1390#42297a0{2} Line 15 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#42299e0^3#42297a0:1#4229a80:1#4229e60:1... [ALREADY PRINTED] ...) 
    | | ([email protected]~ObjectiveCv2=1144#4229a80 Line 15 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#42299e0^3#42297a0:1#4229a80:1#4229e60:1... [ALREADY PRINTED] ...) 
    | | ([email protected]~ObjectiveCv2=1057#4229a20 Line 15 Column 35 File C:/temp/test.m)protocol_option 
    | | )type_specifier 
    | |)AMBIGUITY 
    | | ([email protected]~ObjectiveCv2=624#4229d60 Line 15 Column 35 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=640#4229cc0 Line 15 Column 35 File C:/temp/test.m)ptr_operator 
    | | ([email protected]~ObjectiveCv2=1270#4229ca0^2#4229d60:2#4229e60:2... [ALREADY PRINTED] ...) 
    | |)declarator 
    | |)simple_declaration 
    | )AMBIGUITY 
    | ([email protected]~ObjectiveCv2=400#422e3c0 Line 16 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=356#422e360 Line 16 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#422e1c0[`obj'] Line 16 Column 3 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1158#422e340 Line 16 Column 9 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1158#422e320 Line 16 Column 10 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1158#422e2e0 Line 16 Column 11 File C:/temp/test.m 
    | | |([email protected]~ObjectiveCv2=1270#422e220[`GTLClientLoginAuthorizationArgs'] Line 16 Column 12 File C:/temp/test.m)IDENTIFIER 
    | | |([email protected]~ObjectiveCv2=1270#422e2a0[`alloc'] Line 16 Column 44 File C:/temp/test.m)IDENTIFIER 
    | | )primary_expression 
    | | ([email protected]~ObjectiveCv2=1270#422e2c0[`init'] Line 16 Column 51 File C:/temp/test.m)IDENTIFIER 
    | | )primary_expression 
    | | ([email protected]~ObjectiveCv2=1270#422e300[`autorelease'] Line 16 Column 57 File C:/temp/test.m)IDENTIFIER 
    | |)primary_expression 
    | |)assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422e540 Line 17 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=356#422e500 Line 17 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=130#422e480 Line 17 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#422e380[`obj'] Line 17 Column 3 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1270#422e440[`request'] Line 17 Column 7 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | | ([email protected]~ObjectiveCv2=1270#422e4a0[`req'] Line 17 Column 17 File C:/temp/test.m)IDENTIFIER 
    | |)assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422e680 Line 18 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=356#422e640 Line 18 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=130#422e600 Line 18 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#422e520[`obj'] Line 18 Column 3 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1270#422e5c0[`delegate'] Line 18 Column 7 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | | ([email protected]~ObjectiveCv2=1270#422e620[`delegate'] Line 18 Column 18 File C:/temp/test.m)IDENTIFIER 
    | |)assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422e780 Line 19 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=356#422e720 Line 19 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=130#422e740 Line 19 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#422e660[`obj'] Line 19 Column 3 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1270#422e560[`selector'] Line 19 Column 7 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | | ([email protected]~ObjectiveCv2=1270#422e760[`sel'] Line 19 Column 18 File C:/temp/test.m)IDENTIFIER 
    | |)assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422e6e0 Line 20 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=356#422e800 Line 20 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=130#422e840 Line 20 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#422e580[`obj'] Line 20 Column 3 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1270#422e6a0[`completionHandler'] Line 20 Column 7 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | | ([email protected]~ObjectiveCv2=1270#422e860[`completionHandler'] Line 20 Column 27 File C:/temp/test.m)IDENTIFIER 
    | |)assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422e900 Line 21 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=356#422e960 Line 21 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=130#422e8a0 Line 21 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1270#422e820[`obj'] Line 21 Column 3 File C:/temp/test.m)IDENTIFIER 
    | | ([email protected]~ObjectiveCv2=1270#422e7a0[`thread'] Line 21 Column 7 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | | ([email protected]~ObjectiveCv2=1270#422e940[`thread'] Line 21 Column 16 File C:/temp/test.m)IDENTIFIER 
    | |)assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=487#422e9c0 Line 22 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=1270#422e880[`obj'] Line 22 Column 10 File C:/temp/test.m)IDENTIFIER 
    | )jump_statement 
    | )statement_seq 
    |)compound_statement 
    |)class_method_definition 
    )implementation_definition_list 
    ([email protected]~ObjectiveCv2=1088#422f280 Line 25 Column 1 File C:/temp/test.m 
    |(AMBIGUITY<method_result_option=527>@C~ObjectiveCv2=1390#4229f40{2} Line 25 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=1101#422ea60 Line 25 Column 3 File C:/temp/test.m)method_result_option 
    | ([email protected]~ObjectiveCv2=1103#422e7c0 Line 25 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=545#422e9e0 Line 25 Column 4 File C:/temp/test.m)simple_type_specifier 
    |)method_type 
    |)AMBIGUITY 
    |([email protected]~ObjectiveCv2=1270#422e8e0[`dealloc'] Line 25 Column 9 File C:/temp/test.m)IDENTIFIER 
    |([email protected]~ObjectiveCv2=1085#422e7e0 Line 25 Column 17 File C:/temp/test.m)declaration_star 
    |([email protected]~ObjectiveCv2=403#422efa0 Line 25 Column 17 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=405#422ecc0 {7} Line 26 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=400#422eb40 Line 26 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=356#422eb20 Line 26 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=130#422eae0 Line 26 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1155#422ea80 Line 26 Column 3 File C:/temp/test.m)primary_expression 
    | | ([email protected]~ObjectiveCv2=1270#422eaa0[`request'] Line 26 Column 8 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | |([email protected]~ObjectiveCv2=1157#422eb00 Line 26 Column 18 File C:/temp/test.m)primary_expression 
    | )assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422eca0 Line 27 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=356#422ec40 Line 27 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=130#422ec00 Line 27 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1155#422eba0 Line 27 Column 3 File C:/temp/test.m)primary_expression 
    | | ([email protected]~ObjectiveCv2=1270#422ebc0[`delegate'] Line 27 Column 8 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | |([email protected]~ObjectiveCv2=1157#422ec20 Line 27 Column 19 File C:/temp/test.m)primary_expression 
    | )assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422ee20 Line 28 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=356#422ee00 Line 28 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=130#422ed60 Line 28 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1155#422ece0 Line 28 Column 3 File C:/temp/test.m)primary_expression 
    | | ([email protected]~ObjectiveCv2=1270#422ed40[`selector'] Line 28 Column 8 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | |([email protected]~ObjectiveCv2=1270#422edc0[`NULL'] Line 28 Column 19 File C:/temp/test.m)IDENTIFIER 
    | )assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422ef40 Line 29 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=356#422ef20 Line 29 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=130#422eee0 Line 29 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1155#422ee60 Line 29 Column 3 File C:/temp/test.m)primary_expression 
    | | ([email protected]~ObjectiveCv2=1270#422eec0[`completionHandler'] Line 29 Column 8 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | |([email protected]~ObjectiveCv2=1157#422ef00 Line 29 Column 28 File C:/temp/test.m)primary_expression 
    | )assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422ee80 Line 30 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=356#422efe0 Line 30 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=130#422f020 Line 30 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1155#422ee40 Line 30 Column 3 File C:/temp/test.m)primary_expression 
    | | ([email protected]~ObjectiveCv2=1270#422f000[`thread'] Line 30 Column 8 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | |([email protected]~ObjectiveCv2=1157#422efc0 Line 30 Column 17 File C:/temp/test.m)primary_expression 
    | )assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422ef80 Line 31 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=356#422f0c0 Line 31 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=130#422f100 Line 31 Column 3 File C:/temp/test.m 
    | | ([email protected]~ObjectiveCv2=1155#422ef60 Line 31 Column 3 File C:/temp/test.m)primary_expression 
    | | ([email protected]~ObjectiveCv2=1270#422f060[`error'] Line 31 Column 8 File C:/temp/test.m)IDENTIFIER 
    | |)postfix_expression 
    | |([email protected]~ObjectiveCv2=1157#422f120 Line 31 Column 16 File C:/temp/test.m)primary_expression 
    | )assignment_expression 
    | )expression_statement 
    | ([email protected]~ObjectiveCv2=400#422f1a0 Line 32 Column 3 File C:/temp/test.m 
    | ([email protected]~ObjectiveCv2=1158#422f180 Line 32 Column 3 File C:/temp/test.m 
    | |([email protected]~ObjectiveCv2=1156#422f1e0 Line 32 Column 4 File C:/temp/test.m)primary_expression 
    | |([email protected]~ObjectiveCv2=1270#422f040[`dealloc'] Line 32 Column 10 File C:/temp/test.m)IDENTIFIER 
    | )primary_expression 
    | )expression_statement 
    |)statement_seq 
    |)compound_statement 
    )instance_method_definition 
)implementation_definition_list 
)class_implementation 
)translation_unit 
Exiting with final status 0 

क्योंकि पेड़ का आकार व्याकरण के लिए आइसोमोर्फिक है जिसका उपयोग हम करते हैं, व्याकरण i एस प्रलेखन। how we do this and yet produce an AST के लिए पिछले SO उत्तर देखें।

यह एक लोकप्रिय पुस्तकालय से लिया गया एक कोड खंड है; यह सिर्फ एक टुकड़ा है क्योंकि अन्यथा पेड़ बहुत बड़ा होगा। मैंने #imports को छोड़कर, एक छोटा सा भी धोखा दिया, जो मुझे आसानी से कॉन्फ़िगर किया गया पार्सर चलाने देता है। डीएमएस # अंतर्निहित फाइलों को पार्स करेगा और निर्देश बनाए रखेगा या शामिल पाठ को बनाए रखेगा, इस पर निर्भर करता है कि इसका पार्सर कैसे कॉन्फ़िगर किया गया है।

यह ObjectiveC के लिए है, ObjectiveC++ नहीं। हम उस पर काम कर रहे हैं: -}

डीएमएस प्रोग्राम विश्लेषण के लिए बहुत अधिक समर्थन प्रदान करता है जो इसे उत्पन्न एएसटी पर संचालित करता है।

+0

धन्यवाद, डाउनवॉटर। यह उत्तर ओपी के अनुरोध के लिए एक विशिष्ट प्रतिक्रिया प्रदान करता है और दिखाता है कि वह क्या चाहता है उसे कैसे करना है। डाउनवोट करने का आपका क्या कारण है? –