Other Languages
I opened this chapter talking about COBOL, so I guess I'd better briefly describe how you get to it from within Visual B++. The first step is to find a COBOL compiler that can create DLL code-Micro Focus' COBOL Workbench version 4 will do nicely (version 3.4 is the latest 16-bit version). The rest of the steps are pretty obvious. (See Q103226 in the Microsoft Knowledge Base for more information.) You're going to call into the DLL to get at your heritage code. Why rewrite when you can re-position?
Maybe you have a bunch of scientific routines to write and your language of choice for these is FORTRAN (DIGITAL Visual Fortran 5.0 is a good choice here-MLP is especially easy with Visual Fortran 5.0 as it's based on Microsoft's Developer Studio).
Building your own little language
I'm getting off the topic a bit so I'll be brief here. Specialized, so_called "little languages" (actually some aren't so little) can be easily created using tools such as lex and yacc. (These tools can be used to build type 2 (context-free) languages as classified by the Chomsky language hierarchy). These tools came from the UNIX world originally but are now widely available for other operating systems, including Windows and DOS. The tool lex builds lexical analyzers and yacc (which stands for Yet Another Compiler Compiler) builds parsers. For example, lex can build a program that can break down code like x = a * b * c() / 3 into identifiable chunks, and yacc can build a program that can check that the chunks make syntactic sense, in the order identified by lex (which is as they're written above). As well as syntax checking your code, yacc normally generates output code to perform whatever it is that your grammar has just described, in this case math.
Note that yacc can generate any kind of code-it can output C, C++, Assembler, COBOL, or Visual B++. So by using lex and yacc you can create grammars and language compilers to perform specialized tasks. If you want to learn more about these tools see the Mortice Kern Systems Inc. Web site at www.mks.com
.