Skip to content
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] OO COBOL - AST #164

Draft
wants to merge 5 commits into
base: gcos4gnucobol-3.x
Choose a base branch
from
Draft

Conversation

RemiBHardy
Copy link

This is a preliminary work for adding the capability to support COBOL objects on GnuCOBOL. FORMAL REVIEW IS NOT NEEDED AS IT WON'T BE MERGED FOR NOW

you can find here :

In cobc : parser.y reserved.c are modified to extend the syntax

@GitMensch
Copy link
Collaborator

Please add tests verifying that OO syntax (standart / ibm / mf?) can be parsed and add a NEWS entry.

@engboris engboris changed the title OO COBOL - AST [WIP] OO COBOL - AST Aug 13, 2024
nberth pushed a commit to nberth/gnucobol that referenced this pull request Aug 14, 2024
…655-4658, 4663 from branches/gnucobol-3.x:

........
build_windows: adjusted svn properties (global-ignores instead of single ones)
........
preparation for CANCEL ALL [feature-requests:OCamlPro#164]

runtime part mostly missing, too much effort for now, compiler part finished
........
minor cleanup related to resolving COBOL modules

* bin/cobcrun.c: no module name check (done in libcob now)
* libcob/call.c:
  * (cob_resolve_internal): added check for module name length, fixed compiler warnings
  * call.c (cob_call): switched argument table from dynamic allocation to stack allocation
fixed [bugs:#844] stack-based buffer overflow found with fuzzing

cobc/tree.c (literal_for_diagnostic): fixed #844 stack-based buffer overflow
........
follow-up to [r4625] "move of defaultbyte from flag to dialect option"

NEWS entry added

cobc:
* config.def, config.c: changed defaultbyte option from "INT" to ANY" with explicit check for "init" (GnuCOBOL default behavior, in r4625 as "ignore", now also allowing to set it after it was set different) and "none" (in preparation of missing feature, for now => implicit 0)

config:
* set defaultbyte to "none" for standard COBOL, 32 to " "
........
literal handling overhaul, first time working national literals

cobc:
* scanner.l (read_literal): do the necessary conversion for national literals (simple approach, only working with source in iso-8859-15 or plain ascii)
* typeck.c (get_value): return correct numeric value for national (utf16) literals
* tree.c (cb_build_intrinsic): fixed optimized length generation for national fields and literals
* typeck.c (cb_validate_program_environment): refactored, reducing variable scope and extracted (validate_alphabet) and (check_class_duplicates); call the later depending on cb_warn_additional, no need to test if the final result is ignored
* typeck.c (validate_alphabet): adjustments for national literals, now partially supported
* scanner.l: moved static literal_error to local variable, passing it (to error_literal); return a valid literal in case of literal errors (intead of cb_error_node) to prevent spurious follow-up errors on their use
........
follow-up to [r4625] "move of defaultbyte from flag to dialect option"

config:
* ibm-strict.conf, mvs-strict.conf, gcos-strict.conf, bs2000-strict.conf: adjusted defaultbyte to 0
........
Merged revisions 4548-4549,4553-4554,4624-4625 from trunk:

Fix for BIT-WISE ops on Bigendian
........
added test for internal initialize for WORKING-STORAGE - revival of [bugs:#694]
........
Fix codegen issues
........
Fix for WORKING Initialize with OCCURS/VALUE
........
Improve INITIALIZE - more later
........
Move defaultbyte from flag.def to config.def
........
add preliminary support for DEFAULT SECTION

cobc:
* pplex.l, parser.y: parse DISPLAY and ACCEPT statements in DEFAULT SECTION (GCOS 7 extension)
........
add support for more source formats

[feature-requests:OCamlPro#29] support for ACUCOBOL-GT Terminal format
[feature-requests:#230] support for X/Open Free-form format

* NEWS: added news entry for source formats
* configure.ac: check for __attribute__((pure))

cobc:
* cobc.h, cobc.c: extend cb_format enum with VARIABLE, TERMINAL, XOPEN, XCARD, CRT, and COBOLX source formats
* cobc.c, flag.def: add new flag -fformat
* ppparse.y: extend SOURCEFORMAT directive
* cobc.h, cobc.c, pplex.l (cobc_get_indicator_column, cobc_get_text_column, cobc_get_indicator, cobc_get_margin_a, cobc_get_margin_b): encapsulate source format-related variables with pure functions
* cobc.c: drop source format-related macros
* cobc.h, pplex.l (cobc_deciph_source_format, cobc_set_source_format, cobc_get_source_format): encapsulate source format configuration into preprocessor lexer
* pplex.l (ppinput): add support for ACU terminal and X/Open indicators, as well as floating margin B
* pplex.l (check_listing): do not output sequence number of short lines
* cobc.h: define function purity attribute COB_A_PURE
* cobc.c (cobc_print_info): silence a warning with string indexing

doc:
* gnucobol.texi: document newly supported source formats
........
add support for CONTROL DIVISION (with SUBSTITUTION SECTION only)

cobc:
* pplex.l, ppparse.y: add support for CONTROL DIVISION (GCOS 7 extension); only SUBSTITUTION SECTION is handled yet
* config.def: new control-division option

config:
* general: added option control-division
........
compiler speedup

cobc/field.c.c (cb_resolve_redefines): always search candidate with (small) word list first, instead of checking the complete parent for a same name with case-insensitive name comparison
........
fixed syntax check for DISPLAY AT

cobc/typeck.c (numeric_children_screen_pos_type): ignore redefined fields
........
allow DEPENDING clause in RECORD CONTAINS

cobc:
* config.def, parser.y: allow DEPENDING clause in RECORD CONTAINS

config:
* general: added option record-contains-depending-clause

Co-authored-by: David Declerck <[email protected]>
........
add GCOS-specific device name mnemonics

cobc:
* config.def, typeck.c (cb_emit_accept_name, cb_build_display_name): rely on new option device-mnemonics (boolean) instead of standard-define to accept device name mnemonics for DISPLAY and ACCEPT
* parser.y, reserved.c, scanner.l, typeck.c: add GCOS-specific mnemonics ALTERNATE-CONSOLE, ALTERNATE CONSOLE and TERMINAL

config:
* general: added config option device-mnemonics (boolean)

Co-athored-by: David Declerck <[email protected]>
........
libcob/strings.c (cob_unstring_into): minor performance-tweak for UNSTRING with a single DELIMITED BY phrase
........
parse WITH CONVERSION clause for DISPLAY statement

cobc:
* parser.y: allow the WITH CONVERSION clause right after DISPLAY (ignored)

Co-authored-by: David Declerck <[email protected]>
........
[feature-requests:OCamlPro#137] support literal operands in partial replacing phrases

cobc:
* ppparse.y (literal_token): support SPACE or SPACES figurative constant as second operand of partial replacing phrases
* pplex.l, ppparse.y, config.h: support COPY and REPLACE statements with partial REPLACING operands specified using literals
* config.def: new option partial-replacing-with-literal
* cobc.h, pplex.l (ppparse_verify): feature verification while in ppparse.y
* pplex.l (ppparse_error): shift newline counter by one when reporting an error when in ppparse.y

config:
* general: added option partial-replacing-with-literal
........
factorize some code in the compiler

cobc:
* ppparse.y (unquote, fix_filename): factorize code for unquotation of alphanumeric literals
........
add support for the STOP ERROR statement

config:
* general: add a stop-error-statement option

cobc:
* config.def, parser.y: add support for the STOP ERROR statement

libcob:
* common.c, common.h (cob_stop_error): new function for STOP ERROR statement

Co-authored-by: Fabrice Le Fessant <[email protected]>
........
Copy link
Collaborator

@GitMensch GitMensch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests verifying that OO syntax (standart / ibm / mf?) can be parsed and add a NEWS entry.

Comment on lines +29 to +30


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that seems useful to revert :-)

@GitMensch GitMensch marked this pull request as draft September 18, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants