[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Definition of Semantic: was What Lua can do that other programming languages can't do?
- From: Sean Conner <sean@...>
- Date: Wed, 27 Mar 2013 18:16:22 -0400
It was thus said that the Great Javier Guerra Giraldez once stated:
> On Wed, Mar 27, 2013 at 1:45 AM, Ross Bencina
> <rossb-lists@audiomulch.com> wrote:
> >
> >>> Attempts to go
> >>> beyond that fail in the same way silly ideas like the "semantic
> >>> web" nonsense of a few years back.
> >
> > I'm not sure where you're going here, but I think there is a need to
> > differentiate between the general field of semantics in human knowledge and
> > what is meant by "semantic" in programming languages theory (ie "semantic
> > analysis" etc) -- which just means how to the language symbols map to
> > machine operations or to the lambda calculus. This has nothing to do with
> > "human meaning"
>
> syntax and semantics come from linguistics. in human languages,
> there's syntax (this is a verb, this a noun, this a noun predicate,
> etc) and semantics ("running" and "jumping" are both physical
> activities, "to care" is an intransitive verb, "man", "woman" and
> "child" are all humans, etc)
A good example is this sentence:
Fruit flies like a banana, but time flies like an arrow.
Syntactically, there are four possible parsings for this sentence:
(1) Adj Noun Verb Art Noun , Conj Adj Noun Verb Art Noun
(2) Adj Noun Verb Art Noun , Conj Noun Verb Prep Art Noun
(3) Noun Verb Prep Art Noun , Conj Adj Noun Verb Art Noun
(4) Noun Verb Prep Art Noun , Conj Noun Verb Prep Art Noun
Semantically, only (2) is correct, unless you know of fruit that does,
indeed, fly, or a group of insects known as "time flies."
In Lua, you can have:
P(5) / function(c) return tonumber(c) end
Is syntactically correct, assuming P is defined and can be used in a
function call context. Semantically, it can mean different things depending
on how P and c are defined. Here, it means one thing:
function P(x) return 2 * x + 1 end
c = "0.5"
but it has a different meaning this way:
P = require "lpeg".P
-spc (Darn! My time flies got out again!)
- References:
- Re: What Lua can do that other programming languages can't do?, Steve Litt
- Re: What Lua can do that other programming languages can't do?, Jorge
- Re: What Lua can do that other programming languages can't do?, Steve Litt
- Definition of Semantic: was What Lua can do that other programming languages can't do?, Steve Litt
- Re: Definition of Semantic: was What Lua can do that other programming languages can't do?, Tim Hill
- Re: Definition of Semantic: was What Lua can do that other programming languages can't do?, Doug Currie
- Re: Definition of Semantic: was What Lua can do that other programming languages can't do?, Tim Hill
- Re: Definition of Semantic: was What Lua can do that other programming languages can't do?, Christian Bielert
- Re: Definition of Semantic: was What Lua can do that other programming languages can't do?, Ross Bencina
- Re: Definition of Semantic: was What Lua can do that other programming languages can't do?, Javier Guerra Giraldez