|
That's not quite what I want as those are binary, and I'm looking to do source level integration. It also cannot be entirely immutable/stateless
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.
|
|
|
|
|
Ah! I think what you're doing is a wee bit outside of my area of experience then
|
|
|
|
|
It's kind of the house that jack built. Currently to render my shared codebase (such as table tokenizing support) in a language independent manner I have to render the entire thing using the codedom, as expression trees won't give me source code, and can't define whole classes.
Here's what I'm doing now:
var result = CD.Struct("Token", false,
CD.Field(typeof(int), "Line", MemberAttributes.Public),
CD.Field(typeof(int), "Column", MemberAttributes.Public),
CD.Field(typeof(long), "Position", MemberAttributes.Public),
CD.Field(typeof(int), "SymbolId", MemberAttributes.Public),
CD.Field(typeof(string), "Value", MemberAttributes.Public));
result.CustomAttributes.Add(_GeneratedCodeAttribute);
return result;
in order to declare this:
public struct Token
{
public int Line;
public int Column;
public long Position;
public int SymbolId;
public string Value;
}
And never mind methods like this:
result.Statements.AddRange(new CodeStatement[] {
CD.If(CD.Invoke(input,"MoveNext"),
CD.IfElse(CD.NotEq(state,CD.Literal(_BeforeBegin)), new CodeStatement[] {
CD.Let(position,CD.Add(position,CD.One)),
CD.IfElse(CD.Eq(CD.Literal('\n'),current),new CodeStatement[] {
CD.Let(column,CD.One),
CD.Let(line,CD.Add(line,CD.One))
},
CD.IfElse(CD.Eq(CD.Literal('\t'),current),new CodeStatement[]
{
CD.Let(column,CD.Add(column,CD.Literal(_TabWidth)))
},
CD.Let(column,CD.Add(column,CD.One))))
},
CD.IfElse(CD.Eq(CD.Literal('\n'),current),new CodeStatement[] {
CD.Let(column,CD.One),
CD.Let(line,CD.Add(line,CD.One))
},
CD.If(CD.Eq(CD.Literal('\t'),current),
CD.Let(column,CD.Add(column,CD.Literal(_TabWidth-1))))
)
),
CD.Return(CD.True)),
CD.Let(state,CD.Literal(_InnerFinished)),
CD.Return(CD.False)
});
return result;
to declare this:
bool _MoveNextInput()
{
if (_input.MoveNext())
{
if (_BeforeBegin != _state)
{
++_position;
if ('\n' == _input.Current)
{
_column = 1;
++_line;
}
else if ('\t' == _input.Current)
_column += _TabWidth;
else
++_column;
} else
{
if ('\n' == _input.Current)
{
_column = 1;
++_line;
}
else if ('\t' == _input.Current)
_column += _TabWidth-1;
}
return true;
}
_state = _InnerFinished;
return false;
}
It's ridiculous, and I'd like to move away from it toward something more natural.
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.
|
|
|
|
|
Oof. From working with expression trees, I do know that static examples like that are usually the simplest, too. I can only imagine the monstrosity you'd have to write to support any method or struct
|
|
|
|
|
That's already abbreviated immensely.
normally you have to do like
var state = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(),"_state");
var letStateOne = new CodeAssignStatement(state,new CodePrimitiveExpression(1));
just to render
this._state=1;
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.
|
|
|
|
|
Quote: So I've decided to make my own programming language
I was pretty sure about that.
Good luck!
|
|
|
|
|
|
and I'm using Rolex for my lexing. Got it set up as a pre-build event in my new project and everything.
You baited me. I blame 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.
|
|
|
|
|
|
So obvious!
|
|
|
|
|
|
=/
It was either take it up again or stay home for thanksgiving as I wouldn't have been good company. So I smoked.
My hubby is disappointed. He'll survive.
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: He'll survive.
A bit longer.
|
|
|
|
|
Then you weren't ready yet - and you have to have your mind on side with this: if you aren't ready to give up, you won't. You'll find reasons - any reason - to give up giving up and go back to it.
So don't get discouraged: try again later. Perhaps join a support group - most US states have a helpline that can get you in touch with free ones. Just knowing you aren't the only one going through it can help.
But for 's sake: don't give up as a new year resolution. Those rarely last the week ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
#trueFacts
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.
|
|
|
|
|
I'm quite disappointed as well
But [insert encouraging words here].
So I just know you can do it
|
|
|
|
|
After scouring the internet even, I have to admit I have no code to control nicotine addiction.
I think I may have to cook something up in C++ for that.
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 our country, the tax(actually excise) is just phenomenal and raised twice a year by a fixed percentage.
A decade ago, 20 smokes would cost you about $10 or $11. These days, a cheaper, nastier pack of 20 costs about $24. At the same time, Chemist Warehouse has nicotine containing chewy, available in 4mg pellets, 200 of them for 30 bucks.
There's a way to stay human and avoid turning into Witchy-Poo (what a fun find!) every time the levels of the neurotransmitter impostor drop low enough.
Continuing to consume nicotine is good if you're interested in holding off Parkinson's or Alzeimher's. Smoking it might mean you don't last long enough for the positive effects in staving off degradation of the Substantia nigra to matter.
|
|
|
|
|
That's interesting. I didn't know that about nicotine. =)
And sheesh, I thought smokes here were taxed to death. They still cost less than half of what you pay there.
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.
|
|
|
|
|
I quit smoking cold turkey (no pun intended) back in 2017 (had been smoking since 9 years before that). Haven't gone back since.
Try that maybe it'll help. OTOH I've developed a taste for Coffee.
|
|
|
|
|
Quote: OTOH I've developed a taste for Coffee.
That is not bad! Coffee is good for you!
|
|
|
|
|
You just need the right incentive. For my brother, who was a two packs a day smoker, it was getting a heart attack.
Don't wait that long!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Many years ago when I quit, I found the worst were the first 3 or 4 days. By day 5 the urges were subsiding and becoming manageable. You may find that you really need willpower, but only for 4 days or so. Resolving to fight the urges for 4 days initially, may make it easier for you! Good luck! And: nicotine gum and patches did nothing for me. They are just an alternative source of the evil nicotine.
|
|
|
|
|
Yeah, I got derailed mostly because my will power is only so strong, and I didn't want to miss thanksgiving, but there's no way I was going to be able to be decent and mentally present while i was in withdrawal so I would have had to stay home, and I was really looking forward to it.
I didn't expect my smoking cessation device to run out when it did and the timing just couldn't be worse.
I quit before for 5 years so I totally agree with you though. It's just that I was on my 2nd day by the time thanksgiving got here and that wasn't going to fly. =/
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.
|
|
|
|
|
|