Re: [VB4Linux-Dev] Lets talk a bit about vb2c.
Status: Planning
Brought to you by:
luke-jr
From: Scott B. <js...@go...> - 2000-11-20 13:27:43
|
On Sun, 19 Nov 2000, Luke-Jr wrote: > Scott Beasley wrote: > > > Lets go over some issues and options we have in writing vb2c. > > > > 1 - The main translator does not have to be in C. (I vote C tho :-) > > We could write the translator in something like Tcl or Python. This > > would be for VB->C code generation only. The support libraries would > > still be in C, and would be brought in during link time. Doing this > > would simplify much of the parsing of the vb files, and would be > > relatively fast. > > Tcl seems to be X11-only... The VB2C shouldn't require X11 as it isn't a > GUI app... Tcl is not Tk in this case (Tcl is the scripting language and Tk is the windowing Tool Kit) Tcl, Tk and Python are quite portable though, as portable as perl even. > > > > > > > 2 - vb2c will have to be a multi-pass compiler or use very complicated > > Look ahead logic. (I vote multi-pass) > > We will need at least 3 passes to generate the code or a foo-bar FSM > > (Finite state machine). You could/can generate most of the form info > > (Window info) on the first pass, as most of that is close to a one to > > one relation (i.e. Windows created -> Windows create code in C) But > > branching, looping and such needs more info before you can generate > > the target code. If & Select blocks also can change the flow of code, > > so they need extra attention (more on these later also). > > I know this may sound stupid, but why must it be multi-pass? Maybe if it's not > Option Explicit then there might be a reason to need that, but even still for > non-OE programs there could be one "default" type which could be a wildcard... Not stupid :-) This is just part of writing a compiler or language translator. For a translator you could do it single pass, but you could generate better code (and less) with a multi-pass system and also do some optimization on the last pass. > > > > > > > 3 - A Type marshalling engine will be needed. > > To keep things simple, we should have functions written to help out > > with type converting (obvious) and things like If and Selects. C has a > > much more limited type comparison set. Such as switch/case. In C this > > is integer based (which is fine) but in VB select is not. We will > > have to a set of functions or an engine to handle this. > > Well, I'd say making the "Select Case abc" become "select(MakeSelectInt(abc))" > and have MakeSelectInt do an interger "encode" on the value and have maybe the > first byte be representing the original type or something like that... > > > > > > > 4 - Others? > > > > just a few things to think about. > > > > scott > > > > _______________________________________________ > > VB4Linux-Dev mailing list > > VB4...@li... > > http://lists.sourceforge.net/mailman/listinfo/vb4linux-dev > |