Click here to Skip to main content
14,421,109 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: I'm completely stumped. At least for now. Pin
Greg Utas6-Dec-19 5:51
professionalGreg Utas6-Dec-19 5:51 
GeneralRe: I'm completely stumped. At least for now. Pin
honey the codewitch6-Dec-19 5:56
mvahoney the codewitch6-Dec-19 5:56 
GeneralRe: I'm completely stumped. At least for now. Pin
Greg Utas6-Dec-19 6:17
professionalGreg Utas6-Dec-19 6:17 
GeneralRe: I'm completely stumped. At least for now. Pin
honey the codewitch6-Dec-19 6:33
mvahoney the codewitch6-Dec-19 6:33 
GeneralRe: I'm completely stumped. At least for now. Pin
Richard Andrew x646-Dec-19 10:51
professionalRichard Andrew x646-Dec-19 10:51 
GeneralRe: I'm completely stumped. At least for now. Pin
honey the codewitch6-Dec-19 13:06
mvahoney the codewitch6-Dec-19 13:06 
GeneralRe: I'm completely stumped. At least for now. Pin
englebart9-Dec-19 5:39
professionalenglebart9-Dec-19 5:39 
GeneralRe: I'm completely stumped. At least for now. Pin
honey the codewitch9-Dec-19 5:47
mvahoney the codewitch9-Dec-19 5:47 
I don't have control over the objects I'm manipulating and reflection is off the table.

I've reduced some of the switch casing by factoring it into a visitor over the codedom tree but such is the nature of the beast.

The whole point of this project is that the CodeDOM sucks to use, so I'm building a mini programming language on top of it that spits out the constructs for you.

So you don't need to code nasty bizness like this (even wrapped it's bad magic)

var varDecl = new CodeVariableDeclarationStatement(typeof(int),"i",new CodePrimitiveExpression(0));

just to render this:
int i = 0;


Even wrapped you end up with things like:
var varDecl = CD.Var(typeof(int),"i",CD.Literal(0));


Better, but still hard to read.

Slang is a subset of C#

it allows you to declare these constructs in C# so instead of the above you can do like:
var varDecl = SlangParser.ParseStatement("int i = 0;");

to create the same thing.
or even
var varDecl = SlangParser.ParseStatement("var i = 0;");

it will fill in the type because CodeDOM doesn't support var

and of course it can parse more than statements. It can parse groups of C# source files, statements, expressions, namespaces, types and members at the top level as well. Since it uses recursive descent instead of LL(k) it doesn't get confused by that.

Main issue right now is it's not complete and error handling in the parser stinks.

Edited: vardecls are statements, not expressions Laugh | :laugh: It's early in the day yet for me. not fully present yet.
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.

QuestionWhy use .NET technologies vs., say, Node? Pin
Marc Clifton6-Dec-19 4:03
communityengineerMarc Clifton6-Dec-19 4:03 
AnswerRe: Why use .NET technologies vs., say, Node? Pin
Pete O'Hanlon6-Dec-19 4:05
communityengineerPete O'Hanlon6-Dec-19 4:05 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
#realJSOP6-Dec-19 5:06
mva#realJSOP6-Dec-19 5:06 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Fernando A. Gomez F.9-Dec-19 9:43
MemberFernando A. Gomez F.9-Dec-19 9:43 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
#realJSOP9-Dec-19 11:34
mva#realJSOP9-Dec-19 11:34 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Dan Neely6-Dec-19 5:41
MemberDan Neely6-Dec-19 5:41 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Pete O'Hanlon6-Dec-19 6:18
communityengineerPete O'Hanlon6-Dec-19 6:18 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Dan Neely6-Dec-19 6:26
MemberDan Neely6-Dec-19 6:26 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Marc Clifton6-Dec-19 7:59
communityengineerMarc Clifton6-Dec-19 7:59 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Idaho Edokpayi11-Dec-19 9:03
MemberIdaho Edokpayi11-Dec-19 9:03 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Marc Clifton6-Dec-19 8:17
communityengineerMarc Clifton6-Dec-19 8:17 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Pete O'Hanlon8-Dec-19 21:39
communityengineerPete O'Hanlon8-Dec-19 21:39 
AnswerRe: Why use .NET technologies vs., say, Node? Pin
F-ES Sitecore6-Dec-19 4:15
mveF-ES Sitecore6-Dec-19 4:15 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
PIEBALDconsult6-Dec-19 4:21
professionalPIEBALDconsult6-Dec-19 4:21 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
harold aptroot6-Dec-19 4:22
Memberharold aptroot6-Dec-19 4:22 
AnswerRe: Why use .NET technologies vs., say, Node? Pin
PIEBALDconsult6-Dec-19 4:27
professionalPIEBALDconsult6-Dec-19 4:27 
AnswerRe: Why use .NET technologies vs., say, Node? Pin
Sander Rossel6-Dec-19 4:32
professionalSander Rossel6-Dec-19 4:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.