C Parser in C# or generally .Net [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
For my diploma thesis I need to implement certain static C code analysis and I am desperately looking for a framework/library that would allow me to parse C source code, split it up into single functions, for every function determine what variables are changed in the function body and derive certain annotations for the code automatically.
Is there any good framework written in C# or generally as .Net class for this purpose?

What about googling for "C Parser written in C#"?
I got this as first link: http://code.google.com/p/cpp-ripper/
Also, I think the C grammar can be found in quite a lot of places, so you might just want to open up your .NET variant of lex/yacc and go from there?

You might like to check ANTLR. It comes with versions of several versions, included C and C#. There are some free grammars on ANTLR web site, including C.

I had a similiar problem and having done a research about YACC tools for C# I have chosen Gold Parsing System with Semantic Engine. My project was parsing SQL queries and generating logical query plans (from T-SQL grammar subset).
I really recommend it. Those 2 libraries make parsing stuff painless and allow to map grammar to the object model in your code. It feels very intuitive and made my project successful :) However, it may lack some advanced ANTLR features, so recognize your needs carefully.
Gold Project http://www.devincook.com/goldparser/
Semantic Engine Lib http://code.google.com/p/bsn-goldparser

If you're ok with using GPL'd code, you might want to take a look at the GCC source code. If you need to do it within .Net, you can always use p/invoke to call code from the GCC libraries.

Related

Using AMD APP SDK with C#? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have searched everywhere but couldn't find any definite information.
Are there any bindings or a support for using AMD APP SDK with C#?
I have seen that there is APARAPI for Java, does something similar exist for C#?
Main reason why I'm asking this is that I would like to try out HSA and hUMA features, but I don't want to waste time with C++.
Take a look at this option
GpuLinq It compiles LINQ code from C# or F# source to OpenCL. This isn't a generic C# API, but executes LINQ in parallel.,
From their Github Web page
"GpuLinq's main mission is to democratize GPGPU programming through LINQ. The main idea is that we represent the query as an Expression tree and after various transformations-optimizations we compile it into fast OpenCL kernel code. In addition we provide a very easy to work API without the need of messing with the details of the OpenCL API."
F# is a better fit for parallel programming on GPU's than C#, because is has parallel asynchronous patterns.
As of October 2014, HSA and hUMA are still very cutting edge. The Linux Kernel patch was in June 2014, Java support is coming in 2015, There may be problems with a C#/F# to OpenCL layered approach that are untested and untried with HSA. So trying to use a higher-level programming language may lead you to spend more time debugging infrastructure issues, than you would spend coding in C or C++.
I found this: OpenCL.net .NET bindings for OpenCL that are easy-to-use and true to the original API. There is no OOP abstraction, nor will there ever be. OpenCL.Net is meant to be small, fast (with as little explicit marshaling as possible) and .NET friendly at the same time.
https://www.nuget.org/packages/OpenCL.Net/

