Go Back   Velocity Reviews > Newsgroups > C Programming
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

C Programming - How to convert Infix notation to postfix notation

 
Thread Tools Search this Thread
Old 11-01-2009, 06:33 AM   #21
Default Re: How to convert Infix notation to postfix notation


On Nov 1, 2:11*pm, Seebs <usenet-nos...@seebs.net> wrote:
> On 2009-11-01,spinoza1111<spinoza1...@yahoo.com> wrote:
>
> > Did you write it or did you steal it?

>
> Presumably wrote it. *I mean, come on. *A parser is NOT that hard; I've
> written one from scratch (maybe two) and done a few with yacc, and while
> the code in question doubtless sucked (hint: *everyone's first language
> sucks), it worked fine.
>
> > I need to see you actually write new C code.

>
> Er, why?


Because I don't think you're competent.
>
> > You have a big mouth when
> > it comes to putting down people but the only time when you put your
> > big mouth on the line (the Spark Notes test) you failed. I am giving
> > you another chance.

>
> ... Wait, SPARK NOTES?
>
> You're telling me that you are comparing Richard Heathfield to SPARK NOTES
> and you think that a discrepancy means he's wrong?


Yes. The anonymous team who drafted the Spark Notes test were more
competent than Heathfield, just as Schildt is also more competent than
you.

Note that I don't say "at C" because to be competent at a mistake is
to be subhuman. No, I mean more competent human beings. You know what
a human being is, don't you?
>
> Please tell me that it's still Halloween where you are and you went as
> a troll.
>
> > I wrote and debugged a recursive descent parser for my book. I wrote
> > it again here after correcting the grammar

>
> ... Wait, uhm.
>
> Does that mean the one in the book is wrong?


No. Like many smart people without serious personality disorders I
make typical mistakes: Knuth has confessed he makes the same mistake
in binary search each time he implements it anew. These brain farts
show that we're thinking non-autistically, like actual human beings.
You know what a human being is, or used to be?

I made the same error while developing the book but while coding
noticed it was wrong, and corrected it, using my mistake to explain
things.

I don't have to be right all the time whereas you must be since
otherwise you're a frightened little boy.
>
> If so, then how did this not show up in debugging?


It didn't show since fixed it. As I've said, I made the mistake
twice: in 2003 while writing the book, and last week when replying to
the OP.
>
> > It also demonstrates that the material is sufficiently complex for
> > smart people to make stupid mistakes (Knuth has himself said he
> > consistently gets binary search wrong the first time), and that the
> > stupid people aren't the ones making the mistakes.

>
> Stupid people make mistakes too.


Arguably less than smart people because stupid people have to work at
7-11 where their actions are monitored, or on funny little embedded
systems as opposed to actually important systems such as Microsoft
boxes, and their work is constantly checked.
>
> > It's the people too ready to trash and if possible render unemployable
> > their fellow human beings (by creating a record here) while explaining
> > away their own mistakes as you explained away your failure to get a
> > decent grade on the Spark Notes test.

>
> I am totally fascinated by the concept of such a test. *Is it ...
> Hmm.
>
> Well, I went and looked, and found:
>
> http://www.sparknotes.com/cs/pointers/review/quiz.html
>
> This is a funny quiz. *It is full of errors.


Document each error. Is that why you failed to graduate properly and
did not get an MSCS? You sat in the test finding errors instead of
answering questions?
>
> Is this the quiz you used?
>
> Please let me know.


You're not really worth it.
>
> -s
> --
> Copyright 2009, all wrongs reversed. *Peter Seebach / usenet-nos...@seebs.nethttp://www.seebs.net/log/<-- lawsuits, religion, and funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!




spinoza1111
  Reply With Quote
Old 11-01-2009, 07:16 AM   #22
Seebs
 
