Click here to Skip to main content
14,548,916 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: I'm finally ready for an article. I'm exhausted Pin
honey the codewitch31-Dec-19 12:24
mvahoney the codewitch31-Dec-19 12:24 
GeneralRe: I'm finally ready for an article. I'm exhausted Pin
Greg Utas31-Dec-19 13:38
professionalGreg Utas31-Dec-19 13:38 
GeneralRe: I'm finally ready for an article. I'm exhausted Pin
honey the codewitch31-Dec-19 17:21
mvahoney the codewitch31-Dec-19 17:21 
GeneralRe: I'm finally ready for an article. I'm exhausted Pin
Greg Utas1-Jan-20 0:39
professionalGreg Utas1-Jan-20 0:39 
GeneralRe: I'm finally ready for an article. I'm exhausted Pin
honey the codewitch1-Jan-20 5:54
mvahoney the codewitch1-Jan-20 5:54 
GeneralRe: I'm finally ready for an article. I'm exhausted Pin
Greg Utas1-Jan-20 6:26
professionalGreg Utas1-Jan-20 6:26 
QuestionRe: I'm finally ready for an article. I'm exhausted Pin
honey the codewitch1-Jan-20 13:45
mvahoney the codewitch1-Jan-20 13:45 
AnswerRe: I'm finally ready for an article. I'm exhausted Pin
Greg Utas1-Jan-20 15:25
professionalGreg Utas1-Jan-20 15:25 
This is after a rather large dinner with wine, so I hope it helps. Smile | :)

I don't understand the difference between the parse tree and the AST. I only have one tree, but maybe that's because I'm only doing C++ whereas you're converting one language to another.

Once I have a subtree for something that is "executable" (e.g. an enum, typedef, data declaration or definition, function declaration or definition), I invoke a virtual EnterBlock function on its root, which is like invoking an interpreter. Each node invokes EnterBlock on its descendants, so it proceeds depth first. A QualName (a possibly qualified name) or DataSpec (a QualName tagged with pointers, references, and/or const) implements this by resolving its name based on the current scope. I hope this is what you mean by "getting the type information". It also causes stuff to be pushed onto the operand (types) and operator stacks.

Could this wait until all of the code is parsed? I don't see why not, and I don't see how it would be more or less efficient. In fact, name resolution can occur later if there are errors during the parsing or interpretation. If you run the >check tool on the code, one of the things it does (to clean up #include lists) is to ask each file for all of the things that it uses. Any nodes that have names but that weren't "interpreted" because an error caused them to be skipped will then try to resolve their names.
GeneralRe: I'm finally ready for an article. I'm exhausted Pin
honey the codewitch1-Jan-20 15:27
mvahoney the codewitch1-Jan-20 15:27 
Generalat least it's sunny there Pin
honey the codewitch31-Dec-19 5:39
mvahoney the codewitch31-Dec-19 5:39 
GeneralRe: at least it's sunny there Pin
Ron Anders31-Dec-19 5:52
MemberRon Anders31-Dec-19 5:52 
GeneralRe: at least it's sunny there Pin
Cp-Coder31-Dec-19 6:24
MemberCp-Coder31-Dec-19 6:24 
GeneralRe: at least it's sunny there Pin
Ron Anders31-Dec-19 6:29
MemberRon Anders31-Dec-19 6:29 
GeneralRe: at least it's sunny there Pin
Cp-Coder31-Dec-19 6:35
MemberCp-Coder31-Dec-19 6:35 
GeneralRe: at least it's sunny there Pin
stoneyowl231-Dec-19 9:45
Memberstoneyowl231-Dec-19 9:45 
GeneralRe: at least it's sunny there Pin
Marc Clifton31-Dec-19 5:52
mvaMarc Clifton31-Dec-19 5:52 
GeneralAnd another one is gone. But this time, you probably have no idea who he is: Syd Mead RIP. Pin
OriginalGriff31-Dec-19 4:29
mveOriginalGriff31-Dec-19 4:29 
GeneralRe: And another one is gone. But this time, you probably have no idea who he is: Syd Mead RIP. Pin
RickZeeland31-Dec-19 4:34
mveRickZeeland31-Dec-19 4:34 
GeneralWho writes the subtitles Pin
bleahy4831-Dec-19 4:20
Memberbleahy4831-Dec-19 4:20 
GeneralRe: Who writes the subtitles Pin
OriginalGriff31-Dec-19 4:30
mveOriginalGriff31-Dec-19 4:30 
GeneralRe: Who writes the subtitles Pin
Slacker00731-Dec-19 5:27
professionalSlacker00731-Dec-19 5:27 
GeneralRe: Who writes the subtitles Pin
Kent Sharkey31-Dec-19 5:30
staffKent Sharkey31-Dec-19 5:30 
GeneralRe: Who writes the subtitles Pin
OriginalGriff31-Dec-19 5:36
mveOriginalGriff31-Dec-19 5:36 
GeneralRe: Who writes the subtitles Pin
Slacker00731-Dec-19 5:48
professionalSlacker00731-Dec-19 5:48 
GeneralRe: Who writes the subtitles Pin
Nelek31-Dec-19 4:41
protectorNelek31-Dec-19 4:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.