1 / 9

Two Views of Computing

Two Views of Computing. Language / Functions. CSCI 313. CSCI 312. Machine / Storage. Natural Languages vs. Programming Languages. NL's are semantically ambiguous: The spring was hot. NL's are syntactically ambiguous: tall men and women Can lead to embarrassment.

becka
Download Presentation

Two Views of Computing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Two Views of Computing Language / Functions CSCI 313 CSCI 312 Machine / Storage

  2. Natural Languages vs. Programming Languages • NL's are semantically ambiguous:The spring was hot. • NL's are syntactically ambiguous:tall men and women • Can lead to embarrassment...

  3. “Actual” Headlines ENRAGED COW INJURES FARMER WITH AX DRUNK GETS NINE MONTHS IN VIOLIN CASE IRAQI HEAD SEEKS ARMS 2 SISTERS REUNITED AFTER 18 YEARS IN CHECKOUT COUNTER BRITISH LEFT WAFFLES ON FALKLAND ISLANDS STUDENTS HEAR REPTILE LECTURE EYE DROPS OFF SHELF SQUAD HELPS DOG BITE VICTIM MINERS REFUSE TO WORK AFTER DEATH JUVENILE COURT TO TRY SHOOTING DEFENDANT STOLEN PAINTING FOUND BY TREE DEAD CATS PROTEST ACTOR SENT TO JAIL FOR NOT FINISHING SENTENCE

  4. Poetic Puns I met a traveller from an antique land Who said: Two vast and trunkless legs of stone Stand in the desert. Near them on the sand, Half sunk, a shatter'd visage lies, whose frown And wrinkled lip and sneer of cold command Tell that its sculptor well those passions read Which yet survive, stamp'd on these lifeless things, The hand that mock'd them and the heart that fed. And on the pedestal these words appear: "My name is Ozymandias, king of kings: Look on my works, ye mighty, and despair!" Nothing beside remains: round the decay Of that colossal wreck, boundless and bare, The lone and level sands stretch far away.

  5. Poetic Puns I met a traveller from an antique land Who said: Two vast and trunkless legs of stone Stand in the desert. Near them on the sand, Half sunk, a shatter'd visage lies, whose frown And wrinkled lip and sneer of cold command Tell that its sculptor well those passions read Which yet survive, stamp'd on these lifeless things, The hand that mock'd them and the heart that fed. And on the pedestal these words appear: "My name is Ozymandias, king of kings: Look on my works, ye mighty, and despair!" Nothing beside remains: round the decay Of that colossal wreck, boundless and bare, The lone and level sands stretch far away. - P. B. Shelley

  6. Programming Languages • PLs avoid semantic ambiguity through denotational semantics : explicit rules relating each token (word) to its meaning in context. • PLs avoid syntactic ambiguity through • Conventions (order of operations) • Required indentation (Python) • Explicit bracketing (Java, C++): good style doesn’t rely on the conventions!

  7. BAD STYLE a = b / c / d; if (a > b) c = a; if (x < y) c = b; else c = a;

  8. GOOD STYLE a = (b / c) / d; if (a > b) { c = a; } if (x < y) { c = b; } else { c = a; }

  9. NL vs. PL: Summary • All NL's are equally good for most things that people want to talk about (but cf. Sapir/Whorf Hypothesis) • PL's are designed with specific purposes in mind: expressiveness. One PL may be better than another, for a particular application. • An educated person should know more than one language.

More Related