How to access identifiers used in C program using AST.
I am new to eclipse plugin development and trying to customize eclipse plug-in to ensure that the variable name, function name, structure or whatever the programmer declares should not contain some specific set of words.
Please let me know some good CDT AST guide with examples. Thank you!
Over two weeks with zero responses. Looks like you are not going to get an answer.
I don't know how to help with CDT.
Our DMS Software Reengineering Toolkit with is C Front End parses C, builds ASTs and full C symbol table for a variety of dialects of C. Given this, it is rather easy to enumerate the C symbol table entries, and run an arbitrary predicate on names to see if they violate your conventions.
Related
I need help or refernece about this.
I am working on MF language called Natural it is used in ADABAS MF. The tools we have right now to program are premitve. I like to know if there is somting similar to this language as an extention in VS CODE for formating, linting etc. I know there is somting for COBOL (older language) but i can't find nothing.
Natual code look like this:
DEFINE DATA LOCAL
01 EMPLOYEES VIEW OF EMPLOYEES
02 SALARY (1)
END-DEFINE
READ EMPLOYEES BY NAME
AT END OF DATA
DISPLAY
MIN (EMPLOYEES.SALARY(1)) (EM=ZZZ,ZZZ,ZZ9)
AVER(EMPLOYEES.SALARY(1)) (EM=ZZZ,ZZZ,ZZ9)
MAX (EMPLOYEES.SALARY(1)) (EM=ZZZ,ZZZ,ZZ9)
END-ENDDATA
END-READ
END
Or
* Hello World in NATURAL
WRITE 'Hello World!'
END
First of all, it’s been years since I worked with Natural/ADABAS. If you’re working on the mainframe then I believe you are confined to the environment running in the TP monitor (CICS or Com-plete). The natural editor stores the source and compiles the IL into a special table in ADABAS know as the FUSER (a really hope all this is still applicable). The runtime (either batch or online) loads programs from this table and executes them.
I would do some online research and/or call the local sales office and ask to speak to a software systems engineer to get the most recent data.
No, there is no Visual Studio extension, but the modern way of manipulating and testing Natural code is called Natural ONE which is an Eclipse based IDE and gives you code formatting (from the green screen program editor there is a STRUCT command for this, btw), interface to VCS and much, much more.
ctags is a simple source code tagging system, also integrated in vi (and its flavours nvi, vim, etc.). AFAIK, it builds a plain text file where all the elements (functions, macros, ...) of the source code are indexed. But this file may become too large and unmanageable when the source code tree is extremely huge: this is the case of a kernel (Linux, *BSD, or similar).
Is still ctags or exuberant-ctags suitable for a complex source tree like a kernel?
If not, what tools (with the same integration in vi as ctags) can replace it? This may become subjective, so if possible provide a list of suggested tools: any comments, and references to a guide with the keyboard shortcuts in vi, are welcome.
Supported languages should be at least C, C++, assembly. The tool should be usable through CLI. I would principally like to jump to the definition of functions, macros, struct and similar objects (with ctags, pressing Ctrl+] with the cursor over the item name), to their manpages if possible, and back to the code.
The only alternative tool I know so far is GNU global, with a pretty complex vi integration, which seems to be possible only through Perl (and I can't find the equivalent of Ctrl+]).
The answer to your first point is a resounding yes.
You can use ctags to generate a tags file for different subtrees, thus keeping the size of the generated file to a minimum. At this point, you need to have a mechanism in place for searching for these multiple tags files. Vim provides this, of course.
I have given some advice here, so you may want to check that out.
Of course, I use exuberant-ctags there, so keep that in mind.
Can someone help me on porting a game written in BlitzBasic to BlitzMax IDE. I tried running the .bb file into MaxIDE but it says "process failure with file.bb". Also where can i find more information regarding this?
You must rename the .bb files to .bmx. Though a superset, BlitzBasic is a completely different language than BlitzMax.
You can use the BlitzMax IDE Community Edition project which has the feature to import .bb files then convert them to .bmx files.
In regard to the 3D commands part and as Spark Fountain as mentioned, it is not supported by default, but you can use MiniB3D or OpenB3DMax.
http://blitzmax-ide.sourceforge.net/
BlitzMax IDE Community Edition
BlitzMax introduces several new features such as classes, real object orientation, inheritance and many more. Anyways, most of the BlitzBasic syntax elements remain or can at least be re-used.
To port your BlitzBasic programs to BlitzMax, I suggest you learn and understand the basic language elements. You can also use the following guide as a starting point.
comments start with ' or REM instead of ;
arrays are defined with Local array[10] instead of Dim array(10)
3D commands are not supported but you could use i. e. MiniB3D
I want to use Eclipse CDT to search for all occurrences of regular expresion, say foo(_bar_)*baz - in the bodies/bodies and declarations of functions/methods meeting a certain criterion. For the example let's make it all functions/methods named ignore_me (but within all classes and namespaces).
Is that possible somehow?
I'm not aware of a way to do this sort of search in Eclipse CDT.
Clang's AST matchers provide a rich domain-specific language for expressing queries like yours (and many other kinds), but using them requires writing code (in a clang plugin or standalone clang-based tool). It may be relatively straightforward to write a simple tool that allows you to write a query and searches a codebase for matches. I'm not sure whether such a tool is already available.
If you port code over from one language to another, how can this be detected?
Say you were porting code from c++ to Java, how could you tell?
What would be the difference between a program designed and implemented in Java, and a near identical program ported over to Java?
If the porting is done properly (by people expert in both languages and ready to translate the source language's idioms into the best similar idioms of the target language), there's no way you can tell that any porting has taken place.
If the porting is done incompetently, you can sometimes recognize goofily-transliterated idioms... but that can be hard to distinguish from people writing a new program in a language they know little just goofily transliterating the idioms from the language they do know;-).
Depending on how much effort was put into the intention to hide the porting it could be very easy to impossible to detect.
I would use pattern recognition for this task. Think about the "features" which would indicate code-similarities. Extract these feature from each code and compare them.
e.g:
One feature could be similar symbol names. Extract all symbols using ctags or regular expressions, make all lower-case, make uniq sort of both lists and compare them.
Another possible feature:
List of class + number of members e.g:
MyClass1 10
...
List of method + sequence of controll blocks. e.g:
doSth() if, while, if, ix, case
...
Another easy way, is to represent the code as a picture - e.g. load the code as text in Word and set the font size to 1. Human beings are very good on comparing pictures. For another Ideas of code Visualization you may check http://www.se-radio.net/2009/03/episode-130-code-visualization-with-michele-lanza/