Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[photran] eclipse photran newbie questions

I am a newbie to the world of photran. 

Could anybody help me to know how I can extend the photran parser for our XPFortran?

I am trying to extend the photran parser for our XPFortran. Our XPFortran 
is very similar to HPF, but the syntax and semantics are very different between them. 
The syntax of XPFortran in BNF is shown in "Appendix A" below.

I recently checkouted the two versions of the photran from the eclipse photran's CVS.
a) The latest version at 16:42 on May 28, using the following CVS checkout command.
   "cvs checkout org.eclipse.photran"
b) The photran version 4.0.0 Beta 3, using the following CVS checkout command.
   "cvs checkout -r v20071108_4_0_0_Beta3 -d org.eclipse.photran_4_0_0_Beta3 org.eclipse.photran"

I found parser/build-parser in the project org.eclipse.photran.core.vpg in a),
but I couldn't find the jar file ludwig.jar in it.
echo Generating parser and AST classes...
java -Xmx256M -cp $SRCDIR/ludwig.jar \
	Main_LALR1_Java_AST_Prototype \
	-shift T_COMMA "<IoControlSpecList>" \

I also found parser/build-parser in the project org.eclipse.photran.core.vpg in b),
but similarly I couldn't find the jar file ludwig.jar in it.
echo Generating parser and AST classes...
java -Xmx256M -jar $SRCDIR/ludwig.jar \
	-shift T_COMMA "<IoControlSpecList>" \

Finding the file /parser/fortran95.bnf in both a) and b), I tried to compile it 
with the javaCC and the Eli. However it seems that the syntax description of 
fortran95.bnf is not compatible with the syntax description of both javaCC and Eli.

There is a statement "based on an Eli grammar" in fortran95.bnf, but as long as I look
over the parser code in a) and b), the parser code seems to be a top down, recursive 
descent parser genereted by javaCC, not a LALR(1) parser generated by Eli system.

On the other hand, I found the following email at the following URL, but 
I couldn't find the project org.eclipse.photran.parser in CVS.
http://osdir.com/ml/linux.redhat.fedora.java/2005-08/msg00015.html
15. Right-click and check out all of the org.eclipse.fdt projects as well
     as org.eclipse.photran.  DO NOT check out org.eclipse.photran.parser.
     You only need this project if you will be regenerating the parser
     from the grammar.  
     (The parser is included in the org.eclipse.fdt.core plugin
     as a JAR file.  This way, the parser does not have to be recompiled
     every time you rebuild Photran.)
  
Excuse me, but could anybody please tell me about the following newbie questions?

Q1) What compiler-compiler generated the parser code of the eclipse photran? 
    The javaCC or the Eli?

Q2) How can I extend the photran parser for our XPFortran? What development steps 
    should I take to extend the photran parser for our XPFortran?
    - How do I specify the syntactic and lexical rules of the XPFortran?
    - How do I compile them with the javaCC or the Eli?   
    - How do I deploy the parser plug-in to the eclipse photran system?

Q3) I can generate the parser classes AST*.class(323classes) by [project] -
    [Clean] - [Build All] in case a), but I can not generate the parser classes
    AST*.class by [project] - [Clean] - [Build All] in case b) at all. 
    Why does this happen?

Q4) I can export the plug-in org.eclipse.photran.core.vpg_4.0.3.jar 
    by [Export] - [Plug-in Development] - [Deployable plug-ins and fragment]
    in case a), but many error messages are generated. On the other hand, I 
    can not export the plug-in org.eclipse.photran.core.vpg_4.0.3.jar 
    by [Export] - [Plug-in Development] - [Deployable plug-ins and fragment]
    in case b) at all. The error message below is generated.
      Error Reason: Problem during export
      Unable to find plug-in: org.eclipse.photran.core.vpg_4.0.3.
      Please check the error log for more details.
    Why does this happen?
    
You could find more information about our XPFortran at the following URL.
http://ieeexplore.ieee.org/iel5/9244/29307/01324063.pdf

regards,
Norio 

Appendix A
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fortran95.bnf

#######################################################################################################################
## 
## LUDWIG GRAMMAR FOR FORTRAN 95
## 
#######################################################################################################################
## 
## Author: Jeffrey Overbey, based on an Eli grammar
## by W.B. Clodius, W.M. Waite, J. Hoffmann, and R. Jakob
## available from http://members.aol.com/wclodius/Parse95.html
## 
## The Eli grammar on which this is based is
## Copyright (c) <1999> <W. B. Clodius and W. M. Waite>
## Permission is hereby granted, free of charge, to any person
## obtaining a copy of this software and associated documentation
## files (the "Software"), to deal in the Software without restriction,
## including without limitation the rights to use, copy, modify,
## merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software
## is furnished to do so, subject to the following conditions:
## 
## The above copyright notice and this permission notice shall be
## included in all copies or substantial portions of the Software.
## 
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
## OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
## HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
## WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
## DEALINGS IN THE SOFTWARE.
## 

(abbreviated)

