Hi folks, We are trying to migrate a complete appliacation from one platform (VME) to a completely different platform, running a completely different OS (Linux), while at the same time trying to make it look as similar as possible, if not identical, to the end users. All this is done using tools written in house to do as much of the conversion as possible automatically. Getting something to convert VME Cobol to Micro Focus cobol is not exactly difficult, (INITIALISE to INITIALIZE for example) and converting the IDMSX database to Oracle, while 'interesting' is again relatively straightforwards if somewhat tedious. However we also have to convert something of the order of 2400 SCL programs. SCL is VME's job control language and, for those that might know IBM's JCL, has a similar function. SCL, however, is a fully fledged compiled language in it's own right, yet can still be used from the command line. It is an integer only subset of a language caled S3, which is itself a superset of Algol-68. What we need is help in parsing, and in particular help in parsing conditions. The guy who is writing this part of the converter is using perl 5 on windows and is asking for help with something called a descent parser??? His email to me is attached inline below. The sample is entirely made up as for confidentiality reasons we cannot access the clients code from outside their own servers. Although this example only contains IF conditions they could also be UNLESS or WHENEVER, and also UNTIL on loops. Is anyone able to help us with guidance on the parsing, or could offer us a better alternative? Many thanks, Dave From: Robert Hood Sent: 14 December 2016 12:40 To: Dave Stratford Subject: Perl Issue Hello can anybody help with a best perl solution I believe we would have to use Parse::RecDescent for this (or maybe another if it is simpler) We need to change data in the format marked (1) below to the format marked (2) ===== Start Of Input Sample ===== IF ( SAMENDED EQ "HELLO" AND SDATE EQ "TODAY" ) OR ( SAMENDED EQ "GOODBYE" AND SDATE EQ "TODAY" ) THEN SENDMESSAGE ( "HELLO" ) ELSF ( SAMENDED EQ "AFTERNOON" AND SDATE EQ "TOMORROW" ) OR ( SAMENDED EQ "GOODBYE" AND SDATE EQ "TOMORROW" ) THEN SENDMESSAGE ( "AFTERNOON" ) ELSE SENDMESSAGE ( "GOODNIGHT" ) FI ===== End of input sample ===== ===== Start Of Output Sample ===== @COBOL*01 EVALUATE TRUE @COBOL*01 WHEN ( O2L::EQ(SAMENDED, z"HELLO") = 1 AND O2L::EQ(SDATE, z"TODAY") = 1 ) @COBOL*01 OR ( O2L::EQ(SAMENDED, z"GOODBYE") = 1 AND O2L::EQ(SDATE, z"TODAY") = 1 ) @COBOL*01 CALL "SENDMESSAGE" USING "HELLO" @COBOL*01 WHEN ( O2L::EQ(SAMENDED, z"AFTERNOON") = 1 AND O2L::EQ(SDATE, z"TOMORROW") = 1 ) @COBOL*01 OR ( O2L::EQ(SAMENDED, z"GOODBYE") = 1 AND O2L::EQ(SDATE, z"TOMORROW") = 1 ) @COBOL*01 CALL "SENDMESSAGE" USING "AFTERNOON" @COBOL*01 WHEN OTHER @COBOL*01 CALL "SENDMESSAGE" USING "GOODNIGHT" @COBOL*01 END-EVALUATE. ===== End Of Output Sample ===== The biggest problem with Parse::RecDescent is a good example that covers this creating the grammars Robert Hood Migration Consultant Professional Services > Transoft > Advanced -- Dave Stratford - ZFCB http://daves.orpheusweb.co.uk/
![]() |
0 |
![]() |
In comp.lang.perl.misc, Dave Stratford <daves@orpheusmail.co.uk> wrote: > However we also have to convert something of the order of 2400 SCL > programs. SCL is VME's job control language and, for those that might know > IBM's JCL, has a similar function. SCL, however, is a fully fledged > compiled language in it's own right, yet can still be used from the > command line. It is an integer only subset of a language caled S3, which > is itself a superset of Algol-68. Coming from a background where you did this stuff in yacc and lex, I was tempted to use the Parser::Input::Yacc module when I wanted to create a shell language in Perl. I quickly found that to be buggy. Parse::RecDescent worked great, though. > What we need is help in parsing, and in particular help in parsing > conditions. The guy who is writing this part of the converter is using > perl 5 on windows and is asking for help with something called a descent > parser??? Parse::RecDescent has a copyright dating to 1997, and has been used in a huge number of projects. Without difficulty I found tutorials dating back to 2001 on the web. I think your developer needs to learn how to use web search engines on his own. > Is anyone able to help us with guidance on the parsing, or could offer us > a better alternative? Parse::RecDescent is very likely the best Perl tool for the job. But you need to understand parsing regular grammars. Elijah ------ wikipedia has a page on recursive descent parsers
![]() |
0 |
![]() |
In article <eli$1612141943@qz.little-neck.ny.us>, Eli the Bearded <*@eli.users.panix.com> wrote: > In comp.lang.perl.misc, Dave Stratford <daves@orpheusmail.co.uk> wrote: > > However we also have to convert something of the order of 2400 SCL > > programs. SCL is VME's job control language and, for those that might know > > IBM's JCL, has a similar function. SCL, however, is a fully fledged > > compiled language in it's own right, yet can still be used from the > > command line. It is an integer only subset of a language caled S3, which > > is itself a superset of Algol-68. > Coming from a background where you did this stuff in yacc and lex, > I was tempted to use the Parser::Input::Yacc module when I wanted to > create a shell language in Perl. I quickly found that to be buggy. > Parse::RecDescent worked great, though. > > What we need is help in parsing, and in particular help in parsing > > conditions. The guy who is writing this part of the converter is using > > perl 5 on windows and is asking for help with something called a descent > > parser??? > Parse::RecDescent has a copyright dating to 1997, and has been used in a > huge number of projects. Without difficulty I found tutorials dating > back to 2001 on the web. I think your developer needs to learn how to > use web search engines on his own. > > Is anyone able to help us with guidance on the parsing, or could offer us > > a better alternative? > Parse::RecDescent is very likely the best Perl tool for the job. But you > need to understand parsing regular grammars. I think this is where he's specifically looking for help. Dave > Elijah > ------ > wikipedia has a page on recursive descent parsers -- Dave Stratford - ZFCB http://daves.orpheusweb.co.uk/
![]() |
0 |
![]() |
Eli the Bearded <*@eli.users.panix.com> writes: <snip> > Parse::RecDescent is very likely the best Perl tool for the job. But you > need to understand parsing regular grammars. I think that's a typo or some other misunderstanding. Regular grammars are those that define regular languages -- the same languages matched by (un-extended) regular expressions. So in some rather fussy sense the statement is correct because RecDescent uses REs to match tokens. The grammars that can parsed by RecDescent will be some subset of the context free grammars, possibly those that go by the name of LL(k) grammars. The documentation may say exactly what grammars can be parsed. <snip> -- Ben.
![]() |
0 |
![]() |