« first day (269 days earlier)      last day (4664 days later) » 

10:09 PM
Wow.
Wi-Fi-Hacking Neighbor From Hell Sentenced to 18 Years http://bit.ly/r7SL5J
 
@MartinhoFernandes thanks for trying, but no .edu or living in the us here :(
 
ok
now I'm looking for a parser-generator
 
I only know of one for Windows: ANTLR.
 
downloaded it, but it refused to paint the screen, so it was kinda hard to use a black screen
 
Not sure if you can use yacc on Windows.
 
10:18 PM
also, I'm converting my grammar from my own BNF-like-which-isn't-quite directly into EBNF, as Wikipedia says that it is
 
@DeadMG Sorry, paint the screen?
Last time I used it, it was a command-line tool.
 
nope, it has a nice GUI
that won't render
 
Hmm, the GUI looks cool. Has some nice analysis tools.
I wish I had that when I used it.
It's in Java. That might explain your problem.
Even without GUI, I highly recommend it.
 
hmmm
 
10:25 PM
attempting to open it crashed the display driver
 
but the GUI renders now
 
Seems like yacc and flex work on Windows.
But I prefer ANTLR.
Much more powerful.
And much less klunky syntax.
 
ok
it wants : instead of =, but close enough
how do I do not something in regex?
ANTLR won't accept my something-something names for rules
ah, it'd be faster to just add them back in
 
What do you mean by "do I do not something in regex?" I can't parse that sentence.
 
10:34 PM
what I wanted was - when not surrounded by quote arks
 
How do I avoid using regex
 
i.e., any use of - but not '-'
doesn't matter though, I used search-and-replace to skip the ones I didn't want
 
DeadMG, your language is not regular.... I can't parse the sentence about do do not something using regex, about not something doing in regex....... psst..... bwa-yeaow-waow.....
 
You broke @Xaade. Not that it was difficult.
 
I break him often
it's a habit of mine
hahaha
ANTLR has "Debug" and "Debug Again"
 
10:37 PM
ANTLR = part of deer.... not getting it....
 
"Yet another tool"...... another meme about meming...?
Yet another.... = did I make a better one? Not sure, you decide!
Woot.... I just put a MFC control derived from another MFC control in a separate DLL onto a C# window.
 
man
the dependency graph, it's a bit.. wtf
 
Mine is.....
 
Can I see it?
 
10:40 PM
I get a lot of linker warnings reminding me of diamond linking
Can't link X atom.... it's already there...
 
yo wtf
 
ZOMG.... it looks like a new oversight government authority..... webs to webs.
 
ANTLR only exported part of it?
 
That looks like a corner.
 
it is
I managed to convince it to export a slightly bigger corner
I'm just gonna take a screenshot
 
10:44 PM
lol
 
That looks like a car.
 
Now it looks like a hovercraft.
 
lol
 
Doesn't seem that weird.
 
10:46 PM
I like the bottom right corner, where things just start piling up and looping all over each other.
Ironically you also have SO Chat in your screenshot....
 
I can't get it to generate any code
 
Any errors?
 
@DeadMG I wonder why
 
it says
 
@DeadMG which way did he go george?
 
10:49 PM
error(10): internal error: : java.lang.Error: Error parsing C:\...\DeadMG.g: 'g' not expected 'grammar'
and stack trace
 
it parsed your filename?
 
Can you paste your grammar?
 
oh it's ok
I accidentally deleted a character or something from the auto-generated stuff
 
still won't generate though :(
 
10:51 PM
Hmmm
 
pointer_modifier : '*' ['const'] [array_modifier] [pointer_modifier];
apparently, I can't do that with const?
 
Is that the syntax for optional?
 
EBNF says it is and the others are accepted, like
PROGRAM :	 definitions;

definitions
	:	 definition [definitions];
 
It's foo? or (...)?.
It is not EBNF.
 
10:54 PM
yeah, I saw that ANTLR's grammar is not exactly EBNF
 
yeah, it rejected my other optionals too
time to change them..
ok
how the hell can I write a regex to convert? this is gonna take forever
 
Search for \[([^\]]+)\].
 
no, I can search for it with something like \[[.*]\], it's doing the replace that I can't do
 
Replace syntax varies a lot from engine to engine, but it's probably something like \1?.
You need the () in the search regex to capture the inside in a group.
 
10:59 PM
owch
it just replaced it with \1? directly, lol
 
Oops.
Oh, it's probably Java's syntax. Doh.
 
ok, it's generating
lol, just realized I left out ++ and --
 
And you still haven't fixed your expressions precedences.
 
I'll worry later
 
You're keeping both the pre- and postfix versions?
 
11:07 PM
I'll think about it later, I can ditch them at any time
OK, it complained that I couldn't do this because I had mutually left-recursive rules
 
Hmm, which ones?
 
I clicked the remove left recursion button, and tried to generate again, and it's come up with a box saying Error but the content is blank so I can't see the error
 
