|
James, for just $15 an hour, and moderate encouragement, will write you a backtracking recursive descent parser suitable for parsing a modern programming language for less than the cost of using a parser generator tool that cannot parse such languages anyway.
James requires downtime for sleep, recreation, and "family"
Even still, James' parser deliverable will be about the same in terms of scheduling as if you were using a generator tool and refining a grammar input spec.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: James, for just $15 an hour, and moderate encouragement
Define "moderate encouragement".
(Don't you just love those marketing terms?)
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Tell him he's doing a good job. Maybe give him a gold star or a beer and pizza friday or something once in awhile.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
what! all carrots and no stick?
oh wait... OHS probably wouldn't like that.
does he have any relatives in china or india? human rights are only for sissies.
this internet has become nothing but fake news.
... time to fix it, time to get back to the fax!
|
|
|
|
|
If it was outsourced I'd make the team develop the LALR(1) tables by hand.
(parsing geek humor - forgive me)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
In order to implement these operators internally requires the creation of a variable to hold an intermediary result.
i=i+1
versus
var iPrev = i;
i=i+1;
This is murder to implement in an expression parser.
All for what? So some clowns can use a less efficient version of an increment/decrement operator?
is ++<target> really so much worse that <target>++?
In fact, whoever decided on having both? I'd like to have a long conversation with them.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Sometimes you need i++ and sometimes you need ++i. That's why you have them both, and I don't see it as less efficient.
|
|
|
|
|
Since postfix requires an internal copy it is ever so slightly less efficient unless there's no way you could have avoided that copy anyway. However, most of the time, you could have.
see also for(var i = 0;i < arr.Length; ++i)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
But if you need the postfix there is no way around that, you are dealing with two separate values....the initial value and the return value. With prefix the only thing that matters is the return value. You are talking as if they do the same thing only if you choose one it is less efficient, but they don't, they do different things so have different implementations.
|
|
|
|
|
I tried to make it clear that if you need it you need it, just that most of the time when people use it, as I've seen is in for loops, where they don't need it.
(I make one exception partly out of laziness and partly because of special knowledge of microsoft's jit compiler)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Most of the times I see people use "int" they could be using "System.Int32". But they don't. People are funny like that
|
|
|
|
|
that makes no difference in the generated code though, nor the spec as C# int is spec'd to System.Int32, not variable like in C and C++ IIRC
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: that makes no difference in the generated code though,
Neither does i++ vs ++i, that's my point Some of these things are just convenient syntactic sugar, but people use them because it makes code simpler.
|
|
|
|
|
Maybe because int will always be int , whereas some nefarious little sod could create their own version of System.Int32 to prank you, and all you'd get would be a compiler warning?
static void Main()
{
System.Int32 result = 42;
}
...
namespace System
{
public readonly struct Int32
{
public static implicit operator Int32(int value) => throw new InvalidOperationException("Surprise!");
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
true.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
The generated code tends to be much simpler.
|
|
|
|
|
Yeah. Especially given the CodeDOM itself is so sparse.
My C# subset is about as simple as the codedom. a lot of non essential C# constructs like switch are gone.
In fact, there are only 3 things not in the codedom that i simulate for you in Slang - a while loop, the ! operator, and the != operator.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Yes, if you look at the IL for i++ vs ++i it's largely a re-ordering of when the pop happens.
|
|
|
|
|
I have not looked at IL much but I know it is a simple operation in assembler.
|
|
|
|
|
I don't think you ever NEED them!
All can ultimately be solved using regular + 1 and - 1
|
|
|
|
|
Your fingers must hate you.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
It seems you're writing a lot more code than I do, and my code is being used...
|
|
|
|
|
But does your code make you happy? Henggh?
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Life is a dark, meaningless void.
We're thrust upon this coincidental floating space rock to live a meaningless life before we inevitably return to dust.
The question you should be asking me is if anything makes me happy at this point.
The answer is a resounding yes: bothering you about your single line if statements
|
|
|
|
|
I'm glad to have brought some small measure of joy to your bleak, dreary existence.
Have you considered writing poetry? How about other forms of self harm?
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|