|
|
it's not that chic though. It's kind of stodgy as languages go these days, but it's wicked nice for code generation.
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.
|
|
|
|
|
Really sorry to see you going in this direction.
You should know enough now to target the processor, not add another fancy layer.
Do what you're targeting in C/asm and damn the codedom.
T
|
|
|
|
|
I'm not making a traditional programming language.
Think of this as a templating tool for building abstract syntax trees.
It is never evaluated/interpreted, nor is it intended to create binary code.
The whole entire point of it is because this sucks:
var c = new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(),"_state"),new CodePrimitiveExpression(1));
All this does is save typing. It's a parser that creates those trees.
So you can just type
var c = Slang.Parse("this._state = 1;");
and create exactly the same tree.
This has nothing to do with a normal programming language. It's a templating language for language neutral code generation.
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: This has nothing to do with a ... programming language
Ok - then why are you focusing on .net?
|
|
|
|
|
because the CodeDOM ast doesn't exist for non .NET languages.
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.
|
|
|
|
|
Doms are ok - but with content. Just seems to me you could be applying your talents better. Genetics maybe.
|
|
|
|
|
LOL, I didn't make this AST - microsoft did. I'm just making it less burdensome to use.
The AST is used by .NET language providers such that when you make a .NET language, you also provide a renderer that can turn code dom code into code for that language.
Since all the base class libraries are the same across languages, that makes the code work in any language.
This is useful when creating things like "end user" dev tools that work for any .NET language the developer chooses, or even backend stuff on large projects where people may be working in more than one language.
I use it also because static linking isn't readily available in .NET without hacking the life out of it, so if i have something where i can create code-dom ready source then that stuff can be included at the source level, even in VB projects and such.
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 but I'm just saying that .NET is the Devil's spa... oh - wait a minute... you're a... erk!
|
|
|
|
|
I have a C++ background but I like C# plenty. It's great as GC'd "managed" code goes.
I'd like Java if it was designed better and was more byte order agnostic though.
It will never be C++, and when using it I often find myself missing this or that feature, typically where templates and related are concerned.
But C++ is *expensive* to code in, no matter how good you are. I don't have testers working for me. I don't have a salary I'm drawing for this stuff and there's only so much time I want to spend on any given submission. I may or may not submit C++ stuff, but I don't code a lot in C++ lately because I've been working on some compsci stuff that's already well solved in the C++ world with source code everywhere.
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.
|
|
|
|
|
Will it supports #define #undef #include ?!
|
|
|
|
|
Not exactly. There's no language independent way to do a preprocessor like that.
On the other hand, have you heard of T4 templating?
class foo {
<# foreach(var member in members) {
...
}
#>
}
basically, you can use ASP like context switches with T4 to render the code dynamically.
Sure you could do that with C# too, but it won't generate language agnostic code.
With slang (what i've decided to call it) it will. Ergo, your code generation routines (or more to the point, mine ) don't have to do nasty code dom manipulation. They can just run a template.
I'll be including builtin T4/asp context switching. It's painless to implement and microsofts is annoying.
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 will have let you know that I did T4 templates that did whole project analysis using VS CodeDom!
Can't remember what it was for, haha, but here you go!
|
|
|
|
|
oh the one visual studio exposes is way better than the one they give you. But you can't use it outside of the visual studio design and debug sessions, or without an alternate suitable host.
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.
|
|
|
|
|
Adding, so you know what text templating is. You know you can use it to mess with generating any type of file.
All I've done is made a subset of C# parseable into the CodeDom.
So you do like
CodeExpression expr = Slang.ParseExpression("\"HelloWorld\".ToString()\"");
CodeCompileUnit ccu = Slang.ParseCompileUnit(myEntireSourceCodeFileAsAString);
The tricky thing is I have to visit the tree afterward to "fix it up"
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 far.. I am curious to see what concrete problem you plan to solve with that....
As it is it looks cool but a little vague!
I wonder though, are we on the cusp of a new fast reflection implementation?! Or easy Emit?
|
|
|
|
|
It's not a better emit, but it's more flexible than emit in that it allows to generate code in a high level language rather an IL. Also because it's codegen you can use it to get rid of your reflection. you can just dynamically compile it if you need 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.
|
|
|
|
|
My concrete use case is using slang as the code language for my parser's grammar files so that the grammars can have code in them and still be language independent.
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.
|
|
|
|
|
Ooo.. looks interesting!
|
|
|
|
|
We'll see. I've got a number of problems (not bugs, but design challenges) that aren't so easy to fix. I just made a codedom visitor that might help but we'll see how far i get
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 assumed many of you wouldn't, but there are some other american coders hereabout, I'm sure.
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: I assumed many of you wouldn't, but there are some other american coders hereabout, I'm sure. Pretty sure there's American coders in Europe as well; they celebrate, as does the American Embassy. Shops are, ofc, trying to import "Black Friday".
Best wishes are always welcome, even if it's not celebrated. The new year is always later for the Chinese.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: Shops are, ofc, trying to import "Black Friday".
... except without the huge savings.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
They advertise with huge savings, but that's also true for Sinterklaas and Christmas. I see it as an extra tax for those who can't count or believe it
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|