code logs -> 2008 -> Wed, 12 Mar 2008< code.20080311.log - code.20080313.log >
--- Log opened Wed Mar 12 00:00:34 2008
00:12 You're now known as TheWatcher[T-2]
00:17 You're now known as TheWatcher[zZzZ]
01:25 Vornicus [~vorn@ServicesOp.Nightstar.Net] has quit [Ping Timeout]
01:26 Vornotron [~vorn@Admin.Nightstar.Net] has joined #code
02:42
<@ToxicFrog>
Moltare: if it's accepting, say, 1=3, and it shouldn't, then this is a problem with the parse stage that should be fixed
02:52 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?]
04:23
< C_tiger>
On the other hand, if it's accepting foo = (bar = 5) ... that's legal in some languages.
04:24
<@ToxicFrog>
More generally, my point is "if it's accepting things it shouldn't, this is a flaw in either your parser, or your formalization of the language grammar you used to construct the parser"
04:25
< C_tiger>
I'm never sure what the difference between parse and compile is.
04:25
<@ToxicFrog>
A parser takes a stream of tokens and turns them into an abstract representation of a program (or some other data, such as an XML tree)
04:26
<@ToxicFrog>
A compiler typically contains a parser.
04:26
< C_tiger>
Ok, but it does some of the substitution that happens at "compile time" like global replacement.
04:26
<@ToxicFrog>
It first lexes the code (turning a character stream into a token stream); then parses the token stream; and then uses a code generator on the intermediate representation to generate object code or bytecode.
04:27
<@ToxicFrog>
Not necessarily.
04:27
<@ToxicFrog>
C's #define, for example, happens during the first of two lex stages (the preprocessor)
04:27
< C_tiger>
Ah, right preprocess.
04:27
<@ToxicFrog>
Likewise #include.
04:28
<@ToxicFrog>
The resulting modified source then goes through a normal lex-parse-generate sequence.
04:28
< C_tiger>
I forgot about CPP.
04:29
<@ToxicFrog>
As a general rule, "parsing" is "the process of turning a linear stream of tokens into some useful data representation"
04:29
<@ToxicFrog>
In the case of compilers, this typically means turning tokenized source code into an abstract syntax tree.
04:29
< C_tiger>
Right, and compiling is turning the tree into?
04:29
<@ToxicFrog>
You missed what I said earlier.
04:29
<@ToxicFrog>
Compiling includes parsing.
04:30
< C_tiger>
Right.
04:30
<@ToxicFrog>
Compiling is turning source code into machine code.
04:30
< C_tiger>
Ok, that's why I was confused.
04:30
<@ToxicFrog>
Typically, this means lexing it, then parsing it, then doing code generation, although this isn't always the case.
04:30
<@ToxicFrog>
So a compiler will usually include as one of its subsystems a parser.
04:30
< C_tiger>
Right.
04:32
< C_tiger>
Man how did people write useful code with punchcards?
04:34
<@ToxicFrog>
Hand-assembling, basically.
04:34
<@ToxicFrog>
Write out the program in mnemonics, then translate into binary by hand.
04:35
< C_tiger>
creepy
04:37
<@ToxicFrog>
(concerning the stages of compiling: for a language where a lexer isn't necessary, see any of the one-character-per-instruction languages like n'funge or brainfuck; for one with no parser, see postscript; for one with no code generation, see ruby, which executes by walking the AST directly)
04:38
< C_tiger>
postscript is a language?
04:38
< C_tiger>
Ok, that came out sounding more stupid than it should have.
04:38
<@ToxicFrog>
Yes. What did you think it was?
04:38
< C_tiger>
I dunno something like HTML.
04:38
<@ToxicFrog>
Aah.
04:38
<@ToxicFrog>
No, it's a fully featured, stack-oriented, interpreted language.
04:39
<@ToxicFrog>
Page drawing and suchlike is done with function calls rather than declarative data.
04:39
<@ToxicFrog>
Makes a handy calculator.
04:39
< C_tiger>
Wow.
04:39
< C_tiger>
Cool.
04:40
< C_tiger>
Ok, I need bed... but I had a creepy thought.
04:40
< C_tiger>
so I'll have to muse it.
04:40
<@ToxicFrog>
Oh
04:40
<@ToxicFrog>
?
04:41
< C_tiger>
Pretend DNA is the super binary and data is life. (All valid assumptions)
04:41 Vornotron [~vorn@Admin.Nightstar.Net] has quit [Ping Timeout]
04:41
<@ToxicFrog>
DNA is quadary, actually
04:41
< C_tiger>
I know.
04:41
< C_tiger>
I'm not a biologist for nothing.
04:42
< C_tiger>
But I'm drawing an analogy.
04:42
< C_tiger>
so I'm analogizing the bases to binary encoding.
04:43
< C_tiger>
Then machine code WAS assembled by hand... (evidence for God?) but he got lazy and wrote a program that wrote more code.
04:43
< C_tiger>
So we extend upwards to have higher evolved languages.
04:43
< C_tiger>
*more highly*
04:44
< C_tiger>
I need sleep.
04:44
< C_tiger>
It's creepy parallel even if I'm too tired to explain it.
04:46
< C_tiger>
So you can extend it both ways: Either it's evidence for the existence of God and we're all just built as self-replicating code writers and compilers. OR eventually, code will evolve to the point where it writes itself and builds its own form of self-aware code-life.
04:46
< C_tiger>
Or something like that.
04:47
< C_tiger>
All this comes from translating your discussion of the parts of a compiler into terms I know.
04:49
< C_tiger>
So a lexer = RNA synthetase, parser = spliceosome, code generation = ribosome.
04:49
< C_tiger>
RNA polymerase.
04:49
< C_tiger>
I was thinking tRNA syntetase.
04:49
< C_tiger>
ugh, sleep.
04:50 GeekSoldier|bed is now known as GeekSoldier|work
06:29 Thaqui [~Thaqui@222.154.187.ns-2601] has joined #code
06:29 mode/#code [+o Thaqui] by ChanServ
06:35 AnnoDomini [AnnoDomini@83.21.31.ns-26029] has joined #Code
06:35 mode/#code [+o AnnoDomini] by ChanServ
07:59 GeekSoldier|work [~Rob@Nightstar-9987.dip.t-dialin.net] has quit [Ping Timeout]
08:39 You're now known as TheWatcher
10:22 Thaqui [~Thaqui@222.154.187.ns-2601] has left #code [Leaving]
11:11 Vornucopia [~vorn@Admin.Nightstar.Net] has joined #code
11:12 Vornucopia is now known as Vornicus
11:13 Vornicus is now known as NSGuest-5514
11:30 AnnoDomini [AnnoDomini@83.21.31.ns-26029] has quit [Ping Timeout]
11:37 AnnoDomini [AnnoDomini@83.21.42.ns-2659] has joined #Code
11:37 mode/#code [+o AnnoDomini] by ChanServ
11:55 NSGuest-5514 is now known as Vornicus
12:18 AnnoDomini [AnnoDomini@83.21.42.ns-2659] has quit [Ping Timeout]
12:25 AnnoDomini [AnnoDomini@83.21.45.ns-4389] has joined #Code
12:25 mode/#code [+o AnnoDomini] by ChanServ
12:42 ALPAY-ist [~KELEBEK@78.188.112.ns-21870] has joined #Code
12:45 ALPAY-ist [~KELEBEK@78.188.112.ns-21870] has quit [Ping Timeout]
13:38 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
13:38 mode/#code [+o gnolam] by ChanServ
13:47 * ToxicFrog eyes python
13:47
<@ToxicFrog>
>>> 4e-7
13:47
<@ToxicFrog>
3.9999999999999998e-07
13:47
< C_tiger>
snerk.
13:48
< Vornicus>
Yeah, meet doubles.
13:51
<@ToxicFrog>
Vornicus: AFAIK, doubles are capable of exactly representing that number, and postscript and lua have no problems with it
13:51
<@ToxicFrog>
I don't know what Python is using, but it's not doubles.
13:55
< Vornicus>
4e-7 is... ...no, I don't think it is exact.
13:55
<@ToxicFrog>
For that matter, even if I make it e-1:
13:55
<@ToxicFrog>
> =0.4
13:55
<@ToxicFrog>
0.4
13:56
<@ToxicFrog>
GS>0.4 =
13:56
<@ToxicFrog>
0.4
13:56
<@ToxicFrog>
>>> 0.4
13:56
<@ToxicFrog>
0.40000000000000002
13:56
< Vornicus>
I /know/ that number isn't exact.
13:57
<@ToxicFrog>
...hmm. It's not exact in gs, either, if you get it to actually display all the digits.
13:57
<@ToxicFrog>
ANAICT it's still exact in lua, though. Odd.
14:00 * Vornicus tries to remember the exact gyrations you need to do subtraction in decimal.
14:00
< C_tiger>
There's a perl module for working with fractions.
14:01
<@McMartin>
0.4 is not exactly representable in binary.
14:01
<@McMartin>
Lua's default double formatting is different.
14:01
<@McMartin>
And dividing or multiplying by some power of ten won't change this
14:02
< Vornicus>
Well, 4 is
14:02
< Vornicus>
but dividing by a power of ten I don't think /ever/ turns a number from unrepresentable to representable
14:02 * Vornicus examines. Yeah, that's easily proven.
14:02
<@ToxicFrog>
Hmm. Weird.
14:03
<@ToxicFrog>
In Lua, 0.4e+N results in 4e+(N-1) exactly.
14:03
<@McMartin>
Any fraction in which the denominator is not a power of 2 is a repeating binary fraction.
14:03
<@McMartin>
Yeah, its printer is rounding.
14:03
<@ToxicFrog>
And it prints as "0.4"
14:04
<@ToxicFrog>
However, if I actually do %.20f, 0.4 I do see the wobble at the end.
14:04
<@McMartin>
You're seeing a difference in the format.
14:04
<@ToxicFrog>
Aah, yes
14:04
<@ToxicFrog>
Classtime
14:04
<@McMartin>
It's rounding the wobble away by default
14:05 * Vornicus fiddles, decides the right answer is to get the Knuth and the "represent a number in a base, for non-integers" algorithm.
15:15 Moltare [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has quit [Ping Timeout]
15:22 Moltare [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has joined #code
15:22 mode/#code [+o Moltare] by ChanServ
16:21 Moltare [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has quit [Quit: Twisted, yes, but strangely fluffy.]
16:58 GeekSoldier|work [~Rob@Nightstar-9620.dip.t-dialin.net] has joined #code
17:01 GeekSoldier|work is now known as GeekSoldier
17:06 You're now known as TheWatcher[afk]
18:32 You're now known as TheWatcher
19:39 * Chalain prods ToxicFrog.
19:39
<@ToxicFrog>
Yers?
19:39
<@Chalain>
Or any Ludd^H^Haite around.
19:40
<@Chalain>
I'm up to my elbows in the guts of mysql-proxy, which is scripted with Lua
19:40
<@Chalain>
And I can't remember how to do a foreach on a table with non-numeric keys.
19:41
<@Chalain>
I just looked it up on the Lua reference site and remembered that a) I tried that years ago, b) it didn't work (i.e. I did not learn how to do it) and c) that I found out later that it WAS possible, so rather than decide it isn't possible, I figured
19:41
<@Chalain>
I'd ask. :-)
19:43
<@ToxicFrog>
pairs()
19:44
<@ToxicFrog>
Assuming this is lua 5.x
19:44
<@Chalain>
It is.
19:44
<@ToxicFrog>
for key,value in pairs(table) do ... end
19:44
<@Chalain>
bless you.
19:45
<@ToxicFrog>
(and for future reference: the generic for loop itself is covered in 2.4.5, and pairs() itself, in 5.1 with the rest of the luastdlib functions)
19:45
<@ToxicFrog>
(of the manual, that is)
19:46
<@ToxicFrog>
Depending on Lua version you may also have a map() or table.map(); if not, you can easily write your own, should it be useful.
19:46
<@Chalain>
Oka, um.
19:46
<@Chalain>
http://www.lua.org/manual/5.1/manual.html#2.4.5 <-- "pairs" not found.
19:46
<@Chalain>
Am I looking at the wrong manual?
19:47
<@ToxicFrog>
2.4.5 is the for loop control structure
19:47
<@Chalain>
s/Am I (.*)\?$/Have I been $1 all this time?!?/
19:47
<@ToxicFrog>
It doesn't cover pre-built iterators for use with it, as those are part of the standard library, not the language grammar
19:48
<@ToxicFrog>
And thus, as I said, are covered in chapter 5
19:49
<@ToxicFrog>
"pairs (t)
19:49
<@ToxicFrog>
Returns three values: the next function, the table t, and nil, so that the construction
19:49
<@ToxicFrog>
for k,v in pairs(t) do body end
19:49
<@ToxicFrog>
will iterate over all key?value pairs of table t.
19:49
<@ToxicFrog>
See function next for the caveats of modifying the table during its traversal."
19:49 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout]
19:49
<@Chalain>
Ah, there we go.
19:49
<@Chalain>
So basically the problem is Chalain can't read.
19:49
<@Chalain>
I can deal with this.
19:49 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
19:49 mode/#code [+o gnolam] by ChanServ
19:49
<@Chalain>
Lord knows I've practiced for it enough.
19:49
<@Chalain>
Thanks!
19:58
<@ToxicFrog>
You're welcome.
20:08
<@jerith>
Ooh, we have a Chalain here.
20:18 GeekSoldier is now known as GeekSoldier|bed
20:40 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout]
20:46 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
20:46 mode/#code [+o gnolam] by ChanServ
22:07 AnnoDomini [AnnoDomini@83.21.45.ns-4389] has quit [Quit: Gnothi seauton, malákas.]
22:53 AFKSkull [~none@Nightstar-7066.dyn.optonline.net] has joined #code
22:53
< AFKSkull>
Hello, folks.
22:53 AFKSkull is now known as ASCIISkull
22:56
< ASCIISkull>
I don't suppose anyone here knows enough about .net clickonce installations as to be ble to figure out, from a manifest, how to actually install the damn program?
--- Log closed Thu Mar 13 00:00:44 2008
code logs -> 2008 -> Wed, 12 Mar 2008< code.20080311.log - code.20080313.log >