From: Fred Nurk on
I'm doing my IT holiday homework and I get this:

Investigate your chosen programming or scripting language and determine
the following:

....
(d) What is the syntax of the language?

I've chosen C. In table 8.3 (Programming languages and codes), under PHP,
it says: 'Syntax is fairly simple and similar to that of Perl, with some
aspects like Javascript and C.'
Under ActionScript, it says: 'Has its own syntax that determines which
characters and words are used to create meaning and in which order they
can be written.'

Do you think: 'Syntax (of C) is the basis of the syntax of many other
high-level programming/scripting languages. Pointer and structure syntax
can become complex.' is adequate?

TIA,
Fred
From: Ian Collins on
On 07/ 8/10 03:27 PM, Fred Nurk wrote:
> I'm doing my IT holiday homework and I get this:
>
> Investigate your chosen programming or scripting language and determine
> the following:
>
> ...
> (d) What is the syntax of the language?
>
> I've chosen C. In table 8.3 (Programming languages and codes), under PHP,
> it says: 'Syntax is fairly simple and similar to that of Perl, with some
> aspects like Javascript and C.'

Well that's rubbish, PHP syntax (excluding the OO parts) is much more
like C than Perl. Where is this table you refer to?

> Under ActionScript, it says: 'Has its own syntax that determines which
> characters and words are used to create meaning and in which order they
> can be written.'
>
> Do you think: 'Syntax (of C) is the basis of the syntax of many other
> high-level programming/scripting languages. Pointer and structure syntax
> can become complex.' is adequate?

Adequate for what? The question appears to be looking for a description
of the language syntax (which would be long), not how it relates to others.

--
Ian Collins
From: Fred Nurk on
Ian Collins wrote:
> <snip>
> Where is this table you refer to?

At http://sites.google.com/site/xtheunknown0/information-technology

> <snip>
> Adequate for what? The question appears to be looking for a description
> of the language syntax (which would be long), not how it relates to
> others.

Well, my IT course doesn't really go into any specific programming
language. I doubt that a 'description of the language syntax' would be
expected.

Do you think that my answer models the 'overviews' in the textbook?

TIA,
Fred
From: bart.c on

"Fred Nurk" <albert.xtheunknown0(a)gmail.com> wrote in message
news:WAbZn.374$Yv.160(a)viwinnwfe01.internal.bigpond.com...
> I'm doing my IT holiday homework and I get this:
>
> Investigate your chosen programming or scripting language and determine
> the following:
>
> ...
> (d) What is the syntax of the language?
>
> I've chosen C. In table 8.3 (Programming languages and codes), under PHP,
> it says: 'Syntax is fairly simple and similar to that of Perl, with some
> aspects like Javascript and C.'
> Under ActionScript, it says: 'Has its own syntax that determines which
> characters and words are used to create meaning and in which order they
> can be written.'
>
> Do you think: 'Syntax (of C) is the basis of the syntax of many other
> high-level programming/scripting languages.

> Pointer and structure syntax
> can become complex.' is adequate?

It would be wrong; they're not particularly complex.

What *are* complex are type declarations, which can become near impossible
to decipher without special tools or following an algorithm.

Fortunately most languages that borrowed it's syntax wisely decided not to
copy it's type declarations.

--
Bartc

From: Pascal J. Bourguignon on
Fred Nurk <albert.xtheunknown0(a)gmail.com> writes:

> I'm doing my IT holiday homework and I get this:
>
> Investigate your chosen programming or scripting language and determine
> the following:
>
> ...
> (d) What is the syntax of the language?
>
> I've chosen C. In table 8.3 (Programming languages and codes), under PHP,
> it says: 'Syntax is fairly simple and similar to that of Perl, with some
> aspects like Javascript and C.'
> Under ActionScript, it says: 'Has its own syntax that determines which
> characters and words are used to create meaning and in which order they
> can be written.'
>
> Do you think: 'Syntax (of C) is the basis of the syntax of many other
> high-level programming/scripting languages. Pointer and structure syntax
> can become complex.' is adequate?

The syntax of a programming language is determined by its lexic and
its grammar.

The lexic is the set (possibly infinite) of 'letters' of the language.

In a language like C, '{' is one 'letter', but 'while' is one too, as
well as 'generateGrammar'.

The grammar is a tuple (S, NT, T, R) where is the start symbol, an
element of NT ∪ T. (Usually it's from NT), NT is a set of non-terminal
symbols, T is a set of terminal symbols, it's the lexic, and R is a
set of production rules. Each rule is of the form: lhs -> rhs where
(lhs,rhs) ∈ (NT ∪ T)². In practice, we use restricted forms of
grammar, where lhs is in NT (and S in NT too), and depending on the
parsing algorithm we want to use, additionnal restriction may be
placed on the rhs (such as avoiding right, or left recursion, etc).


So, comparing the complexity of languages is comparing the
'complexity' of two tuples (S, NT, T, R).

Here is the first difficulty: there is not a unique grammar for a
given language. Two different grammars may generate the same
language. I'm not sure we could define a 'normal form' for grammars.
If you can define a less-complex relationship for grammars generating
the same language, you can probably find grammars of minimal
complexity, but there will be probably be several uncomparable minima.


Then you may want to consider other complexities, such as the
complexity of the parsing algorithm required by the grammar, or the
complexity of the parsing process.

In either case, you may find that a more complex grammar (a more
complex (S, NT, T, R)) is actually simplier to parse (ie. it's
possible to parse with a simplier parser algorithm, or is faster to
parse (there is an algorithm producing a simplier parsing process)).

But what's more, these complexities have little relation with the
difficulty a human brain will have to write or read words of these
languages. Often a very simple grammar will be very hard to read or
write. A typical example is C, which has a grammar relatively
simplier than other languages that existed at the time it was created,
or after, (because C was defined with the sole purpose to write an
operating system on a computer that was too small to do anything
useful so it was given to Kerningham, Ritchie and Thompson so they may
play with it (and indeed, they had to write this OS only to be able to
port and run a game program from Multics)), but which is actually much
harder to read and write for most programmers (even without semantics
considerations, the syntax of C is hard enough to justify a sizeable
share of bugs).

Of course it could be argued that languages with complex grammars are
also hard to read and write. I would say that it depends. Natural
language grammars are usually more complex than programming language,
but they're often more eassily read and written, on one hand, and on
the other, there are languages with very simple grammar, that are also
very easy to read and write.




Finally, the fact that two different languages use the same lexic
doesn't imply anything about their relative 'complexity' however you
defined this (while you don't restrict this definition to a comparison
of the lexic). An example of this would be C vs. C++, where the lexic
are about the same (there are a few additions in C++), but where the
grammar of C++ is much more complex than the grammar of C (there are
more grammar rules).



--
__Pascal Bourguignon__ http://www.informatimago.com/