Posts: n/a
Default Re: How to convert Infix notation to postfix notation
On 2009-11-01, spinoza1111 <> wrote:
> On Nov 1, 2:11*pm, Seebs <usenet-nos...@seebs.net> wrote:
>> Er, why?


> Because I don't think you're competent.


Wait, me too, or just Richard?

> Yes. The anonymous team who drafted the Spark Notes test were more
> competent than Heathfield, just as Schildt is also more competent than
> you.


.... What the ****?

> Note that I don't say "at C" because to be competent at a mistake is
> to be subhuman.


You clearly do not understand why Buster Keaton rocks.

> No, I mean more competent human beings. You know what
> a human being is, don't you?


Normally, yes.

However, even if we grant that they're hypothetically competent
at "being human beings" or whatever, that still doesn't make their test
informative as to whether someone knows C.

And come to think of it... It sounds like you've just asserted that,
if Richard Heathfield can write C competently, that makes him subhuman.
You're not exactly making a persuasive argument here that he should show
you how good his code is.

> No. Like many smart people without serious personality disorders I
> make typical mistakes:


This is also true of stupid people without serious personality disorders,
smart people with serious personality disorders, or stupid people with
serious personality disorders.

> Knuth has confessed he makes the same mistake
> in binary search each time he implements it anew. These brain farts
> show that we're thinking non-autistically, like actual human beings.


Actually, they don't. Because autistic people make those same kinds of
mistakes.

> I don't have to be right all the time whereas you must be since
> otherwise you're a frightened little boy.


This would be much, much, more persuasive if I hadn't admitted to at least
half a dozen errors in comp.lang.c in the last month or so.

> Arguably less than smart people because stupid people have to work at
> 7-11 where their actions are monitored, or on funny little embedded
> systems as opposed to actually important systems such as Microsoft
> boxes, and their work is constantly checked.


Oh, I see. You're trying to sneakily imply that I'm stupid. No, not buying
it. I certainly have my cognitive flaws, but "stupidity" is not one
of them.

> Document each error.


I'll just give you my favorite:

After this code executes

int arr[10];
int i;
i = &arr[9] - arr;

what is the value of i?
(A) 8
(B) 9
(C) 10
(D) Won't compile