# R204 doesn't ensure ordering as the standard requires
<SpecificationPartConstruct> ::= (oneof)
  | <UseStmt>
  | <ImplicitStmt>
  | <ParameterStmt>
  | <FormatStmt>
  | <EntryStmt>
  | <DeclarationConstruct>
  | <XpfDeclarationConstruct> ### inserted for xpf ###

(abbreviated)

# R209
<ExecutionPartConstruct> ::= (oneof)
  | <ObsoleteExecutionPartConstruct>
  | <ExecutableConstruct>
  | <XpfExecutableConstruct> ### inserted for xpf ###
  | <FormatStmt>
  | <EntryStmt>

(abbreviated)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# GRAMMAR FOR XPFortran
#
#   /is/ means  ::=
#   /or/ means  |
#   xpf-declaration-construct means <XpfDeclarationConstruct>
#   xpf-executable-construct means <XpfExecutableConstruct>
#

X251 xpf-declaration-construct
/is/ processor-stmt
/or/ proc-alias-stmt
/or/ index-partition-stmt
/or/ local-stmt
/or/ global-stmt
/or/ resident-stmt
/or/ subprocessor-stmt
/or/ commonid-stmt

X252 xpf-executable-construct
/is/ parallel-region-construct
/or/ spread-region-construct
/or/ spread-do-construct
/or/ extended-spread-do-construct
/or/ nonblock-spread-do-construct
/or/ spread-move-construct
/or/ spread-assignment-construct
/or/ broadcast-stmt
/or/ overlapfix-stmt
/or/ unify-stmt
/or/ movewait-stmt
/or/ barrier-stmt
/or/ lockon-construct
/or/ pass-by-local-stmt

X321 proc-shape-spec /is/ explicit-proc-shape-spec
/or/ assumed-proc-shape-spec

X322 explicit-proc-shape-spec
/is/ proc-no-list

X323 assumed-proc-shape-spec
/is/ :

X324 proc-no /is/ scalar-int-constant

X331 proc-group-ref /is/ proc-group-name [ ( proc-group-subscript-list ) ]

X332 proc-group-subscript
/is/ pg-subscript
/or/ pg-subscript-pair

X333 pg-subscript /is/ scalar-int-constant

X334 pg-subscript-pair /is/ [ lower-pg-subscript ] : [ upper-pg-subscript ]

X335 lower-pg-subscript /is/ scalar-int-constant

X336 upper-pg-subscript /is/ scalar-int-constant

X341 processor-stmt /is/ PROCESSOR proc-group-name ( explicit-proc-shape-spec )

X351 proc-alias-stmt /is/ PROC ALIAS proc-group-alias-list

X352 proc-group-alias /is/ proc-group-name [ ( explicit-proc-shape-spec ) ] = proc-group-ref

X451 parallel-region-construct
/is/ parallel-region-stmt
block
end-parallel-region-stmt

X452 parallel-region-stmt
/is/ PARALLEL REGION [ resident-spec ] [ BROADCAST( broadcastee-list ) ]

X453 end-parallel-region-stmt
/is/ END PARALLEL [REGION]

X521 partition-spec /is/ ( partition-info-list )
/or/ partition-spec-name [ ( partition-info-list ) ]

X522 partition-info /is/ [ PROC = ] proc-group-ref [ . dim ]
/or/ INDEX = index-range
/or/ PART = partition-type-spec
/or/ OVERLAP = overlap

X523 dim /is/ scalar-int-constant

X524 index-range /is/ [ lower-index-bound : ] upper-index-bound

X525 lower-index-bound /is/ scalar-int-expr

X526 upper-index-bound /is/ scalar-int-expr

X531 partition-type-spec /is/ BAND
/or/ CYCLIC
/or/ ( interval-spec-list )

X532 interval-spec /is/ [ repetition-value * ] interval-value

X533 repetition-value /is/ scalar-int-constant

X534 interval-value /is/ scalar-int-constant

X541 overlap /is/ ( l-overlap , r-overlap )

X542 l-overlap /is/ scalar-int-constant

X543 r-overlap /is/ scalar-int-constant

X551 index-partition-stmt
/is/ INDEX PARTITION partition-decl-list

X552 partition-decl /is/ partition-spec-name = partition-spec

X611 local-stmt /is/ LOCAL local-decl-spec-list

X612 local-decl-spec /is/ variable-name
/or/ partitioned-array

X621 global-stmt /is/ GLOBAL global-decl-spec-list

X622 global-decl-spec /is/ variable-name
/or/ variable-name / proc-element
/or/ partitioned-array

X623 proc-element /is/ proc-group-name ( pg-subscript-list )

X631 partitioned-array /is/ array-variable-name ( partition-range-list )

X632 partition-range /is/ :
/or/ / partition-spec

X641 resident-stmt /is/ RESIDENT resident-decl-spec-list

X642 resident-decl-spec /is/ variable-name

X643 resident-spec /is/ RESIDENT ( resident-obj-list )

X644 resident-obj /is/ variable-name
/or/ RIGHT:: variable-name
/or/ LEFT:: variable-name

