
abhivyakti vyakaran vishleshan

sanganak vidnyanat, vyakaran (pegg) haah vishleshanatmak aupcharik vyakaranacha eka prakar aahe, mhanje.eae. tyat bhashetil taar olakhanyasathi niyamanchya sanchachya sandarbhat aupcharik bhasheche varnan kele aahe. 2004 madhye bryan fordney aupcharikta sadar kelee aanee 1970 chya dashakachya suruvatila suru kelelya varchya-khalchya bhashanchya bhashanchya kutumbashi tyacha jawalcha sambandh aahe.
vakyarachanenusar, khadde dekhil sandarbh-mukt vyakaranasarkhe disatat (see. eff. jee.), parantu tyancha arth vegala aaheh nivad operator khoonmadhye pahila mell nivadato, tarr see. eff. jee. madhye too sandigdha asato. heey vyavharat string olakhanyachi pravrutti kashee kelee jaate yachya jawal aahe, udaa.jee. punaravarti utaratya parsardware.
see. eff. jee. chya ulat, khanjir sandigdha asoo shakat naheet; eka stringmadhye agadi eka vaidh pars trii asato kinwa ekahi nasato. assa andaj vartavala jaato qee asha sandarbh-mukt bhasha astitvat aahet jyaa eka khoonadvare olakhalya jaau shakat naheet, parantu heey adyap siddha jhalele nahee. pegg heey sanganakeey bhashanche (aanee lojbansarkhya krutrim manvi bhashanche) vishleshan karnyasathi yogya aahet, parantu naisargik bhasha naheet jethe pegg algoridamchi kamgiri earley algoridamsarkhya samanya see. eff. jee. algoridamshi tulana karata yete.
vyakhya.
vakyarachana.
aupcharikpane, vyakaran yaa padanche vishleshan kartana khaleel goshtincha samavesh hotoh
pii" madheel pratyek parcing niyamache swaroop "aii" "ii" aahe, jethe "aii" heey naun-terminal chinh aahe aanee "eae" heey "parcing expression" aahe. parcing expression hii niyamit expressionsarkhich eka shrenibaddha expression aahe, jee khaleel paddhatine tayar kelee jaateh
shabdarth.
sandarbh-mukt vyakaran aanee parcing abhivyakti vyakarananmadhil moolbhut farak mhanje pegcha nivad operator "aurder kelela" asato. jarr pahila paryay yashasvi jhaala tarr dusya paryayachyakade durlaksh kele jaate. asha prakare sandarbh-mukt vyakarananpramane krambaddha nivadipramane krambaddha nivad hii parivartaneey nasate. aurder keleli nivad hii kahee logic programming bhashanmadhye upalabdh asalelya soft cutt operatorshi samaan aahe.
yacha parinam assa hoto qee jarr see. eff. jee. thet eka khandkavar lipyantaran kele gele tarr sambhavya parsmadhun eka pars trii nishchitpane nivadoon pahilyatil konatihi sandigdhata door kelee jaate. vyakaran paryay jyaa kramane nirdisht kele aahet teey kaljipurvak nivadoon, konatya pars treachy nivad kelee jaate yavar programarche barech niyantran asate.
booliyan sandarbh-mukt vyakarananpramanech, vyakaran padvinyasamadhye vakyarachana nasalelya aanee aanee vakyanshachya pravanatechi dekhil bharr padate. kaaran teey input stringcha vapar naan karata tyat "pudhe pahanyasathi" eka aniyantritpane guntaguntichi up-abhivyakti vaparu shakatat, teey eka shaktishali vakyarachanatmak drushtikon pradan karatat aanee nihsanshayata suvidha detat, visheshtah jevha paryayanchi punarrachana karane ichchit achook pars trii nirdisht karoo shakat nahee.
parcing abhivyakticha karyatmak arth lavane.
parcing abhivyaktitil pratyek naun-terminal vyakaran moolatah punaravarti utaratya parsarmadhil parcing karya darshavate aanee sambandhit parcing abhivyakti karya samavisht asalelya "code" chey pratinidhitva karate. pratyek parcing function sankalpanatmakapane input stringla tyacha yuktivad mhanoon ghete aanee khalilpaiki eka parinam deteh
ekach terminal asaleli anoo parcing abhivyakti (i.eae. jarr input stringche pahile akshar tyaa terminalshee julale aanee tyaa prakaranat input varn vaparale tarr teey yashasvi hote; anyatha abhivyakti ayashasvi parinam dete. rikamya stringcha samavesh asaleli anuparsingh abhivyakti konatyahi inputcha vapar naan karata nehmich kshullakpane yashasvi hote.
naun-terminal "aaa" asaleli anoo parcing abhivyakti naun-terminal-function "aaa" sathee punaravrutti coll darshavate. konatehi input pratyakshat naan gheta naun-terminal yashasvi houu shakate aanee haah ayashasvi honyapeksha vegala parinam manla jaato.
anukram prachalak 'eae' 1 'eae' 2 pratham 'eae' 1 chaa vapar karato aanee jarr 'eae' 1 yashasvi jhaala tarr nantar 'eae' 1 neey naan vaparlelya urvarit input stringvar 'eae' 2 chaa vapar karato aanee parinam parat karato. jarr ektar "eae" 1 kinwa "eae" 2 ayashasvi jhaale, tarr anukram abhivyakti "eae" 1 "eae" 2 ayashasvi hote (konatehi input naan gheta).
nivad operator "eae" 1/"eae" 2 pratham "eae" 1 chaa vapar karato aanee jarr "eae" 1 yashasvi jhaala tarr tyacha nikal lagech parat karato. anyatha, jarr "eae" 1 ayashasvi jhaala, tarr nivad operator mool input sthanavar mage jaato jyavar tyane "eae" 1 chaa vapar keela, parantu nantar tyaeivaji "eae" 2 varr coll karoon "eae" 2 chaa nikal parat karato.
shoonya kinwa adhik, eka kinwa adhik aanee paryayi operator tyanchya up-abhivyakti 'eae' chya anukrame shoonya kinwa adhik, eka kinwa adhik, kinwa shoonya kinwa salag punaravrutti vapartat. sandarbh-mukt vyakaran aanee niyamit abhivyaktinchya ulat, tathapi, heey operator "nehmich" lobhane vagatat, shakya titke input vapartat aanee kadhihi mage hatat naheet. (niyamit abhivyakti matcher lobhane juloon suruvat karoo shakatat, parantu nantar mage hatatat aanee jarr teey julvanyat ayashasvi tharale tarr lahan samne karnyacha prayatna karatat.) udaharanarth, a * hii abhivyakti nehmi input stringmadhye salag upalabdh asalelya as chaa vapar karel aanee abhivyakti (a * a) nehmich ayashasvi hoil kaaran pahila bhag (a *) dusya bhagasathi kadhihi konatyahi as laa julavun ghenar nahee.
aanee-purvanumey abhivyakti aanee 'eae' hii up-abhivyakti 'eae' laa soochit karate aanee nantar 'eae' yashasvi jhalyas aanee 'eae' ayashasvi jhalyas ayashasvi jhalyas yashasvi hote, parantu donhi babatit 'kadhihi konatehi input vaparat nahee.
naan-andajit abhivyakti!"eae" ayashasvi jhalyas aanee "eae" yashasvi jhalyas ayashasvi jhalyas eae "yashasvi hote, punha konatyahi paristhitit konatehi input ghet nahee.
udaharane.
hii eka khoon aahe jee ganiteey sutranna olakhate jee nakaratmak nasalelya purnankanvar moolbhut paach karye lagoo karate.
ex. pii. aar.-yog
berries-utpadan (('+'/'-') utpadan)*
utpadan shakti (('*'/'/') shakti)*
powerche moolya ('^' power)?
moolya '[0-9] +/' ('expre') '
vareel udaharanamadhye, antim chinhe hii majkurachi akshare aahet, jee ekach uddharanatil akshare darshavtat, jase qee cocksey _ 1 aanee cocksey _ 2. cocksey _ 3 hii shreni cocksey _ 4 teey cocksey _ 5 paryantchya daha varnansathi eka shortcut aahe. (hii shreni vakyarachana niyamit abhivyaktidvare vaparlya jaanarya vakyarachana sarkhich aahe.) naun-terminal chinhe hii itar niyamanmadhye vistaranari chinhe aaheth "moolya", "shakti", "utpadan", "berries" aanee "ex. pii. aar.". lakshat ghya qee "berries" aanee "utpadan" heey niyam yaa karyanchya ichchit davya-sahvasakade nett naheet (teey ajibat sahsambandhanshi sambandhit naheet aanee teey vishleshanantar prakriyenantarchya tappyat hatalave lagate) aanee "shakti" niyam (ujavikade swatacha sandarbh deuun) ghatankachi ichchit ujavya-sahvasat parinam karato. (davya-sahvas sadhya karnyachya uddeshane) asha niyamamule anant punaravrutti hoil, mhanoon vyakaranat vyakt karata yete taree tyacha vapar vyavharat keela jaau shakat nahee, heey dekhil lakshat ghya.
khaleel punaravarti niyam pramanit see-shailichya jarr/nantar/anyatha vidhananshi asha prakare julato qee '/' operatorchya antarnihit pradhanyamule paryayi 'anyatha' kalam nehmich sarvat aateel 'jarr' shhee jodala jaato. (sandarbh-mukt vyakaranat, hii rachana abhijat latkanari kinwa sandigdhata nirman karate.)
s 'jarr' c 'tarr' s 'anyatha' s/'jarr' c 'tarr' s 
khaleel punaravarti niyam pascal-shailichya nested tippani vakyarachanashi julato. tippani chinhe pegg operatorpasoon vegale karnyasathi ekach uddharanat disatat.
prarambh qaraa '(*')'
shevat '*'
c * prarambh n * shevat
aine. see./(!suruvat qaraa!shevat zed)
zed. konatyahi eka varn
parcing expression 'phoo' majkurashi julate aanee vaparte parantu jarr tyanantar 'baar' majkoor asel tarach. parcing expression 'phoo' yaa majkurashi julate parantu keval jarr teey 'nahee' aanee tyanantar 'baar' asey asel tarach. abhivyakti ekach 'aaa' shhee julate parantu keval jarr tee aaa nantar aaa chya aniyantritpane lamb kramacha bhag nasel.
parcing abhivyakti aaa aanee buub chya aniyantrit-lambichya kramashi julate aanee vaparte. utpadan niyamamadhye sadhya sandarbh-mukt "julanari bhasha" sootra _ 1 chey varnan kele aahe.
khaleel parcing abhivyakti vyakaran heey abhijat sandarbh-mukt nasalelya bhasha sutrache varnan karateh
s. & (a 'c') 'a' + b!.
aaa 'aaa' aaa? 'buub'
buub 'buub' buub? 'see'
vyakaran abhivyaktiche parcing karoon parsarchi amalbajavani karane.
konatehi parcing abhivyakti vyakaran thet punaravarti utaratya parsarmadhye rupantarit kele jaau shakate. vyakaran aupcharikta pradan karate tyaa amaryadit disanyachya kshamatemule, parinami parcer sarvat white paristhitit ghatankiy velechi kamgiri pradarshit karoo shakato.
konatyahi parcing abhivyaktisathi vyakaranasathi adhik changli kamgiri midvane shakya aahe, tyachya punaravarti utaratya parsarche "pacrat parcer" madhye rupantar karoon, jeey nehmi resheey velet chalate, mothya pramanat sathavan jagechya aavashyaktanchya kimmativar. pacrat parcer
parcer haah eka prakarcha parcer aahe joou bandhkamatil recursive decent parsarsarkhach aahe, parantu parcing prakriyedarmyan too paraspar recursive parcing functionschya serve aavahananchya madhyavarti parinamanna memoise karato, pratyek parcing function dilelya input sthiteet jastit jaast ekdach lagoo kele jaate yachee khatri karato. yaa memoisationmule, pacrat parsarmadhye anek sandarbh-mukt vyakaran aanee "konatehi" parcing abhivyakti vyakaran (sandarbh-mukt bhashanche pratinidhitva naan karananya kahee bhashansah) resheey velet vishleshan karanyachi kshamata asate. memoised recursive decent parsarchi udaharane kiman 1993 pasoon dnyat aahet.
pacrat parsarchya kamgiriche heey vishleshan asey gruheet dharate qee serve memoised parinam thevanyasathi pureshi memory upalabdh aahe; vyavharat, pureshi memory naslyas, kahee parcing functions ekach input sthiteet ekapeksha jaast vela bolvavi lagoo shakatat aanee parinami parcerla resheey velepeksha jaast vel lagoo shakato.
punaravrutti utaratya parsarpeksha changlya white kamgirisah, vyakaran abhivyakti parsingmadhun ll parcer aanee lr parcer tayar karane dekhil shakya aahe, parantu nantar vyakaran aupchariktechi amaryadit disanyachi kshamata nasht hote. mhanoon, vyakaran padvinyas vaparoon vyakt kelya jaau shakananya serve bhashanche vishleshan ll kinwa lr padavinyaskadvare kele jaau shakat nahee.
fayade.
shuddha niyamit abhivyaktinchya tulanet (i.eae. back-referenceshivay), khanjir katekorpane adhik shaktishali asatat, parantu lakshaniy adhik smrutee aavashyak asate. udaharanarth, niyamit abhivyakti swabhavikpane julalelya kansanchya jodyanchi aniyantrit sankhya shodhu shakat nahee, kaaran tee punaravrutti nahee, parantu eka pegg karoo shakate. tathapi, eka pegla inputchya lambichya pramanat memarichi aavashyakta asel, tarr niyamit expression matchersathi keval sthir memarichi aavashyakta asel.
varr varnan kelyapramane, pacrat parsarcha vapar karoon konatyahi pegche resheey velet vishleshan kele jaau shakate.
anek see. eff. jee. madhye aspashtta asate, jaree tyaa spasht bhashanche varnan karnyachya hetune asot. see, see + + aanee javamadhil 'dangling ellus' samasya heey eka udaharan aahe. vyakaranabaheril niyam lagoo karoon yaa samasya anekada sodavalya jaatat. eka khandkat, pradhanyamule yaa sandigdhata kadhihi udbhavat naheet.
tote.
smruticha vapar.
pegg parcing samanyatah "pacrat parcing" dware kele jaate, jeey anavashyak parcing payya kadhoon taknyasathi memoisation vapar karate. pacrat parsingsathi lr parsarpramane pars treachya kholiaivaji ekoon input aakarachya pramanat sathavan aavashyak asate. anek kshetranmadhye haah eka lakshaniy farak aaheh udaharanarth, hatane lihilelya srot kodmadhye prabhavipane sthir abhivyakti asate, jee karyakramachya lambipeksha swatantra asate-vishisht kholichya palikade nest kelelya abhivyakti refactor hotat.
kahee vyakaran aanee kahee inputsathi, pars treachy kholee inputchya aakarachya pramanat asoo shakate,
tyamule ell. aar. parcer aanee pacrat parcer yaa doghanchihi lakshane nasaleli kamgiri sarkhich asel. adhik achook vishleshan heey pars treachy kholee inputchya aakarapeksha swatantrapane vicharat gheil. heey aalekh algoridammadhe udbhavananya paristhitisarkhech aaheh jarr fakt shirobinduchi sankhya vicharat ghetali tarr bellman-phorda algoridam aanee floyd-warshell algoridammadhe samaan chaloo vel (sootra _ 3) asalyache disate. tathapi, eka swatantra mapdand mhanoon kadaa sankhyecha hishob karnare adhik achook vishleshan bellman-phorda algoridamla sootra 4 chee vel dete, jeey sootra 5 asalelya viral aalekhasathi vargvari aahe.
apratyaksh davya punaravrutti.
jarr tyat 'davikadil punaravrutti' niyam nastil tarr pegla 'suu-tayar' mhanatat.eae., niyam jeey naun-terminalla asha abhivyaktiparyant vistaru detat jyamadhye davikadil chinhapramane samaan naun-terminal udbhavate. davikadoon ujavikade varchya-khalchya parsarsathi, asha niyamanmule anant pratigaman hoteh stringmadhye pudhe naan jaata parcing tyach naun-terminalcha satat vistar karel.
tyamule, pacrat parcingla parvanagi denyasathi, davikadil punaravrutti kadhoon takane aavashyak aahe. udaharanarth, vareel ankganitiy vyakaranat, kahee niyam halavane aakarshak tharel jenekarun utpadane aanee berries yancha pradhanyakram ekach oleet vyakt keela jaau shakelh
moolya '[0-9.] +/' ('expre') '
utpadan ('*'/'/') ex. pii. aar.*
berries-('+'/'-') expre)*
utpadan/berries/moolya
yaa naveen vyakaranat, cockoge _ 6shhee julatana cockoge _ 7shhee julatana cockoge _ 7shhee julate qaa yachee chachani karane aavashyak aahe. hii sandnya sarvat davya sthiteet disalyamule, heey niyam eka golakar vyakhya tayar karatat jee sodavali jaau shakat nahee. (nirakaran karata yenyajogya golakar vyakhya astitvat aahet-udaharanarth pahilya udaharanatil mool sutramadhye-parantu pathological punaravrutti pradarshit naan karnyasathi asha vyakhya aavashyak aahet.) tathapi, davikadil punaravrutti door karnyasathi davikadil punaravruttiche niyam nehmi punha lihile jaau shakatat. udaharanarth, khaleel davikadil punaravrutti see. eff. jee. niyamah
string-auph-aii 'aii' chee string' . 'aaa'
adhik operator vaparoon pegmadhye punarlekhan kele jaau shakateh
string-auph-aii 'aaa'+
kahee pacrat parsarmadhye, visheshtah jevha shabdarthatmak krutee samavisht asatat, tevha "apratyakshapane" davya-punaravartit niyamanchya punarlekhan prakriya guntaguntichi asate.
kahee badalansah, paramparik pacrat parcing thet davya punaravruttila samarthan deu shakate, parantu asey kelyane resheey-vel parcing gunadharm gamavato jeey samanyatah pahilya thikani pegs aanee pacrat parcing vaparnyache samarthan aahe. keval ometa parcing algoridam atirikt parichar guntaguntishivay (parantu punha, resheey vel guntagunt gamavalyavar) purn pratyaksh aanee apratyaksh davya punaravruttila samarthan dete, tarr serve jee. ell. aar. parcer davya punaravruttila samarthan detat.
abhivyakti shakti.
pegg pacrat parcer kahee nihsanshay anirdharit see. eff. jee. niyam olakhoo shakat naheet, jase qee khalilpramaneh
s 'x' s 'x' . 'x'
heey udaharan olakhanyas ll (k) kinwa lr (k) parcing algoridam saksham naheet. tathapi, heey vyakaran sayak algoridamsarkhya samanya see. eff. jee. parsardware vaparale jaau shakate. tathapi, yaa serve prakarchya parsardware vicharadhin 'bhasha' olakhali jaau shakate, kaaran tee pratyakshat eka niyamit bhasha aahe (x chya visham sankhyechya stringchi).
vyakaran yaa padprayogadvare olakhata naan yenanya sandarbh-mukt bhasheche thos udaharan dene hii eka khulee samasya aahe. visheshtah, vyakaran heey parcing abhivyakti palyndromeschi bhasha olakhoo shakate qee nahee heey khule aahe.
aspashtta shodhane aanee julalelya bhashevar niyam kramacha prabhav.
jevha input vyakaran sandigdha asel tevha ll (k) aanee lr (k) parcer generator purn karnyat ayashasvi hotil. samanya prakaranamadhye heey eka vaishishtya aahe qee vyakaran heey spasht asanyacha hetu aahe parantu sadosh aahe. pegg parcer generator anpekshit sandigdhata lavkar-julani-pratham sodwell, jee manmani asoo shakate aanee aashcharyakarak pars houu shakate.
pegg vyakaranatil nirmitichya kramvaricha parinam keval sandigdhatechya nirakaranavarach navhe tarr 'julaleli bhasha' varr dekhil hoto. udaharanarth, fordchya kagadachya pahilya pegche udaharan vicharat ghya.
(udaharan pegjmadhye punha lihile aahe.org/online sanketan, aanee label kelele aanee):
phorda namood karato qee "nantarchya pegg niyamatil dusra paryay kadhihi yashasvi honar nahee kaaran input string asalyas nehmich pahili nivad kelee jaate... aaa' pasoon suruvat hote.". 
visheshtah, (aay.eae.) saha julalelya bhashet input "abb" samavisht aahe, parantu nahee. 
asha prakare, pegg vyakaranat naveen paryay jodalyane julalelya bhashetil taar "kadhoon takata" yetat, udaa.jee. eka-nirmiti vyakarnamadhye eka niyamachi bharr ghalane, jyamadhye eka string asate jee tyachyashi julat nahee.
shivay, pegg vyakarananshi julanare vyakaran tayar karane heey nehmich kshullak kaam nasate.
heey see. eff. jee. chya agadi ulat aahe, jyamadhye naveen utpadanachi bharr padalyane taar kadhoon takale jaau shakat naheet (tathapi, teey sandigdhatechya swarupat samasya aanoo shakate),
aanee eka (sambhavya sandigdha) vyakaran tayar kele jaau shakate
ess → prarambh (jee1) . prarambh (jee2)
tall-varr pegg parcing.
pica parcer heey payachya niyamancha tall-varr aanee ujavikadoon davikade vapar karnyasathi dynamic programingcha vapar karate, jeey varchya-khalchya, davikadoon ujavikade samanya punaravarti utaratya kramache ulat aahe. ulat kramane parcing kelyane davya punaravruttichi samasya sodate, davya-punaravruttiche niyam thet vyakaranat davya-punaravartit swarupat punarlikhit naan karata vaparale jaau shakatat aanee parsarvar ishtatam truti punarprapti kshamata dekhil vyakt karatat, jee aitihasikdrushtya punaravrutti utaratya parsarsathi sadhya karane katheen siddha jhaali.
vyavharik vapar.
python sandarbh amalbajavani cpython neey ll (1) parcerla paryay mhanoon aavrutti 3.9 madhye pegg parcer sadar keela aanee aavrutti 3.1 pasoon fakt pegg vaparato.
jeey. kyu. programming bhasha pegashi jawalun sambandhit aupcharikta vaparte.