WANTED: flex2perl convertor or someone to help me decipher a lex file

WANTED: flex2perl convertor or someone to help me decipher a lex file

Post by Jauder » Fri, 17 Nov 1995 04:00:00

        Okay I have the following lex file. I was wondering if there
exists some sort of convertor from lex into perl or if some kind soul
would aid me in converting this file into a perl script. Thanks!

The lex file is as follows:


static int i_seen = 0;

WC             [A-Za-z']
NW             [^A-Za-z']

%start         INW NIW


\\[ \n]+      ECHO;

{NW}           { BEGIN NIW; i_seen = 0; ECHO; }
","$           { BEGIN NIW; i_seen = 0; printf(".\nDong Dong Dong!"); }

<NIW>"dong"/{NW} ECHO;
<NIW>"Dong"/{NW} ECHO;

"an"           { BEGIN INW; printf("un"); }
"An"           { BEGIN INW; printf("Un"); }
"au"           { BEGIN INW; printf("oo"); }
"Au"           { BEGIN INW; printf("Oo"); }
"a"/{WC}       { BEGIN INW; printf("e"); }
"A"/{WC}       { BEGIN INW; printf("E"); }
"en"/{NW}      { BEGIN INW; printf("ee"); }
<INW>"ew"      { BEGIN INW; printf("oo"); }
<INW>"e"/{NW}  { BEGIN INW; printf("e-a"); }
<NIW>"e"       { BEGIN INW; printf("i"); }
<NIW>"E"       { BEGIN INW; printf("I"); }
<INW>"f"       { BEGIN INW; printf("ff"); }
<INW>"ir"      { BEGIN INW; printf("ur"); }
<INW>"i"       { BEGIN INW; printf(i_seen ? "i" : "ee"); }
<INW>"ow"      { BEGIN INW; printf("oo"); }
<NIW>"o"       { BEGIN INW; printf("oo"); }
<NIW>"O"       { BEGIN INW; printf("Oo"); }
<INW>"o"       { BEGIN INW; printf("u"); }
"the"          { BEGIN INW; printf("zee"); }
"The"          { BEGIN INW; printf("Zee"); }
"th"/{NW}      { BEGIN INW; printf("t"); }
<INW>"tion"    { BEGIN INW; printf("shun"); }
<INW>"u"       { BEGIN INW; printf("oo"); }
<INW>"U"       { BEGIN INW; printf("Oo"); }
"v"            { BEGIN INW; printf("f"); }
"V"            { BEGIN INW; printf("F"); }
"w"            { BEGIN INW; printf("v"); }
"W"            { BEGIN INW; printf("V"); }

.              { BEGIN INW; ECHO; }


                           .sig under construction


1. YACC & LEX: Can I write a pascal-converter in it ?

Dear Audience,

Sorry for the cross-posting, but I don't really know where to put
this question.

To business. I was confronted with the next problem:
We have a few Texas Instruments 990 computers, with applications
written in DX10/DNOS Pascal. This is a very high-level Pascal
dialect, but not conforming any ISO standard (thanks to God).
The language supports lots of very nice things like random file
access, native in read/write statements (no seek garbage) and
excellent strings-handling (no string[] type, but read/write-like
encode/decode statements with an extended formatter) and so on.
At the time the applications were developped, no ISO standards
existed yet (we would never have used Pascal if they did...)

It cannot be translated to any ISO Pascal (if it could, we
wouldn't do that anyway), nor directly to C. Cobol would
functionally probably be the closest language, but has of
course totally different syntaxis (more!!) and semantics.

However, the users want to keep their applications but will
have to move to another OS+hardware platform, since those 990
systems are not build by TI anymore: TI moved entirely to
Unix. Unfortunately they forgot to supply serious migration
tools for existing software (too much focussed on hardware?).
The whole application now needs to be transported to a Unix
platform. The application will have to be migrated to Cobol
or C (preferably), unless there is a possibility to write
a Pascal parser, based on that DX10 Pascal, in yacc/lex.
Since we are dealing with about 550 large programs and trained
application programmers for it, that would be worth the trouble.

After this long introduction, my question is: is it possible
to write something like a Pascal Interpreter (or some transposer)
in yacc/lex to migrate this Pascal to, for instance, C  or Cobol,
or write a Pascal parser in yacc/lex that ultimately generates
a normal executable ???
(I never worked with yacc nor lex, but I learn fast ;-) )
So, the question is, is it worth diving into yacc/lex, or are they
not suited to do such complicated things ?

This question is only pointed to people with SERIOUS experience
in this field !!!

+==============================Ahold NV===============================+
| Room 1414, Ankersmidplein 2, 1506 CK Zaandam,  The Netherlands, EEC |


2. Setting Permissions

3. Need help deciphering message and syslog files!

4. fatal ld error - 139

5. wanted: someone to help me with mailagent

6. Trouble with cu . . . help please?

7. Decipher "core" File

8. Help for RedHat Linux6.0 boot hangs

9. DUMP/RESTORE File -> TAR File Converter?

10. deciphering log file

11. Lex maximum - Error when compiling with "lex"

12. can decipher a crypt file?

13. Wanted: document converter MS-Word <-> FrameMaker