Click here to Skip to main content
15,896,154 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 4:51
professionalGreg Utas6-Dec-19 4:51 
GeneralRe: I'm completely stumped. At least for now. Pin
honey the codewitch6-Dec-19 4:56
mvahoney the codewitch6-Dec-19 4:56 
GeneralRe: I'm completely stumped. At least for now. Pin
Greg Utas6-Dec-19 5:17
professionalGreg Utas6-Dec-19 5:17 
GeneralRe: I'm completely stumped. At least for now. Pin
honey the codewitch6-Dec-19 5:33
mvahoney the codewitch6-Dec-19 5:33 
GeneralRe: I'm completely stumped. At least for now. Pin
Richard Andrew x646-Dec-19 9:51
professionalRichard Andrew x646-Dec-19 9:51 
GeneralRe: I'm completely stumped. At least for now. Pin
honey the codewitch6-Dec-19 12:06
mvahoney the codewitch6-Dec-19 12:06 
GeneralRe: I'm completely stumped. At least for now. Pin
englebart9-Dec-19 4:39
professionalenglebart9-Dec-19 4:39 
GeneralRe: I'm completely stumped. At least for now. Pin
honey the codewitch9-Dec-19 4:47
mvahoney the codewitch9-Dec-19 4: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)

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

just to render this:
C#
int i = 0;


Even wrapped you end up with things like:
C#
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:
C#
var varDecl = SlangParser.ParseStatement("int i = 0;");

to create the same thing.
or even
C#
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 3:03
mvaMarc Clifton6-Dec-19 3:03 
AnswerRe: Why use .NET technologies vs., say, Node? Pin
Pete O'Hanlon6-Dec-19 3:05
mvePete O'Hanlon6-Dec-19 3:05 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
#realJSOP6-Dec-19 4:06
professional#realJSOP6-Dec-19 4:06 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Fernando A. Gomez F.9-Dec-19 8:43
Fernando A. Gomez F.9-Dec-19 8:43 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
#realJSOP9-Dec-19 10:34
professional#realJSOP9-Dec-19 10:34 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Dan Neely6-Dec-19 4:41
Dan Neely6-Dec-19 4:41 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Pete O'Hanlon6-Dec-19 5:18
mvePete O'Hanlon6-Dec-19 5:18 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Dan Neely6-Dec-19 5:26
Dan Neely6-Dec-19 5:26 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Marc Clifton6-Dec-19 6:59
mvaMarc Clifton6-Dec-19 6:59 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Idaho Edokpayi11-Dec-19 8:03
Idaho Edokpayi11-Dec-19 8:03 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Marc Clifton6-Dec-19 7:17
mvaMarc Clifton6-Dec-19 7:17 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
Pete O'Hanlon8-Dec-19 20:39
mvePete O'Hanlon8-Dec-19 20:39 
AnswerRe: Why use .NET technologies vs., say, Node? Pin
F-ES Sitecore6-Dec-19 3:15
professionalF-ES Sitecore6-Dec-19 3:15 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
PIEBALDconsult6-Dec-19 3:21
mvePIEBALDconsult6-Dec-19 3:21 
GeneralRe: Why use .NET technologies vs., say, Node? Pin
harold aptroot6-Dec-19 3:22
harold aptroot6-Dec-19 3:22 
AnswerRe: Why use .NET technologies vs., say, Node? Pin
PIEBALDconsult6-Dec-19 3:27
mvePIEBALDconsult6-Dec-19 3:27 
AnswerRe: Why use .NET technologies vs., say, Node? Pin
Sander Rossel6-Dec-19 3:32
professionalSander Rossel6-Dec-19 3: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.