|
From: | EML |
Subject: | Parsing user-defined types |
Date: | Wed, 8 May 2019 18:48:31 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
foo() { struct a {...}; // type defn struct a b; // declare object 'b' of user-defined type 'a' }this is easy to parse, but if you add a typedef, or go to C++, you can have code that looks like this:
foo() { struct a {...}; a b; }With a simple flex/bison setup this is likely to lead to a lot of conflicts. So how do you handle this? Do you just work through the conflicts, if possible, or is this a job for a hand-coded lexer, which can be told about new types at runtime?
[Prev in Thread] | Current Thread | [Next in Thread] |