X711 spread-region-construct
/is/ spread-region-stmt
spread-region-component
[ region-stmt
spread-region-component ]...
end-spread-region-stmt

X712 spread-region-stmt /is/ SPREAD [NOBARRIER] REGION [ resident-spec ] / proc-group-ref

X713 region-stmt /is/ REGION [ resident-spec ] / proc-group-ref

X714 spread-region-component
/is/ block

X715 end-spread-region-stmt
/is/ END SPREAD [NOBARRIER] [REGION]

X721 spread-do-construct /is/ spread-do-stmt
do-construct
end-spread-do-stmt

X722 spread-do-stmt /is/ SPREAD [NOBARRIER] [RECYCLE] DO [ resident-spec ] [ / partition-spec ]

X723 end-spread-do-stmt /is/ END SPREAD [NOBARRIER] [DO] [ global-function-spec-list ]

X724 global-function-spec
/is/ SUM ( variable-name-list )
/or/ MAX ( scalar-variable-name-list )
/or/ MAX ( array-variable-name )
/or/ MIN ( scalar-variable-name-list )
/or/ MIN ( array-variable-name )
/or/ AND ( variable-name )
/or/ OR ( variable-name )
/or/ LAST ( scalar-variable-name [ , MASK = scalar-logical-expr ] )

X725 extended-spread-do-construct
/is/ spread-do-stmt
extended-spread-do-component
end-spread-do-stmt

X726 extended-spread-do-component
/is/ single-index-component
/or/ repetitive-index-component

X727 single-index-component
/is/ INDEX index-value
block

X728 repetitive-index-component
/is/ INDEX
do-construct

X729 index-value /is/ scalar-int-expr

X761 nonblock-spread-do-construct
/is/ nonblock-spread-do-stmt
do-construct

X762 nonblock-spread-do-stmt
/is/ NONBLOCK SPREAD [NOBARRIER] [RECYCLE] DO [ resident-spec ] [ / partition-spec ]

X731 spread-move-construct
/is/ spread-move-stmt
spmove-block
end-spread-move-stmt

X732 spread-move-stmt /is/ SPREAD [NOBARRIER] MOVE [ resident-spec ] [ partition-range-list ]

X733 end-spread-move-stmt
/is/ END SPREAD [MOVE] [ ( transfer-id ) ]

X734 spmove-block /is/ spmove-do-construct
/or/ spmove-array-assignment-stmt

X735 spmove-do-construct /is/ do-stmt
spmove-do-block
end-do

X736 spmove-do-block /is/ [ spmove-assignment-stmt ]...
/or/ spmove-do-construct

X737 spmove-assignment-stmt
/is/ local-array-element = global-array-element
/or/ global-array-element = local-array-element

X738 spmove-array-assignment-stmt
/is/ spmove-local-array-obj = spmove-global-array-obj
/or/ spmove-global-array-obj = spmove-local-array-obj

X7381 spmove-local-array-obj
/is/ local-array-variable-name
/or/ local-array-section

X7382 spmove-global-array-obj
/is/ global-array-variable-name
/or/ global-array-section

X741 spread-assignment-construct
/is/ spread-assignment-stmt
[ spassignment-assignment-stmt ]...
end-spread-assignment-stmt

X742 spread-assignment-stmt
/is/ SPREAD [NOBARRIER] ASSIGNMENT [ resident-spec ] [ partition-range-list ]

X743 end-spread-assignment-stmt
/is/ END SPREAD [NOBARRIER] [ASSIGNMENT]

X744 spassignment-assignment-stmt
/is/ assignment-stmt
/or/ where-stmt

X811 broadcast-stmt /is/ BROADCAST ( broadcastee-list ) [ ( flag ) ]

X812 broadcastee /is/ local-variable-name
/or/ local-array-element

X813 flag /is/ scalar-logical-expr
XPFortran 使用手引書ーPage 157

X821 overlapfix-stmt /is/ OVERLAPFIX ( overlapfix-obj-list ) ( transfer-id )

X822 overlapfix-obj /is/ local-array-variable-name
/or/ global-array-variable-name

X831 unify-stmt /is/ UNIFY ( partitioned-array-list ) ( transfer-id )

X841 movewait-stmt /is/ MOVE WAIT [NOBARRIER] ( transfer-id-list )

X851 barrier-stmt /is/ BARRIER

X861 lockon-construct /is/ lockon-stmt
block
end-lockon-stmt

X862 lockon-stmt /is/ LOCKON lock-id

X863 end-lockon-stmt /is/ END LOCKON

X864 lock-id /is/ scalar-int-expr

X871 commonid-stmt /is/ COMMONID transfer-id-list

X931 subprocessor-stmt /is/ SUBPROCESSOR subproc-decl

X932 subproc-decl /is/ absolute-subproc-decl
/or/ relative-subproc-decl

X933 absolute-subproc-decl
/is/ proc-group-alias

X934 relative-subproc-decl
/is/ proc-group-name ( proc-shape-spec )

X981 pass-by-local-stmt /is/ PASS BY LOCAL ( variable-name-list )

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

### the end of email ###


Back to the top