Java 用開発ツールを利用したCOBOL 開発環境の改 ??語に適用する手法を提案する。本 手法を採用することで、困難な構文解析器の 開発を行うことなくツールを供給できるた め、ツール供給不足の問題を解決することが できる。 本稿では、まず、2節において本論文の前 提知識と

  • Published on
    30-Apr-2018

  • View
    224

  • Download
    6

Embed Size (px)

Transcript

  • Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    JavaCOBOL

    1 ................................................................................................................. 41

    2 .......................................................................................... 41

    3 ........................................................... 47

    4 ............................................................................................................. 59

    5 ................................................................................................................. 61

    40

    NRI

    Java

    COBOL

    Java

    COBOL

    20%

    JavaCOBOL

    JavaCOBOL

    Despite increasing needs for development tools in recent years, supply of the tools to developers is notenough. Especially for COBOL language, development tools are few, while those for Java language can befound everywhere. In this article, in order to solve the insufficiency of tool supply, I will propose a method,that is composed of standardizing parser by utilizing pure syntax tree and transforming tree structure betweensyntax trees, by which development tools for Java language are applicable to development using COBOLlanguage. This method will decrease the man hour needed to develop a development tool to less than 20 %, bydecreasing the difficulty level of development by replacing the development of parser which is usually difficultwith reusing pure parser and transforming tree structure by general method, and by reusing the rest of theoriginal tool. This article also indicates its effectiveness by the result of an experiment of developing adevelopment tool for COBOL language using an open source development tool for Java language and applyingthe method to it.

    Keyword : development toolsJavaCOBOLpure syntax treeparser

  • 1

    COBOL

    Java

    COBOL

    2

    3

    COBOL Java

    4

    ()

    41

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

  • XML

    Abstract Syntax TreeAST

    1

    3

    BNF

    abc

    1abcab

    c2ab

    ab2

    1

    BNFEBNF

    BNFBackus Naur Form

    EBNFExtended Backus Naur

    Form

    2BNFEBNF1

    BNF

    42

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    abc

    cba

    1

  • BNF

    or

    BNF1

    EBNFBNF

    *

    0

    EBNF 1

    0

    EBNF

    BNF

    EBNF

    BNF

    EBNF

    parser

    LLLALR

    1

    LLLALR

    LL LALR

    LL(k)LALR(k)

    LL(k)

    LALR(k)

    LLLALR

    LALRLL

    LALR

    43

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    BNF

    + abc

    EBNF

    (+ ) * ( ) * abc

    2 BNFEBNF

  • EBNF

    ()

    RubyPython

    COBOL

    ()

    Eclipse

    1

    Java

    ANTLR[ 3 ]

    JavaCC[ 4 ]SableCCBeaver

    RunCCGrammaticaSJPT

    [5]

    44

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

  • LL (k )

    LALR(k)

    EBNF

    1

    Java ANTLR

    JavaCC2Java

    Eclipse JDTJikesPG[6]

    JikesPG

    Eclipse JDT

    JikesPG

    1

    1

    AST

    AST

    3

    LL(k)

    abc

    4LL(k)

    T2AST

    AST

    a(bc)

    ab c

    (a b) c

    T1 AST

    AST

    T3 AST AST

    gcc

    COBOL

    OpenCOBOLAST

    COBOL

    45

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    E F + E F E FF a b c

    3

  • C

    OpenCOBOL

    1

    AST

    AST

    LL(k)LALR(k)

    46

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    [] [] []

    Jalopy-1.5b1(java.g) 2479 610 760

    Jalopy-1.5b1(java.doc.g) 2129 600 609

    checkstyle-4.4(java.g) 1888 723 278

    1

    abc

    ba

    c

    T1AST

    b c

    a

    T2AST

    cba

    T3AST

    4 AST

  • [7]

    [8]

    Java COBOL

    COBOL Java

    ()

    3

    3

    9

    i

    ii

    iii

    iv

    v

    vi

    vii

    viii

    ix

    vviviiiix

    47

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

  • G1T1G2

    T1

    G2

    JavaC

    i Java

    C

    ii C

    Java

    iii Java

    C

    iv Java

    C

    v Java

    C

    3

    ()

    Java

    Java

    100%

    Java

    80%

    48

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    G1

    5

  • 20%

    G1

    5

    i G1

    AST

    ii AST

    iii

    iv

    G2

    6

    i G2AST

    ii G1

    iii

    iv G1 G2

    AST

    v

    G2

    6

    G2

    G1AST

    7

    iv5

    2

    i G2

    ASTG1AST

    ii

    G2

    AST

    49

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

  • ()

    i

    G2

    G1AST

    50

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    G2

    G2

    G1

    G1

    G1

    G2

    G1G2

    G2

    G2

    6

    G2

    G1

    G1

    G1

    G2

    G1G2

    G2

    7 AST

  • ii

    AST

    AST

    2

    a

    bAST

    a

    AST

    51

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    abc

    ba

    c

    T1AST

    cb

    a

    T2AST

    a cb

    T3AST

    a

    b

    c

    8 AST

  • AST2

    AST

    AST

    a

    AST

    8

    XSLT

    2.3

    3.2

    G1T1

    G2

    iG2T1

    AST

    G1 L1

    G2L1

    L2

    i3

    9

    i G2L2

    A2

    ii L2

    L1A1

    iii L1 A1 T1

    AST

    iiii

    ab

    OpenCOBOL[9]COBOL

    C

    gccCOBOL

    52

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

  • 53

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    ba

    c

    T4AST

    cb

    a

    T3AST

    a

    b

    c

    A2

    L2

    G2

    cb

    a

    T2AST

    a cb

    T1AST

    abc

    L1

    a

    b

    c

    A1

    G1

    abc

    9 AST

  • OpenCOBOL

    3.5

    () COBOLJava

    Java

    COBOLCOBOLJava

    COBOL

    Java

    3

    ()

    COBOL

    COBOL1Java

    COBOL 1

    1 1

    54

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

  • 10 IDENTIFICATION DIVI-

    SIONEND PROGRAM1

    Java 1

    PROGRAM-IDPROG001

    PROCEDURE DIVI-

    SIONSECTION

    COBOLDATA DIVISION

    Java11

    COBOLDATA1

    DATA2JavaDATA1

    DATA2

    55

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    10

    001000*

    001100 IDENTIFICATION DIVISION.

    001200 PROGRAM-ID. PROG001.

    002000*

    004100 PROCEDURE DIVISION.

    009000 END PROGRAM PROG001.

    public class PROG001 extends CobolBase {

    public void procedureDivision() {

    }

    }

    11

    003300 01 DATA1 PIC 9(02).

    003400 01 DATA2 PIC 9(02).

    @CobolDataDescription(LEVEL="01", PIC="9(02)")

    private CobolData DATA1 = new CobolData();

    @CobolDataDescription(LEVEL="01", PIC="9(02)")

    private CobolData DATA2 = new CobolData();

  • COBOL

    Java

    12

    COBOLGROUP1 Java

    GROUP1Class

    GROUP1

    GROUP1 DATA1

    DATA2JavaGROUP1Class

    COBOL

    DATA1 OF GROUP1Java

    GROUP1.DATA1

    COBOLDATA DIVISION

    SECTIONWORKING_STORAGE

    FILELINKAGE

    WORK-

    ING_STORAGE SECTION Java

    WorkingStorageClass

    WorkingStorage

    COBOL WORK ING _ STORAGE

    S E C T I O N

    Work ingStorageC lass

    COBOL Java

    13 MOVE

    MOVE 1

    2

    56

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    12

    003300 01 GROUP1.

    003400 03 DATA1 PIC XX.

    003500 03 DATA2 PIC XX.

    @CobolDataDescription(LEVEL="01")

    private GROUP1Class GROUP1 = new GROUP1Class();

    private static class GROUP1Class extends CobolData {

    @CobolDataDescription(LEVEL="03", PIC="XX")

    private CobolData DATA1 = new CobolData();

    @CobolDataDescription(LEVEL="03", PIC="XX")

    private CobolData DATA2 = new CobolData();

    }

  • ()

    COBOL

    Java

    COBOL

    PICTURE

    Java

    Java

    COBOLJava

    11

    PICTURE

    ()

    COBOL

    2

    1

    Java

    57

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    13 MOVE

    004110 MOVE DATA2 OF GROUP1 TO DATA1.

    _MOVE(WorkingStorage.GRUOP1.DATA2,

    WorkingStorage.GROUP1.DATA1);

  • COBOLJava

    14 COBOL

    Java

    {}

    PERFORM

    Java

    COBOL

    COBOL

    PERFORM

    58

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    14

    004000 SECTION1 SECTION.

    004010 MOVE DATA1 TO DATA2.

    004020 MOVE DATA3 TO DATA4.

    004100 PARAGRAPH1.

    004110 MOVE DATA5 TO DATA6.

    public void SECTION1() {

    {

    MOVE(WorkingStorage.DATA1, WorkingStorage.DATA2);

    MOVE(WorkingStorage.DATA3, WorkingStorage.DATA4);

    }

    PARAGRAPH1:

    {

    MOVE(WorkingStorage.DATA5, WorkingStorage.DATA6);

    }

    }

  • ()

    2

    3.

    Java

    Eclipse JDT

    COBOL

    COBOL

    IF

    COBOL

    Java

    }

    Eclipse JDTCOBOL

    JavaCOBOL

    COBOL

    Java

    COBOL

    Java

    PMD

    C O B O L

    COBOL

    2

    20%

    59

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

  • ()

    2.3

    ANTLRJavaC/C++

    Ruby

    COBOLFORTRAN

    ScalaPHP

    AST

    EBNF

    Sapid[10]

    API

    Sapid

    60

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    2

    PMD(Java) 60,000 1,800KB

    COBOL 7,200 230KB

    12% 13%

  • G1

    G2

    Java

    COBOL COBOL

    Java

    AST

    AST

    XSLT

    20%

    COBOLJava

    61

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

  • [1] Addison-Wesley

    CompilersPrinciples,

    Techniques, and Tools

    Jeffray.D.UllmanAlfred V.Aho

    Ravi Sethi1986

    [2] C. M. University

    What is a CASE Environment?

    2007

    http://www.sei.cmu.edu/legacy/case/

    case_whatis.html

    [3] Antlr parser generator

    http://www.antlr.org/

    [4] java.netJavacc home

    https://javacc.dev.java.net/

    [5] Parser generators

    http://www.java2s.com/Product/

    Java/Development/

    Parser-Generators.htm

    [6] Jikes

    http://jikes.sourceforge.net/

    [7]

    2004-SE-144-8

    [8] Springer Berlin / Heidelberg

    Deterministic, error-correcting

    combinator parsersS. D. Swierstra

    and L. Duponcheel1996

    [9] OpenCOBOL - an open-source

    COBOL compiler

    http://www.opencobol.org/

    [10] Vol.39 No.6

    case

    sapid

    pp.1990-1998

    [11]

    Vol.108 No.173

    AST

    2008

    62

    NRI

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

  • 63

    JavaCOBOL

    Copyright 2008 Nomura Research Institute, Ltd. All rights reserved. No reproduction or republication without written permission.

    vol11-0100_01_02_03_java04_05_

Recommended

View more >