Re: Going backwards from a Language(or set of expressions) to a Grammar

Tom <treid3@centurylink.net>
Mon, 17 Apr 2017 03:19:30 GMT

          From comp.compilers

Related articles
Going backwards from a Language(or set of expressions) to a Grammar seimarao@gmail.com (Seima Rao) (2017-04-16)
Re: Going backwards from a Language(or set of expressions) to a Gramma seimarao@gmail.com (Seima Rao) (2017-04-17)
Re: Going backwards from a Language(or set of expressions) to a Gramma treid3@centurylink.net (Tom) (2017-04-17)
Re: Going backwards from a Language(or set of expressions) to a Gramma alain@universite-de-strasbourg.fr (Alain Ketterlin) (2017-04-17)
Re: Going backwards from a Language(or set of expressions) to a Gramma derek@_NOSPAM_knosof.co.uk (Derek M. Jones) (2017-04-17)
| List of all articles for this month |

From: Tom <treid3@centurylink.net>
Newsgroups: comp.compilers
Date: Mon, 17 Apr 2017 03:19:30 GMT
Organization: Model Railroaders Unanimous
References: 17-04-014
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

Seima Rao <seimarao@gmail.com> 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


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.