Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1855

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

From Tom <treid3@centurylink.net>
Newsgroups comp.compilers
Subject Re: Going backwards from a Language(or set of expressions) to a Grammar
Date 2017-04-17 03:19 +0000
Organization Model Railroaders Unanimous
Message-ID <17-04-016@comp.compilers> (permalink)
References <17-04-014@comp.compilers>

Show all headers | View raw


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

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Going backwards from a Language(or set of expressions) to a Grammar Seima Rao <seimarao@gmail.com> - 2017-04-16 19:01 +0530
  Re: Going backwards from a Language(or set of expressions) to a Grammar Seima Rao <seimarao@gmail.com> - 2017-04-17 08:31 +0530
  Re: Going backwards from a Language(or set of expressions) to a Grammar Tom <treid3@centurylink.net> - 2017-04-17 03:19 +0000
  Re: Going backwards from a Language(or set of expressions) to a Grammar Alain Ketterlin <alain@universite-de-strasbourg.fr> - 2017-04-17 12:57 +0200
  Re: Going backwards from a Language(or set of expressions) to a Grammar "Derek M. Jones" <derek@_NOSPAM_knosof.co.uk> - 2017-04-17 15:29 +0100
  Re: Going backwards from a Language(or set of expressions) to a Grammar Stefan Monnier <monnier@iro.umontreal.ca> - 2017-05-06 22:02 -0400

csiph-web