-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: add --fdump-tree=FILE option #108
base: gcos4gnucobol-3.x
Are you sure you want to change the base?
WIP: add --fdump-tree=FILE option #108
Conversation
48dae44
to
e668b19
Compare
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## gcos4gnucobol-3.x #108 +/- ##
=====================================================
- Coverage 65.39% 64.02% -1.38%
=====================================================
Files 32 33 +1
Lines 58797 60063 +1266
Branches 15492 16176 +684
=====================================================
+ Hits 38449 38454 +5
- Misses 14362 15621 +1259
- Partials 5986 5988 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
16ea769
to
4f413a2
Compare
Would it be reasonable to use -fdump-something similar to GCC https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html ?
Note: I don't have any idea if there are options that output JSON.
Question: What is the OCAML ml and where can I read more about it?
What would this output be used for?
In any case please provide test cases with sample output (and to be sure that this doesn't break anything execute make checkall at least once passing this option in COBOL_FLAGS.
|
cobc/output_tree.c
Outdated
const char* string_of_cb_usage (enum cb_usage x) | ||
{ | ||
switch (x){ | ||
case CB_USAGE_BINARY: return "CB_USAGE_BINARY"; /* 0 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't those and similar be "stringified" using our existing macros? This would still need a switch-case, but if the source is a macro then it can be just defined as additional macro instead of the full switch-case, otherwise a macro can still be used to only end in CASE_STRING(some-enum)
.
Note: you don't need to include the numeric values (which possibly be changed later on in any case).
4f413a2
to
610905c
Compare
I changed the options to I ran all the testsuite with both formats (using env variables to not modify scripts), and I could validate both OCaml and JSON files. I am not sure that adding a test in the testsuite would be a good idea: (1) the output depends on the internal types in The OCaml format is actually standard syntax for basic types in the OCaml language (https://ocaml.org). Since I mostly always program in OCaml (except for GnuCOBOL :-) ), it is easier for me to have this format than JSON, as I could easily write tools to simplify/filter information in the AST. For examples, JSON format (with flags
whereas OCaml format looks like:
|
610905c
to
d3294aa
Compare
Note that there are still some TODOs in the code. There are many fields in these data structures, and it's not clear what should be printed or not. Also, it might be interesting at some point to have "levels" of importance for fields, so that, for example, only important fields would be printed at level 1, then less important fields at level 2, and so on... However, such levels should probably be decided after experimenting with using these outputs for real debugging. |
00faae3
to
41819d1
Compare
May be useful for debugging code generation. Use the extension of FILE to choose the format of output: * .ml : OCaml code format * any other: JSON format (output validated by jsonlint-php)
41819d1
to
266808b
Compare
Dump the AST/tree to a file, for debugging purpose.
Use the extension of FILE to choose the format of output: