投稿

11月, 2023の投稿を表示しています

COBOLのソースコード変換:行末尾のピリオドをに変換する

COBOLの変換: 行末尾のピリオドを<PERIOD>に変換する ✏スクリプト import re # COBOLソースコード cobol_code = """ IDENTIFICATION DIVISION. PROGRAM-ID. FloatConditionalSample. DATA DIVISION. WORKING-STORAGE SECTION. 01 Age PIC 9(3). 01 Income PIC 9(7)V99 USAGE IS COMPUTATIONAL-3. 01 isStudent PIC X(1). 01 isSenior PIC X(1). 01 discountApplied PIC X(1) VALUE 'N'. 01 discountThreshold PIC 9(7)V99 USAGE IS COMPUTATIONAL-3 VALUE 50000.00. PROCEDURE DIVISION. DISPLAY "Enter age: ". ACCEPT Age. DISPLAY "Enter income: ". ACCEPT Income. DISPLAY "Are you a student? (Y/N): ". ACCEPT isStudent. DISPLAY "Are you a senior citizen? (Y/N): ". ACCEPT isSenior. IF Age >= 18 AND isStudent = 'Y' AND (Income > discountT

【論文要約】"Aroma: Code Recommendation via Structural Code Search"

  Abstract of this paper in 2 lines: The paper proposes Aroma, a tool and technique for code recommendation via structural code search, which indexes a large code corpus and recommends relevant code snippets based on partial code input. [1] Aroma retrieves and recommends relevant code snippets efficiently by using a matrix of sparse feature vectors and cosine similarity calculations. [2] [3] Contributions of this paper: Aroma is a tool and technique for code recommendation via structural code search, which indexes a large code corpus and recommends relevant code snippets based on partial code input. It clusters and intersects the results of the search to recommend a small set of succinct code snippets that contain the query snippet and appear in several methods in the corpus. Aroma can be used to extend partially written code snippets, discover common extensions used by other programmers, cross-check against similar code written by others, and add extra code to fix common mistakes and

COBOLのソースコードをPythonで字句解析

  COBOLのソースコードを字句解析 パターン1: ✏スクリプト import re # COBOLソースコード cobol_code = """ IDENTIFICATION DIVISION. PROGRAM-ID. SAMPLE. DATA DIVISION. WORKING-STORAGE SECTION. 01 NUM1 PIC 9(3) VALUE 100. 01 NUM2 PIC 9(3) VALUE 200. 01 RESULT PIC 9(3). PROCEDURE DIVISION. ADD NUM1 TO NUM2 GIVING RESULT. DISPLAY "The result is " RESULT. STOP RUN. """ # 正規表現パターンを定義 pattern = r"(\b[0-9]+\([0-9]+\)\b|\b[0-9]+\b|\b[A-Z0-9-]+\b|\+|-|\*|\/|\.|:|>|<|=|\(|\)|\.)" # 正規表現パターンにマッチするトークンを抽出 tokens = re.findall(pattern, cobol_code, re.IGNORECASE) # 抽出したトークンを表示 for token in tokens: print(token) パターン2:指定した文字列を抽出 ✏スクリプト import re # COBOLソースコードimport re code = """ IF XXX_CD1 = '5' OR XXX_CDA = 'A' OR XXX_CD2 = XXXX AND TEST = 'ABC' ELSE IF AAAA-XXX_CD1 = '&&' NEXT SENTENCE ELSE IF AAAA_

【論文要約】ControlFlag: A Self-Supervised Idiosyncratic Pattern Detection System for Software Control Structures

  Abstract of this paper in 2 lines: The paper presents ControlFlag, a self-supervised machine programming system that aims to detect idiosyncratic pattern violations in software control structures and suggests possible corrections. ControlFlag has already found and fixed an anomaly in CURL, demonstrating its potential to improve software quality.[1] Contributions of this paper: The paper presents ControlFlag, a self-supervised system that automatically identifies potential errors in control structures of the C family of languages, specifically focusing on if statements in CC programs. ControlFlag is designed to be programming language agnostic, making it applicable to different programming languages. The system takes a statistical approach to identify programming pattern violations by recasting them as anomalies, providing a novel method for detecting idiosyncratic pattern violations. ControlFlag has been successfully used to detect anomalies in the CURL open-source project, leading t