Hi Shiva, Yes, of course that's possible. Look at the classes under the “examples" folder to see how you can access the ASTs and start processing them. Cheers, Kris
I contacted you via LinkedIn. I hope I picked the right Guy. :-)
Hi Guy, Sorry, no. I process the data coming from the parser directly, without an intermediate transformation to XML. If you want more insight into the XML, I definitely recommend using the GUI. As the XML is pretty much a dump of the AST, anything you learn in one should be directly applicable in the other. The GUI lets you click on any token in the text and it will show you the path in the tree. There is also an option to visualize the AST in the UI. Even better, when you show the AST, clicking...
So the error says that it could not classify the "END-SEARCH", but everything up to that point seems to have gone allright. In particular it looks like it handled the search statement's condition (note the "condition < searchStatement" in the path). Looking at the grammar it expects to find something after the condition: WHEN condition ( nestedStatements | NEXT SENTENCE ) Your example does not have a nested statement, nor a NEXT SENTENCE, and so the parse fails. Adding a statement after line 044300...
I decided to move the project to GitHub. It is much easier for people to contribute changes there. So if you have something to share, you can now base it off the version found at https://github.com/krisds/koopa/issues . I'm happy to keep the discussion here though.
I decided to move the project to GitHub to make it easier for people to contribute. You can now find it here: https://github.com/krisds/koopa/issues The SourceForge version will remain for historic purposes. I'll keep an eye on the forums here for a while longer.
I decided to move the project to GitHub to make it easier for people to contribute. You can now find it here: https://github.com/krisds/koopa/issues The SourceForge version will remain for historic purposes. I'll keep an eye on the forums here for a while longer.
Hey Adam, Koopa uses SVN right now, so the easiest way to share your changes is to make a diff between your code and the latest commit here, and share that. (I see that SF supports git now, so maybe I'll take some time to migrate the repo over to that. I'm not sure what the best option is.) But before that, do you have an example of dummy operands which Koopa fails to handle ? That way I can inspect what goes wrong, and give you a better answer. I would actually expect Koopa to be able to handle...
Simplify grammar for some CICS options
Easy conversion of Start to matching End
TRUE and FALSE in common nodes
Adding a common type for all statement END markers.
Fix double closing of Targets by Flow when there's a WaterTagger.
The XML has the same info as the AST. It's just a way to store it. You can analyze the AST in code, or analyze the XML, in whatever way you want. Calculating a flow graph will mean understanding how a Cobol program flows, and then querying the AST to give you the information you need to calculate it. You'll need to look at sections, paragraphs, specific statements. It's not impossible, or especially hard, but it does take work to do.
The XML has the same info as the AST. It's just a way to store it. You can analyze the AST in code, or analyze the XML, in whatever way you want. Calculating a flow graph will mean understanding how a Cobol program flows, and then querying the AST to give you the information you need to calculate it. You'll need to look at sections, paragraphs, specific statements. It's not impossible, or especially hard, but it does take work to do.
I'm not sure what you mean by "variables with hierarchy". Right now only XML export of the full AST is built-in. If you need something custom you will have to code it yourself. The easiest way is to grab the AST and process it how you want. If you look at "JaxenSample" you can see how to do the first part.
Hi Bharani, Koopa includes a tool which lets you export the AST to XML. You can invoke it with "java -cp koopa.jar koopa.app.cli.ToXml", or use the "Export to XML" action under "Syntax Tree" in the GUI. Hope that helps, Kris
Start and End are flyweights, so equality can be simplified.
Applying the improved optimizer logic to permutations too.
Performance tweaks
Position-spec test.
Partial expressions in selection objects in EVALUATE statements
Adding position-spec anyway.
Note and test on position-spec in DISPLAY/ACCEPT.
Fix a test file.
FUNCTION name+ INTRINSIC
ACCEPT: WITH is optional
DISPLAY ERASE SCREEN
ENTRY USING BY CONTENT
ACCEPT FROM ENVIRONMENT identifier
COPYs in comments don't count. Obviously.
Guarding against an NPE.
Introducing the CobolProject interface.
Keyword test: refactored from recursion to a loop
Fix grammar for parameters in MF directives.
Cash not find class koopa.core.parsers.combinators.MatchTree
Sorry about that. It's been a while since I used svn and I forgot to add those classes in. Should be fixed now.
Add missing classes.
Extended grammar and parser to allow matching against trees (just the root, or in more detail).
Refactoring Source.
Syntactic sugar for %noskip.
Replaced compiler directives regexes with actua...
Tweaking the loggers.
Rewrite/Refactoring of the sources.
Optimizer
First pass at an omniscient debugger.
Added a GUI option to set some log levels inter...
MF compiler directives
Move support for embedded languages into dedicated grammars
Added syntax in [r384]. E.g. sql::statement
Issue #41: added syntactic sugar for referencin...
It should really just be "Koopa Parser Generator" now, as you can use it for plenty...
No, there are some hand-written forwarding methods in CobolBaseGrammar to make up...
Missing %notempty's. Tweaking CALL statement SI...
Handling optional headers in Micro Focus Cobol.
Compiler directives: refactoring and more tests
Java 5 oops.
Support for tabs.
Support MF VARIABLE format
SQL: ALTER SESSION
XML PARSE WITH ENCODING, and related tweaks
Tweak possible branch orderings
Tweaking OCCURS clause.
Tweaking SIGN clauses
SQL: SELECT COUNT(*)
SELECT INTO host parameters
Separated CICS and SQL from the Cobol source code.
Updated the example project to match the latest...
DELETE statement improvements
Removed support for native code in grammars
Support for some bottom-up parsing. Big update.
LimitedStream.peek was forcing delayed markers,...
Handling comments in COPY REPLACE and pseudo li...
Refactoring BaseStream, reworking its 'seen' li...
Added tests for LimitedStream; some cleanup
Deleted these files as well.
Summer cleaning
Support floating point numbers.
Yes, CONSTANT AS is covered by the constantEntry_level01 rule. RETRY and DYNAMIC...
"not all input was consumed": parsing of (optional) comma
Bugs in "Export batch results to CSV"
Parsing: Missing data types
Given the nature and goals of Koopa I'm not going to add "not allowed" checks. I...
Last line before starting a new paragraph must ends with Dot "."
Boolean literal
Added more structure to the SET statement in [r358].
Issue #60: added more structure to the AST for ...
Don't parse code in comment entry paragraphs
Going through the open issues. I added support for comment entries in some expected...
preprocessing mark as both LAND and WATER
Fixed in [r357]. Was due to a bad test in the code clearing the tags.
Issue #59: fix spurious tagging of both LAND an...
I considered it, but there is no clean way to open links from within a Java 5 app...
FR (GUI): Add Help Menu with version history, current README, LICENCE, ...
Fixed in [r356].
Issue #19: help menu showing license, readme an...
I'm going to keep the version history out, as you can easily find it here (https...
Koopa: Add GUI option for defining "everything which can be set via VM options" (at least -Dkoopa.cobolFileExtensions=<comma-separated-list-of-extensions>
The GUI option has been added in [r355].
Issue #64: add a GUI option to set the file ext...