Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Dynamic Code Creation and Validation from Syntax Diagrams

IP.com Disclosure Number: IPCOM000120274D
Original Publication Date: 1997-Nov-01
Included in the Prior Art Database: 2005-Apr-02
Document File: 4 page(s) / 140K

Publishing Venue

IBM

Related People

Anghelides, P: AUTHOR

Abstract

When typing new code, a programmer has to ensure that it is syntactically correct (spelling command words, using variables within allowed ranges, etc.). This requires the programmer to: o Remember the syntax and apply it correctly. o Refer to syntax documentation (hardcopy or on-line), and then type it correctly. o Cut and paste existing code or examples from on-line help, ensuring that it is changed correctly.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 34% of the total text.

Dynamic Code Creation and Validation from Syntax Diagrams

      When typing new code, a programmer has to ensure that it is
syntactically correct (spelling command words, using variables within
allowed ranges, etc.).  This requires the programmer to:
  o  Remember the syntax and apply it correctly.
  o  Refer to syntax documentation (hardcopy or on-line), and
      then type it correctly.
  o  Cut and paste existing code or examples from on-line help,
      ensuring that it is changed correctly.

All of these are error-prone.

      The code can be checked for validity by getting the compiler
to parse or compile it.  But, it is still necessary to check whether
mistakes have been made.  Ideally, mistakes should be avoided in the
first place, and references to documentation should be minimized.

      The described solution provides a dynamic display and selection
of railroad-diagram syntax, which can be displayed from within or
without a program editor.  It is referred to here as a syntaxer.

      When editing an existing piece of code, the programmer wishes
to include a new piece of syntax.  The cursor is in the middle of a
block of existing code, the syntaxer is started.
  Step 1: The valid syntax for this context
    o  If the cursor is in the middle of a word, the syntaxer
        parses the text, identifies it as a valid keyword
        (e.g., a command or function) for the language and then
        displays a railroad diagram for that specific piece of
        syntax, complete with valid defaults.
    o  If the cursor has striped a section of code, the syntaxer
        parses the text and displays the code in railroad diagrams
        for each unique element of syntax, complete with either
        the currently-typed variables or valid defaults.
    o  If the cursor is on a non-valid word, the syntaxer displays
        a message explaining this and offering the most likely
        alternatives, based on:
         1.  Similar spellings
         2.  A list of valid syntax words for the current context
              within the program

The required syntax word can then be selected, and the syntaxer
displays the railroad syntax for that word, complete with valid
defaults.
  o  If the cursor is not on any word, the syntaxer displays a
      list of valid syntax words for the current context within
      the program.  The required syntax word can then be selected,
      and the syntaxer displays the railroad syntax for that word,
      complete with valid defaults.
  Step 2: Create valid syntax
    o  The railroad syntax display can be customized for display
        in five different ways:
         1.  Defaults only -  Displays only the required elements
              of syntax, complete with defaults.
         2.  Common choices only -...