Hm, the article explicitly mentions contexts in which PEGs don't backtrack but instead do greedy matching. In Perl, greedy matching is available if you need it but is not the norm.
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List [[email protected]] on behalf of David Crayford [[email protected]] Sent: Monday, March 21, 2022 10:12 PM To: [email protected] Subject: Re: looking for 'how to' developing Rexx host command On Mon, 2022-03-21 at 13:33 +0000, Seymour J Metz wrote: > I just read the wiki artlice [[Parsing expression grammar]] and don't see > either the sophistication or the ease of use compared to regexen. I've come > to rely on named captures and backtracking, both > of which seem to be missing. Absolutely not. Depending on the library it's trivial to support named captures within named captures http://secure-web.cisco.com/1pDw906RvgdZxwW-QAEwZVgBdvkJGRrcGKbuoM_TdwgoBeW3Z55X8fS2im3k0c5R5U6qsEXk9asWW1HUfxN9dtI2zv_Ngos--f2Am86zaajaxDZrOInyLvR8tCMHaFDZRHk7tTsH10uKMqWRO1P0fQZncGO5DnJwzxkh6fcdOUxUycX64-3s_Z5MLmWkQ4YJ8QI2PAD0RNl86JJbdYHKlIaU8tOLuY2qjk3ZevVEI0l9bP3dNEmon3N8iIHS7k3Tq5-X4cUf_1yWZQAPjmgm4dsqQDCvdanw6s44hzVLRQjv4dwuSf_gmqak_hqEzkFjo31RK8HTfprGsToGW102HQhDXeGfWDlnXK1791cGZyCf3KvwdJtQsOKemboglVwH8RsXUyHbiv7i9cDdx89-bwYUFUirBHHKOVMand591UMM2weqvabSC5WH-C3-7GQq4/http%3A%2F%2Flua-users.org%2Flists%2Flua-l%2F2010-02%2Fmsg00493.html. Backtracking is equally trivial. PEGs support recursive decent grammars. The problem with regular expressions is that they don't scale. For example, using PEGs it's simple to functionally decompose a tricky grammar such as validating a IP address, which may be either a hostname, IPv4 or IPv6 [1]. Using a regex just to validate IPv6 is an intractable mess [2]. PEGs are super powerful which is why they are used to write the parsers for programming language, including perl 6 (does anybody use perl 6?). [1] https://secure-web.cisco.com/1Xbxffegrzqy1wsHqwA5cU-KOU9n7zP24xIi7xg7LsSSjHKvo17YCZzDlJ_lefeFbH7zoYceR29G1JFEgWJct-WIhShL5LEr7j4y5OfaUVIZAjQZWt_QApgb6k8mBMWbXKrpWH-OVcwb5-HVfd8c89DY0xUtTuvS0PWA1gu--8neKwUbyB8AZgO3EwED3mBQ1eb1zlSlrSz5EZy32kmgFwP_tr3e7OJW5WLFPVTBdsHBUs8tChQszuRBCFpazD3QtkM69ORRakWdsHQtGGlk463rujfN5BkLTn4Do5RQvkJ4Vevfq3MBG28XgSyQu2q6zIUEjsg3bS1GOafKyiBDdKcKMopKrTE-mxsm9HKGsmY3liyg88yoruz0woY-wKDXYmmSYGqCNzilTSrMCgb5HxZ0Xx5OiEpjVAEXXTCdHFbYNXUvjsU3BfVb-iB3OIJRB/https%3A%2F%2Fgithub.com%2Fmozilla-services%2Flua_sandbox_extensions%2Fblob%2Fmain%2Flpeg%2Fmodules%2Flpeg%2Fip_address.lua [2] https://secure-web.cisco.com/1Y9ylsi7oDYzVEtak_RKC4Bpe3nJInxwZQvniOUCH9eaKfXdJZzvlIG1gCWvCTYjsPEgXg3hpQM8naAUGVQhdD1dUJKjNSy0_XxZ1pi0VyQ3ba0q49XHGe-41TtV_933pPvGSWwuBQPat7BwUL8eZE7O8FnlizFEuU130qedgRoUpsxMMHIB2nqYDHiSfe1whkO4Y3kAYe9RLkh7EtAgyAOhkPobJuV_BhX09AB07E719jujDVzWAu5qkS75Rm3k2xpO2GA5wHS2Xt7IF9jSbFkTb16sFQWtgjhLX4cytRXnThc_hc9u4jopavvl1490VeWbUZ-amKRRrogEzmSGBThtCmAC2_oVeBo_Eq3Dgw8x7_uUvP5kGAVdR2KTLyHBwEYEBaGRvFvGuzqU4Jn1d-zrdy8L0zGokDAsu4csGjhXGtHizAF0K6owa1qk5mYdaMDfnKvoVYPIIBlLzyIoREg/https%3A%2F%2Fihateregex.io%2Fexpr%2Fipv6%2F [3] https://secure-web.cisco.com/1OB5wS1NRw1jlHo8N5C-Q3DstEBbVYWL0ZPFUN6zkkt8Av80k0Tt9ItAVDoNPr_w3nzA3odk3hShvfKIQQUi3N7fMHceP8N_L6i-LghsboQm0U2L-A-53MjmoonmryvVMBnPsEyH2MbIsNa10DtWtjNO7HlGEOC4gWheFSjLiG8aD6rs5sVaT-URzDftolhVUoO7Iy_pIox6ftolAAfXivovbA2L_y9ykfh6h5738mBlrAAfBLdude69vgTf4LuI4VFqBxg-wR8rimBVm2AfjkEEd8uAQcC-bnK65nsd_nVnoEucFLtuu9tOUGYkrO7Wfwd351z2ApuC_jSY3UBlS2vnL22MKinJpIHd3f4L7j3o3u8KlbW3Etmtg8cFBEL3lIZViOGC_NOs2wM5D217jUdstRA4ZczphiERKqR1MGlZ0uLnHRtd-mnj6-qK15AHoked64v1ZBNZhRIpA_29HRQ/https%3A%2F%2Fmetacpan.org%2Fdist%2FPegex%2Fview%2Flib%2FPegex.pod > > > -- > Shmuel (Seymour J.) Metz > https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmason.gmu.edu%2F~smetz3&data=04%7C01%7Csmetz3%40gmu.edu%7Cfc81a12f723b402dbd1208da0ba967e0%7C9e857255df574c47a0c00546460380cb%7C0%7C0%7C637835119461225370%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Utab4%2B9ILG7GO4LChv1ZSpVEzY3OmGCeE%2Fl9VsNJEbc%3D&reserved=0 > > ________________________________________ > From: IBM Mainframe Discussion List [[email protected]] on behalf of > David Crayford [[email protected]] > Sent: Monday, March 21, 2022 9:08 AM > To: [email protected] > Subject: Re: looking for 'how to' developing Rexx host command > > On Mon, 2022-03-21 at 12:42 +0000, Seymour J Metz wrote: > > Sorry, I should have been less terse. I meant that PCRE provides a more > > sophisticated RE engine. > > PCRE is slightly more sophisticated but it's puny when compared to PEG > engines. Not only are PEG libraries more sophisticated they are orders of > magnitude easier to learn and use. > > > > Off topic, but why does the documented URI pattern not recognize fragments > > prefixed by "#"? > > > > > > -- > > Shmuel (Seymour J.) Metz > > https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmason.gmu.edu%2F~smetz3&data=04%7C01%7Csmetz3%40gmu.edu%7Cfc81a12f723b402dbd1208da0ba967e0%7C9e857255df574c47a0c00546460380cb%7C0%7C0%7C637835119461225370%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Utab4%2B9ILG7GO4LChv1ZSpVEzY3OmGCeE%2Fl9VsNJEbc%3D&reserved=0 > > > > ________________________________________ > > From: IBM Mainframe Discussion List [[email protected]] on behalf of > > David Crayford [[email protected]] > > Sent: Monday, March 21, 2022 8:28 AM > > To: [email protected] > > Subject: Re: looking for 'how to' developing Rexx host command > > > > On Mon, 2022-03-21 at 12:01 +0000, Seymour J Metz wrote: > > > PCRE? > > > > No. It uses the C++ RTL ECMAScript Grammar which is 99% compatible with > > PCRE. AFAIK, the only thing it doesn't support is recursive subgroup > > matching which I could care less about. I lost interest > > in > > REXX long ago and regular expressions when I discovered PEGs > > http://secure-web.cisco.com/1GzTyMMSxCF_dwz2M6Q46PXDtjQQPO9p6ZnEEaWyOCoB_OCkMHE0mJFg8_ivpVjXcHrXax7OQ0H_1OuTTj4qhcLRfQs7zDJNyLyG4NVFThKZbFfuIyALvQBo0O9xtivp3mfCFxg0XUteBTVqbC7DJJRGiYh8W-yiJjJP3EUpGBcbUS1xJiEstgA_yk97ZlzNUyFasjrTZYqnLYM9-8MQDL-SHo6VnBTY-3DTeVHncLZwmV-qKLCQjvAPRPR8i6ckJ16bUTA7bgxKOsFthBcfdtGpX8OHo8dH-psux7cnLT2547giX2VYLIv-rGiH2qSNOc3AGtygDbBvd8AcrLzf7GiGSTUiPtjI83vwkcCmHPo96dcT4YRSxRO5xEHTJxvKRBg-NAEEbzj1XMm0_hG6iNmaTQm7KhcyvsiKnJk7RoAeWzXdI3ccjohTu7R0o64c-/http%3A%2F%2Flua-users.org%2Fwiki%2FLpegRecipes > > . > > > > > > > -- > > > Shmuel (Seymour J.) Metz > > > https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmason.gmu.edu%2F~smetz3&data=04%7C01%7Csmetz3%40gmu.edu%7Cfc81a12f723b402dbd1208da0ba967e0%7C9e857255df574c47a0c00546460380cb%7C0%7C0%7C637835119461225370%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Utab4%2B9ILG7GO4LChv1ZSpVEzY3OmGCeE%2Fl9VsNJEbc%3D&reserved=0 > > > > > > ________________________________________ > > > From: IBM Mainframe Discussion List [[email protected]] on behalf > > > of David Crayford [[email protected]] > > > Sent: Sunday, March 20, 2022 11:35 PM > > > To: [email protected] > > > Subject: Re: looking for 'how to' developing Rexx host command > > > > > > On Sun, 2022-03-20 at 10:08 -0500, Paul Gilmartin wrote: > > > > On Sun, 20 Mar 2022 07:56:39 -0700, Charles Mills wrote: > > > > > > > > > TSO/E Rexx Reference Chapter 14. Language Processor Environments? > > > > > > > > > Wouldn't a SAMPLIB member be nice? In a HLL? > > > > > > Writing a REXX command processor in a HLL is non-trivial to do correctly. > > > I've done it a few times and it requires creating a persistent LE > > > environment and hanging the pointer on the user area > > > inthe > > > environment block. Like most things on z/OS, REXX programming services > > > were designed for HLASM. Unfortunately, for the kind of APIs I'm > > > interested in HLASM is practically useless. For example, > > > regular > > > expressions > > > https://secure-web.cisco.com/1zcwmhQDfP3w43bgtLLTfqgfquwmvKtHyKxkeXoo2pwlKZnmHKubm9IgbehcXUMaSRUvaEdPtbH79-0CZ30CeuslyETSCoPogZKiHdS9lnPt0OXlOV2A1sZGJH1j2ZlRptWqebMlsvE26C_jDXTFaXgQwwpSR4PfcyY2a3fHtEEFPy8N1_EUhKhgNJ4qKrOEzp6jQE_jSCNpvkXsh0td0Atyfzpzn85YvAjgTe-uL_bIgjp-HQoFpsdnKO_USxUiVxvRukM8wHuQLKtjVhDMgqvI3acfBOPJV1xYg3rATQBgwkriE0Ey8C3BtYm8aXHNI2qhJdDLtiR3QZHo90qFKkTga0SshiTOaC9Cn20kfOeXkBwCF8mmt0enaJQnalSmeZbQOZClq3sRCF9rgGZTkAaC-NMWPVp8tZ9C3LobJmxH2MvzLHyNlELnLUQl2PsN_/https%3A%2F%2Fgithub.com%2Fdaveyc%2FRTK > > > . > > > > > > It's far easier to just use a more contemporary programming language > > > which has a modern API for writing packages. Although, then you need to > > > know C/C++ for Python, Lua, Ruby, Node etc. > > > > > > > > > > > > > > -----Original Message----- > > > > > From: ITschak Mugzach > > > > > Sent: Sunday, March 20, 2022 7:36 AM > > > > > > > > > > I scanned the tso rexx manuals and haven't found any instructions on > > > > > how to > > > > > develop the host load module. I mean, the one who supplies the > > > > > address xxx > > > > > services. Any idea where to find a sample or instruction manual? > > > > > > ---------------------------------------------------------------------- > > > For IBM-MAIN subscribe / signoff / archive access instructions, > > > send email to [email protected] with the message: INFO IBM-MAIN > > > > > > ---------------------------------------------------------------------- > > > For IBM-MAIN subscribe / signoff / archive access instructions, > > > send email to [email protected] with the message: INFO IBM-MAIN > > > > ---------------------------------------------------------------------- > > For IBM-MAIN subscribe / signoff / archive access instructions, > > send email to [email protected] with the message: INFO IBM-MAIN > > > > ---------------------------------------------------------------------- > > For IBM-MAIN subscribe / signoff / archive access instructions, > > send email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