Go ahead, guess what their answer is. Guess what mine was. And guess
what my compiler says if I try it. (Hint: The last two are both
the correct answer. Theirs isn't.)

> Is that why you failed to graduate properly and
> did not get an MSCS?


Who said I failed to graduate properly? I graduated just fine with a BA.
I didn't feel like doing more school at the time, so I just started going out
and doing stuff.

> You sat in the test finding errors instead of
> answering questions?


Funny thing, when I was doing tests written by college professors rather
than by random people on the internet, I didn't find nearly so many errors.


> You're not really worth it.


From which I infer that this WAS the test you used, or part of the same test,
and that the idea that there might be unambiguous errors in that test would
undermine the quality of your argument against Richard Heathfield?

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!


Seebs
  Reply With Quote
Old 11-01-2009, 07:17 AM   #23
Seebs
 
Posts: n/a
Default Re: How to convert Infix notation to postfix notation
On 2009-11-01, Richard Heathfield <> wrote:
> For the benefit of those who may not know, the subject of the Spark
> Notes test in question was C++, not C.


Oh, then it was a different one.

Looking at this one, though, I think I would share your evaluation. Many
of the questions are ambiguous or poorly phrased, a few are just plain
wrong.

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!


Seebs
  Reply With Quote
Old 11-01-2009, 08:24 AM   #24
spinoza1111
 
Posts: n/a
Default Re: How to convert Infix notation to postfix notation
On Nov 1, 10:31*am, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
> spinoza1111<spinoza1...@yahoo.com> writes:
>
> <snip>
>
> > I published it here to show the OP that the grammar based approach
> > works, and give him "pseudo code" for his C assignment, without doing
> > his homework for him.

>
> > Since by now he's probably handed in his assignment, I challenge you
> > to translate the C Sharp code to C.

>
> That would not be useful. *Your code does not parse the language
> defined by the grammar, and what it does do, it does in a rather
> roundabout way.
>
> <snip>
> --
> Ben.


Since Ben is too lazy and too discourteous to reply with errors, I
shall reply with errors in the code that I found when starting to
convert it to C.

Briefly it failed for a null string and a blank.

It failed (out of bounds subscript) in the mulFactor recognizer when
the infix expression was a null string. This is because mulFactor is
what would be in a more elaborate parser a lexxer looking to the next
character and returning some agreed on symbol when the input is at an
end. Therefore, mulFactor has to take responsibility in the absence of
a lexxer for detailed pointer checks. It started by looking for a
letter without checking intIndex for being out of bounds.

It needed this check. The second test in mulFactor did not since the
bounds check is part of the while condition. But the third test for a
left parenthesis also needed this check.

I put a new check at the start of mulFactor, returning false when
intIndex>intEnd. I also added a false and error return when mulFactor,
which again combines the jobs of mulFactor and lex, fails to find one
of its three alternatives: letter, number, parenthesized expression. I
also made the output of the regression test more readable.

Note that people who make mistakes learn more even if like Knuth wrt
binary search they make them more than once, IF they are not
constantly interrupted by autistic twerps. They also teach more.

There may have been other mistakes in this code. I have neither
formally nor informally proved it correct. But apart from making an
unsupported claim, Bacarisse has as yet provided no insights. I have
had to do so, so far, wrt to the null string and blank character bug.

Nothing could more clearly indicate the pathology of a newsgroup so
dominated by autistic twerps.

Here is the new test regression output, followed by the new code.


Expect "": For the infix expression "", the Polish expression or error
report is

Error detected at or near character 0 in "": Expected multiplication
factor not found; Error detected at or near character 0 in "":
Expression doesn't start with addFactor
--------------------------------------------
Expect "": For the infix expression " ", the Polish expression or
error report is

Error detected at or near character 0 in " ": Unexpected character '
'; Error detected at or near character 0 in " ": Expected
multiplication factor not found; Error detected at or near character 0
in " ": Expression doesn't start with addFactor
--------------------------------------------
Expect "2 4 3 + /": For the infix expression "2/(4+3)", the Polish
expression or error report is

2 4 3 + /
--------------------------------------------
Expect "2 4 / 3 +": For the infix expression "2/4+3", the Polish
expression or error report is

2 4 / 3 +
--------------------------------------------
Expect "2 4 3 + /": For the infix expression "((2/(4+3)))", the Polish
expression or error report is

2 4 3 + /
--------------------------------------------
Expect "10 113 2 2 4 3 + / + 2 + 2 + - + a *": For the infix
expression "((10+(113-(2+((((((2/(4+3)))))))+2+2))))*a", the Polish
expression or error report is

10 113 2 2 4 3 + / + 2 + 2 + - + a *"
--------------------------------------------
Expect error: For the infix expression "11+", the Polish expression or
error report is

Error detected at or near character 3 in "11+": Addition or
subtraction operator is not followed by addFactor
--------------------------------------------
Expect error: For the infix expression "11 +", the Polish expression
or error report is

Error detected at or near character 2 in "11 +": Expected addition or
subtraction operator not found
--------------------------------------------
Expect "10 113 + a *": For the infix expression "(10+113)*a", the
Polish expression or error report is

10 113 + a *
--------------------------------------------
Expect "10 113 + a *": For the infix expression "((10+113))*a", the
Polish expression or error report is

10 113 + a *
--------------------------------------------
Expect "1": For the infix expression "1", the Polish expression or
error report is

1
--------------------------------------------
Expect "a b + c -": For the infix expression "a+b-c", the Polish
expression or error report is

a b + c -
--------------------------------------------
Expect "1 1 +": For the infix expression "1+1", the Polish expression
or error report is

1 1 +
--------------------------------------------




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace infix2Polish
{
class Program
{
static void Main(string[] strArgs)
{
if (strArgs.GetUpperBound(0) < 0)
Console.WriteLine(tester());
else
Console.WriteLine(infix2Polish(strArgs[0]));
return;
}

private static string tester()
{
string strSep =
Environment.NewLine +
"--------------------------------------------" +
Environment.NewLine;
return "Expect \"\": " +
infix2PolishTest("") +
strSep +
"Expect \"\": " +
infix2PolishTest(" ") +
strSep +
"Expect \"2 4 3 + /\": " +
infix2PolishTest("2/(4+3)") +
strSep +
"Expect \"2 4 / 3 +\": " +
infix2PolishTest("2/4+3") +
strSep +
"Expect \"2 4 3 + /\": " +
infix2PolishTest("((2/(4+3)))") +
strSep +
"Expect " +
"\"10 113 2 2 4 3 + / + 2 + 2 " +
"+ - + a *\": " +
infix2PolishTest
("((10+(113-(2+((((((2/(4+3)))))))+2+2))))*a") +
"\"" +
strSep +
"Expect error: " +
infix2PolishTest("11+") +
strSep +
"Expect error: " +
infix2PolishTest("11 +") +
strSep +
"Expect \"10 113 + a *\": " +
infix2PolishTest("(10+113)*a") +
strSep +
"Expect \"10 113 + a *\": " +
infix2PolishTest("((10+113))*a") +
strSep +
"Expect \"1\": " +
infix2PolishTest("1")+
strSep +
"Expect \"a b + c -\": " +
infix2PolishTest("a+b-c") +
strSep +
"Expect \"1 1 +\": " +
infix2PolishTest("1+1") +
strSep;
}

private static string infix2PolishTest(string strInfix)
{
return "For the infix expression " +
"\"" + strInfix + "\", " +
"the Polish expression or error report is " +
Environment.NewLine +
Environment.NewLine +
infix2Polish(strInfix);
}

private static string infix2Polish(string strInfix)
{
string strPolish = "";
int intIndex1 = 0;
string strErrorMessage = "";
if (!expression(strInfix,
ref strPolish,
ref intIndex1,
ref strErrorMessage))
return strErrorMessage;
return strPolish.Trim();
}

private static bool expression
(string strInfix,
ref string strPolish,
ref int intIndex,
ref string strErrorMessage)
{
return expression(strInfix,
ref strPolish,
ref intIndex,
ref strErrorMessage,
strInfix.Length - 1);
}
private static bool expression
(string strInfix,
ref string strPolish,
ref int intIndex,
ref string strErrorMessage,
int intEnd)
{// expression -> addFactor [ +|- addFactor ] *
if (!addFactor(strInfix,
ref strPolish,
ref intIndex,
ref strErrorMessage,
intEnd))
return errorHandler
(strInfix,
intIndex,
ref strErrorMessage,
"Expression doesn't start with " +
"addFactor");
char chrAddOp = ' ';
while (intIndex <= intEnd)
{
if ((chrAddOp = strInfix[intIndex]) != '+'
&&
chrAddOp != '-')
return errorHandler
(strInfix,
intIndex,
ref strErrorMessage,
"Expected addition or subtraction " +
"operator not found");
intIndex++;
if (intIndex > intEnd
||
!addFactor(strInfix,
ref strPolish,
ref intIndex,
ref strErrorMessage,
intEnd))
return errorHandler
(strInfix,
intIndex,
ref strErrorMessage,
"Addition or subtraction " +
"operator is not followed by " +
"addFactor");
strPolish += chrAddOp.ToString() + ' ';
}
return true;
}

private static bool addFactor
(string strInfix,
ref string strPolish,
ref int intIndex,
ref string strErrorMessage,
int intEnd)
{// addFactor -> mulFactor [ *|/ mulFactor ] *
if (!mulFactor(strInfix,
ref strPolish,
ref intIndex,
ref strErrorMessage,
intEnd))
return errorHandler
(strInfix,
intIndex,
ref strErrorMessage,
"Expected multiplication factor " +
"not found");
char chrMulOp = ' ';
while (intIndex <= intEnd
&&
((chrMulOp = strInfix[intIndex]) == '*'
||
chrMulOp == '/'))
{
intIndex++;
if (intIndex > intEnd
||
!mulFactor(strInfix,
ref strPolish,
ref intIndex,
ref strErrorMessage,
intEnd))
return errorHandler
(strInfix,
intIndex,
ref strErrorMessage,
"Expected multiplication factor " +
"not found");
strPolish += chrMulOp.ToString() + ' ';
}
return true;
}

private static bool mulFactor
(string strInfix,
ref string strPolish,
ref int intIndex,
ref string strErrorMessage,
int intEnd)
{// mulFactor -> LETTER|NUMBER|"(" expression ")"
if (intIndex > intEnd) return false;
if (strInfix[intIndex] >= 'a'
&&
strInfix[intIndex] <= 'z')
{
strPolish += strInfix[intIndex++].ToString() +
' ';
return true;
}
int intIndex1 = intIndex;
while(intIndex <= intEnd
&&
(strInfix[intIndex] >= '0'
&&
strInfix[intIndex] <= '9'))
strPolish += strInfix[intIndex++];
if (intIndex > intIndex1)
{
strPolish += ' ';
return true;
}
if (strInfix[intIndex] == '(')
{
intIndex++;
int intLevel = 1;
int intIndexAhead = 0;
for (intIndexAhead = intIndex;
intIndexAhead <= intEnd;
intIndexAhead++)
{
switch (strInfix[intIndexAhead])
{
case '(':
{
intLevel++; break;
}
case ')':
{
intLevel--;
if (intLevel == 0) goto exit;
break;
}
default: break;
}
}
exit:
if (!expression(strInfix,
ref strPolish,
ref intIndex,
ref strErrorMessage,
intIndexAhead - 1))
return errorHandler
(strInfix,
intIndex,
ref strErrorMessage,
"Nested expression invalid");
intIndex++;
}
else
return errorHandler(strInfix,
intIndex,
ref strErrorMessage,
"Unexpected character " +
"'" + strInfix[intIndex] + "'");
return true;
}

private static bool errorHandler
(string strInfix,
int intIndex,
ref string strBase,
string strMessage)
{
strBase +=
(strBase == "" ? "" : "; ") +
"Error detected at or near " +
"character " +
intIndex.ToString() + " " +
"in " + "\"" + strInfix + "\": " +
strMessage;
return false;
}
}
}


spinoza1111
  Reply With Quote
Old 11-01-2009, 08:29 AM   #25
spinoza1111
 
Posts: n/a
Default Re: How to convert Infix notation to postfix notation
On Nov 1, 4:24*pm, spinoza1111 <spinoza1...@yahoo.com> wrote:
> On Nov 1, 10:31*am, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
>
>
>
>
>
> >spinoza1111<spinoza1...@yahoo.com> writes:

>
> > <snip>

>
> > > I published it here to show the OP that the grammar based approach
> > > works, and give him "pseudo code" for his C assignment, without doing
> > > his homework for him.

>
> > > Since by now he's probably handed in his assignment, I challenge you
> > > to translate the C Sharp code to C.

>
> > That would not be useful. *Your code does not parse the language
> > defined by the grammar, and what it does do, it does in a rather
> > roundabout way.

>
> > <snip>
> > --
> > Ben.

>
> Since Ben is too lazy and too discourteous to reply with errors, I
> shall reply with errors in the code that I found when starting to
> convert it to C.
>
> Briefly it failed for a null string and a blank.
>
> It failed (out of bounds subscript) in the mulFactor recognizer when
> the infix expression was a null string. This is because mulFactor is
> what would be in a more elaborate parser a lexxer looking to the next
> character and returning some agreed on symbol when the input is at an
> end. Therefore, mulFactor has to take responsibility in the absence of
> a lexxer for detailed pointer checks. It started by looking for a
> letter without *checking intIndex for being out of bounds.
>
> It needed this check. The second test in mulFactor did not since the
> bounds check is part of the while condition. But the third test for a
> left parenthesis also needed this check.
>
> I put a new check at the start of mulFactor, returning false when
> intIndex>intEnd. I also added a false and error return when mulFactor,
> which again combines the jobs of mulFactor and lex, fails to find one
> of its three alternatives: letter, number, parenthesized expression. I
> also made the output of the regression test more readable.
>
> Note that people who make mistakes learn more even if like Knuth wrt
> binary search they make them more than once, IF they are not
> constantly interrupted by autistic twerps. They also teach more.
>
> There may have been other mistakes in this code. I have neither
> formally nor informally proved it correct. But apart from making an
> unsupported claim, Bacarisse has as yet provided no insights. I have
> had to do so, so far, wrt to the null string and blank character bug.
>
> Nothing could more clearly indicate the pathology of a newsgroup so
> dominated by autistic twerps.
>
> Here is the new test regression output, followed by the new code.
>
> Expect "": For the infix expression "", the Polish expression or error
> report is


One nit: it shouldn't say here and on the next line "expect a null
string": it should say "expect an error".

I will take Peter's and Richard's silence on these posts to indicate
incompetence to study this code and find flaws.

I shall take Ben's as indicating that he's out Trick or Treating, or
is studying the code desparate to find a justification for his slander.


spinoza1111
  Reply With Quote
Old 11-01-2009, 08:34 AM   #26
Seebs
 
Posts: n/a
Default Re: How to convert Infix notation to postfix notation
On 2009-11-01, spinoza1111 <> wrote:
> I will take Peter's and Richard's silence on these posts to indicate
> incompetence to study this code and find flaws.


I don't know the language you wrote it in, and also don't feel a lot of
need to try to find flaws in your code.

Write something in a language I know and post it in an appropriate group
and I'd be glad to critique it for you. My interest level in learning
C# is pretty low to begin with, and trying to learn it just to critique
your code seems particularly pointless.

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!


Seebs
  Reply With Quote
Old 11-01-2009, 08:48 AM   #27
spinoza1111
 
Posts: n/a
Default Re: How to convert Infix notation to postfix notation
On Nov 1, 4:34*pm, Seebs <usenet-nos...@seebs.net> wrote:
> On 2009-11-01,spinoza1111<spinoza1...@yahoo.com> wrote:
>
> > I will take Peter's and Richard's silence on these posts to indicate
> > incompetence to study this code and find flaws.

>
> I don't know the language you wrote it in, and also don't feel a lot of
> need to try to find flaws in your code.
>
> Write something in a language I know and post it in an appropriate group
> and I'd be glad to critique it for you. *My interest level in learning
> C# is pretty low to begin with, and trying to learn it just to critique
> your code seems particularly pointless.


I have written it in C# as a way to prototype it for the original
poster without doing his homework for him, and now that he's probably
handed in the assignment, I am rewriting it in C, using the C Sharp as
a prototype.

Furthermore, I have taken the risk of critiqueing C without being, any
more, completely familiar with the language. I submit that you're
afraid that I will laugh at you should you critique C Sharp. Fear not.
I am no autistic twerp.

The original intent of programming language design on the part of
Grace Hopper, John Backus, Edsger Dijkstra and the men who created
Algol was NOT to create a group of mutually incomprehensible tribal
languages and a bunch of phony "experts". Therefore, real computer
scientists are willing to comment on code in unfamiliar languages, for
essentially the same reason that in a humanistic structured
walkthrough, contributions from all members are encouraged, and any
"pecking order", especially some pecking order dominated by autistic
twerps, where the savagery is complementary to the savagery with which
some of these twerps were treated growing up, is discouraged.

Can you write it in C using my C Sharp as a prototype, given that C
Sharp is broadly similar to C?


spinoza1111
  Reply With Quote
Old 11-01-2009, 08:55 AM   #28
spinoza1111
 
Posts: n/a
Default Re: How to convert Infix notation to postfix notation
On Nov 1, 4:34*pm, Seebs <usenet-nos...@seebs.net> wrote:
> On 2009-11-01,spinoza1111<spinoza1...@yahoo.com> wrote:
>
> > I will take Peter's and Richard's silence on these posts to indicate
> > incompetence to study this code and find flaws.

>
> I don't know the language you wrote it in, and also don't feel a lot of
> need to try to find flaws in your code.
>
> Write something in a language I know and post it in an appropriate group


Furthermore, the idea that computer languages are even distinct is
absurd. That they are is a historical accident, caused by the large
number of errors made in language design in the early days.

Insofar as "knowledge" of C is knowledge of mistakes, C has no
standing as an academic subject and should not be spoken of as a
computer language. Instead, it should be considered a pathology which
computer scientists must learn for the same reason doctors must learn
cancer.

People whose main claim to expertise in C should be sent to re-
education camps on the model of UN centres in Africa which train
former guerrillas in useful trades.

And the world still needs one programming language that can be used by
everyone. The guy on the screen in the 1984 Apple commercial was
right.


> and I'd be glad to critique it for you. *My interest level in learning
> C# is pretty low to begin with, and trying to learn it just to critique
> your code seems particularly pointless.
>
> -s
> --
> Copyright 2009, all wrongs reversed. *Peter Seebach / usenet-nos...@seebs.nethttp://www.seebs.net/log/<-- lawsuits, religion, and funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!




spinoza1111
  Reply With Quote
Old 11-01-2009, 08:59 AM   #29
Seebs
 
Posts: n/a
Default Re: How to convert Infix notation to postfix notation
On 2009-11-01, spinoza1111 <> wrote:
> Furthermore, I have taken the risk of critiqueing C without being, any
> more, completely familiar with the language. I submit that you're
> afraid that I will laugh at you should you critique C Sharp. Fear not.
> I am no autistic twerp.


It's not that, it's that I don't know the language and wouldn't care to
try to criticize code in a language I don't know. You're welcome to laugh
at me anyway if you wish. It may help if you imagine that I've got a big
red clown nose. Honk honk! Honk honk!

> The original intent of programming language design on the part of
> Grace Hopper, John Backus, Edsger Dijkstra and the men who created
> Algol


Your name-dropping is starting to make me wonder if it's NPD week in
comp.lang.c. Why do you obsessively cite to other people's accomplishments?

> was NOT to create a group of mutually incomprehensible tribal
> languages and a bunch of phony "experts".


Doubtless it wasn't.

> Therefore, real computer
> scientists are willing to comment on code in unfamiliar languages,


Ahh. I see. The intent of the people who developed natural human language
was not to create a group of mutually incomprehensible tribal languages
and a bunch of phony "experts", which is why real linguists are willing to
review books in unfamiliar languages.

Furthermore, it's worth pointing out that C# was not created by the
luminaries of the field, but rather by Microsoft, and that their history
strongly suggests that it was *exactly* their intent to create a tribal
language mutually-incomprehensible with other languages and a bunch of
phony "experts", because that's been their strategy throughout the
last thirty or so years.

> for
> essentially the same reason that in a humanistic structured
> walkthrough, contributions from all members are encouraged, and any
> "pecking order", especially some pecking order dominated by autistic
> twerps, where the savagery is complementary to the savagery with which
> some of these twerps were treated growing up, is discouraged.


This is a beautiful example of the kind of rant that keeps us coming back
to your posts. I'm sufficiently free of pecking orders that it's considered
a neurological disorder, and you're ranting at me about pecking orders.
That's amusing.

But it doesn't change the fact that I don't know C#, and have pretty much
no interest in reviewing hundreds of lines of non-C code in comp.lang.c. I
would react the same way to a suggestion that I review a ton of shell
script code here, even though I consider myself basically competent to
review shell scripts.

> Can you write it in C using my C Sharp as a prototype, given that C
> Sharp is broadly similar to C?


I probably could, but I don't see why I'd bother. I can write C code
from all sorts of stuff, but this seems like fundamentally dull code.
Pick something fun!

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!


Seebs
  Reply With Quote
Old 11-01-2009, 09:07 AM   #30
Seebs
 
Posts: n/a
Default Re: How to convert Infix notation to postfix notation
On 2009-11-01, spinoza1111 <> wrote:
> Furthermore, the idea that computer languages are even distinct is
> absurd. That they are is a historical accident, caused by the large
> number of errors made in language design in the early days.


Hmm. You should hook up with Scott Nudds, I'm sure he'd appreciate your
insights into the merits of language design.

I don't think I find your argument persuasive. I do not think there exists
a universally ideal language design; in fact, it seems to me that
domain-specific languages are a compelling choice for many applications.

I view languages as tools. I expect to see a single unified language
about the time I expect to see a single unified woodworking tool, and
for about the same reasons.

> Insofar as "knowledge" of C is knowledge of mistakes,


Except you've never shown this. You've asserted that it fails to conform
to your expectations, and that you think this is a mistake, but you've not
exactly proven your point.

> C has no
> standing as an academic subject and should not be spoken of as a
> computer language. Instead, it should be considered a pathology which
> computer scientists must learn for the same reason doctors must learn
> cancer.


That's a whole lot of very pretty rhetoric, but again, you have to prove
your point before arguing further from it.

> People whose main claim to expertise in C should be sent to re-
> education camps on the model of UN centres in Africa which train
> former guerrillas in useful trades.


This isn't a sentence, but if it were, I'd bet it would be a stupid
one. You seem to have omitted a clause, though. Anyway, don't worry,
I'm almost certainly more famous for expertise in Bourne shell than
I am for expertise in C now. (And if you want to see a language which
is chock full of astounding mistakes, Bourne shell is a true marvel
of the art. It isn't used because it's an incredibly well-designed
language, but because it's extremely widely available and fairly
flexible, and we've learned how to overcome most of the weaknesses.)

> And the world still needs one programming language that can be used by
> everyone. The guy on the screen in the 1984 Apple commercial was
> right.


You know, it's a shame that we wasted thousands and thousands of years
of peoples' time researching computer science and language design when we
coulda just watched a superbowl ad and gotten the real answer.

Tell you what, just as a quick sanity check:

The one programming language that can be used by everyone:
* Should have a way to express explicit invocation of specific machine
instructions, yes/no?
* Should completely abstract away memory management so there's no such
things as pointers, yes/no?
* Should be designed for "intelligent" people rather than "autistic twerps",
yes/no?
* Should be accessible to people who are not particularly intelligent,
yes/no?
* Should compile directly to machine-specific instructions, yes/no?
* Should be interpreted dynamically and allow for the evaluation of
strings of text, yes/no?

I'm really looking forward to your answers.

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!


Seebs
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Rip DVD and Convert Video on Mac OS dave345 Media 12 07-07-2008 09:32 AM
Need help on Modelsim VHDL syntax? ASAP:) kaji General Help Related Topics 0 03-14-2007 10:43 PM
Need help on a Modelsim VHDL Syntax? ASAP:) kaji Software 0 03-14-2007 10:43 PM
Need Help on a Modelsim VHDL Syntax....ASAP:) kaji Hardware 0 03-14-2007 10:41 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46