Path: csiph.com!feeder.erje.net!2.us.feeder.erje.net!feeder.usenetexpress.com!feeder1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Tom Newsgroups: comp.compilers Subject: Re: Going backwards from a Language(or set of expressions) to a Grammar Date: Mon, 17 Apr 2017 03:19:30 GMT Organization: Model Railroaders Unanimous Lines: 24 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <17-04-016@comp.compilers> References: <17-04-014@comp.compilers> Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="11136"; mail-complaints-to="abuse@iecc.com" Keywords: parse Posted-Date: 17 Apr 2017 09:54:24 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1855 Seima Rao wrote in news:17-04-014@comp.compilers: > Hi, > > Is it possible generally to arrive at a grammar from > a language or set of expressions ? It depends on the language properties. It can be simple to impossible. Your question implied that you thoroughly know the language and wanted to derive its grammar sufficiently to write a parser/complier to (correctly) process example programs/expressions. An experienced compiler writer will need some time to study what category of grammar is needed. (Regular) expressions just need an lexical analyzer. Many languages like Pascal and Modula2 are LL-1 and the grammars and parsers are straightforward recursive descent. Other languages like C and its bethren need more complex bottom-up parsers and preprocessors for disambiguation. Large context sensitive languages (English for example) have a high error rate. So, your answer is yes for simple with some practice and understanding and can be extrememly had as the language gets complexity. Elegant