What is the fastest parser generator tool for C# output? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am looking for a parser generator tool which gives C# output and fairly fast. My objective is to parse JSON like text and create CLR object out of it. I used GOLD Parser engine for this but it turned out to be slow for my need. Can anyone please suggest me a good and fast parser generator tool which emits C# code? I heard about Irony and ANTLR but don't have experience with them. Do they generate considerably faster parser or is there any better options?
I think you should consider the GPLEX Scanner Generator.
This is the fastest one used in the case of lexical specifications that do not require backtracking, and do not have anchored pattern.
Else,
you can also go for the SLK Parser Generator ( It supports C,C++,Java,C# languages).
Also be in touch with this question.
It asks about improving th GOLD Parser that you have used : [Improve the GOLD Parser]
ANTLR is a LL parser which is less powerful than LR parsers interms of language acceptance. Please verify if your language of context in all possible cases fits in the LL specifications. Also there are some other things to consider like ambiguous grammar, context free or context sensitive grammar .etc... its better to evaluate first your needs with different parser types( LL(+),LR(+), CALR(+), LALR(+) ) available. + means 1 or more occurances of look ahead. After that select one parser generating tool of that parser type.
ANTLR is a LL(k) top-down parser.. good in some cases but not in others as we process recursively on left most derivation. Parsers like gold parser, Visual Parse++ ..etc are LR(k) parsers which are basically bottom-up parsers. with my research on evaluating different parsers we selected LR(k) parser (visual parse++ was good for us) which in general are faster in approach of generating parse tree.
to precise every parsing methodology has its specifications which work good or bad in different cases. We need to evaluate the best one for our language. Also performance of a parser works in two fold for every language you want to develop
1) parsing methodology wrt to the language you are developing.
2) parser generating tool used (tool might not be developed great in some cases)
hope it helps. let me know if i can help with any further information.
V M Rakesh
(rakesh.vm#gmail.com)
I can't speak to performance, but you could try GPLEX/GPPG
Why not use the build in JavaScriptSerializer class to deserialize JSON?
Generic deserialize method: http://msdn.microsoft.com/en-us/library/bb355316.aspx
JavascriptSerializer class: http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx
The latest version of JSON.NET is able to create dynamic CLR objects directly from JSON. Is that no alternative? Static typed de-/serialization is also possible of course.
JSON.NET

How to implement C# syntax to use with own platform? ECMA Standard [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I want to know, is this possible to use C# language syntax in own platform? I know that C# is ECMA standartized language. So how can it be implemented?
I know there are examples such as Mono & Unity3D who implemented C#.
So for example : One common class library (own, written in C) & C# as a programming language.
The problem is that I never did that before, so I am interested what should I read & where to start. Any other articles about implementing syntax will be good.
If you want to write a compiler for C#, the place to start is the Dragon Book, alongside a copy of the C# 4 spec. It's an awful lot of work though, and not for the faint of heart; you generally need years of experience to write a compiler for something as complicated as C#.
I recommend starting with a smaller language, maybe a trivial language like brainfuck, or looking at existing toy compilers.
imho there are a very few cases when you need to write your on parser / compiler etc.
I would do it in a different way.
First option would be to run .Net from your C application. You can for instance use Mono for that. Here is a description: http://www.mono-project.com/Embedding_Mono
The second option would be to use your c class library directly from C# applications. Check http://www.pinvoke.net/ for example on how to declare them.
One obvious option is to retarget the Mono AOT. This is how MonoTouch works, for example.
The hard route is to implement your own C# parser, compiler and a large part of its standard library.

Convert VB.NET code to C# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I have three projects written with VB.NET (2005) and have to convert them to C# code. (I know that i don't need to convert codes of .net languages at all). I have no time to rewrite them, need a tool or script to convert.
Note: they are console applications.
Reflector lets you inspect compiled assemblies in several different .Net languages. I've known people to cut and paste the output to convert between languages. Apparently it also has an export feature.
SharpDevelop can do this, but depending you your vb.net code a lot of manual work will remain.
http://converter.telerik.com/
Another option is using Carlos Aguilar's converter. Converts from VB.NET to C# and viceversa.
Experience shows me that different converters are better than others in certain areas so I'd recommend you to use more than one, if possible, and compare their output.
There is a cool .net code conveter tool available online here. Try this if it helps to you.
Free Online .Net Code Converter

Is there a .NET based CSS abstraction library? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I've been working on a really large project for almost 2 years and the client requirements keep changing. These changes, of course, effect everything and I would like to find a way to work with the CSS in a more dynamic fashion.
I assume I could get one of the ruby or python CSS DSLs running under ironRuby/Python but this client is very very particular about what software/frameworks are installed.
I have not found a CSS DSL where the base programming language is vb or c#.
reference:
http://sandbox.pocoo.org/clevercss/ and http://nubyonrails.com/articles/dynamic-css
Less CSS for .NET was recently released.
http://www.dotlesscss.org/
I am not sure about any publicly available products, but I have written an ASP.NET HttpHandler for .css files a few times. Its a pretty simple task, and I usually add things like variable and basic expression support, realtime minification, comment stripping, etc. Is this what your looking for? If so, I think each time its taken maybe 10 hours of work max to write, debug, and implement the handler...not too bad given all the benefits.
You could also write your own DSL, using either the DSL Toolkit that's part of the Visual Studio SDK, or using Oslo. In the former case, the result could be .css files plus whatever else you needed, including API code for your ASP.NET application to call upon.

Categories