assignment-expression, member-expression, expression, variadic-expression, function-call-expression, access-expression, bitwise-expression, arithmetic-expression, boolean-expression
 
Hah.
I knew it.
 
11:09 PM
curiously, not cast expressions, or forward or decltype expressions
 
Because those are not left-recursive.
They can be disambiguated by their first token(s).
Say, if there's a static_cast keyword, it's for sure a static-cast-expression.
The recursion is on the right.
 
how could I possibly define more than one binary operator without left recursion?
 
1) Using only with right recursion 2) Giving them proper precedences.
 
how can you define a binary plus operator without expression on both sides of the plus?
 
1) is in this vein: add_expr : number '+' expr; times_expr : number '*' expr;.
 
11:12 PM
but both sides can be any expression
 
That can easily match 1 + 2 + 3 + 4 * 5 * 6* 7 + 8.
I think.
But parenthesis screw this up too much.
And you get no precedence and only right associativity.
Option number 2 looks like this: pastebin.com/23gS0REy
 
right
but that's still recursive, just indirectly
 
But the recursion is on the right.
 
hmm
I see that this is what the C grammar did
but is it genuinely flexible enough to allow for things like (expression + expression) = expression?
 
Yes.
Modulo any mistakes I made there, of course.
 
11:18 PM
right
it seems awful insane to do this
 
Hmm, it always seemed natural to me.
 
well
the syntax of the plus operator is expression '+' expression
expressing it as anything except that seems to be just strange to me
oh well
whatever will get a parser, I guess
 
if I change this, and it works, does that mean that my grammar isn't context-sensitive?
 
Not sure if being accepted by ANTLR it implies that.
 
11:26 PM
well
if it can't deal with left recursion, it probably can't handle context sensitivity
although I'm totally not seeing how this conversion is going to work
 
Semantic predicates! Yes, it can handle CSGs.
 
maybe I should just C&P the C grammar
this stuff's all the same subset anyways
 
It's easy. Each operator expression recurses on itself on the right, and on the left on an expression with higher precedence.
And recursing on itself is optional, so you can "skip" operators down the tree.
 
yes, I get how it works
 
Or the other way around.
 
11:31 PM
I don't really get how I transform my existing expression '+' expression into that
oooh, I get it- it's terminated by the unary expressions
I actually have a few totally wasted rules
like this_expression :P
anyway
 
That can probably be lumped together with identifier- and/or literal-expressions.
 
right now, I couldn't care less, it's a unary expression and that's that
the cast expressions can go in there too
no, wait, they don't take expressions as arguments
 
They don't?
 
well
actually, they completely do
 
static_cast<blah>(x + y)
 
11:35 PM
I just realized that I have a function-call rule, which is '(' expressions ')'
and in some other places, I wrote it out explicitly
oh yeah, I remember
the unary expressions like forward, decltype, and sizeof only ever take one argument
but the cast expressions can be static_cast(float, expression)
that's why they're defined with function-calls instead
I should just define them with two expressions and be done with it
 
It doesn't make much sense to have more.
 
well, if I have a fifth cast which can take more than two expressions, then I'll special-case it
right
now to try to eliminate left recursion
so
I would have something like (small example)
expression := assignment expression
assignment expression := (anything useful)? multiplication expression
multiplication expression := (anything useful)? unary expression
unary expression : '+' expression
 
Yeah. But those "anything useful" parts are really recursion into the same rule, I think.
 
so I could have
expression := assignment_expression
assignment_expression := (assignment_expression '=')? multiplication_expression
multiplication_expression := (multiplication_expression '*')? unary_expression
unary_expression := '+' expression
 
Yep. That's not mutually left-recursive.
 
11:45 PM
ok
huh
not sure wtf to do with variadic expression
or pre-fix increment
 
I think you want assignment to be the other way around (recurse into self on the right).
So that a = b = c = d parses as a = (b = (c = d)).
 
ok
still not sure wtf to do with prefix expressions like variadic expression, nor the access expression
I need to match the final ] if and only if the first [ was matched
 
Won't ('[' expression ']') do?
 
only if I'm recursing on the left again
hmm, the ANSI C grammar left-recurses into itself
 
Access should be far below (i.e. high precedence). access_expression ('[' expression ']')? seems fine.
 
11:53 PM
access_expression
	:	 access_expression ('[' arithmetic_expression ']')?;
left-recursive, according to ANTLR
 
Of course it is.
 
maybe because I haven't finished yet
gotta admit
did NOT expect actually writing the grammar to be this hard
 
Hmm, access seems really tricky.
I see your problem of matching [s now.
 
have a look at the ANSI C grammar
they seem to have solved it by defining skip as the first operation
ok
I think that I'll have the crappiest, wackiest precedence in the world, but once I fix the access expression, it just might work
oh, I forgot to actually add variadic expressions to anything
 
Just follow C's precedence rules. That's what everyone uses, and they are not crazy rules.
Well, PHP breaks ?:, but that's PHP.
 
11:59 PM
I'm going to
once it "compiles"
 

« first day (269 days earlier)      last day (4664 days later) »