PALINGOL GRAMMAR

FOREWORD

We present here the complete Palingol grammar, i.e. the language words and the standard BNF rules, as they appear in the lex/yacc sources. In order to write Palingol programs, you may wish to read a comprehensive user's guide.

If you want to be alerted for new releases of Palingol, have questions or comments, or some bugs to report, please send an e-mail to : public@abi.snv.jussieu.fr (this is an alias to author's adress).


LANGUAGE SUMMARY

The characters indicated within parentesis are optionnal; for instance sub(s)(tract) may be spelled : sub or subs or subtract or substract.

General Directives

%pragma
pragma debug   prune
volatil        on      off

Program Sections

%start %before %program
%after %end    
helix  span(s) cross(es)

Span Specifications

%none  %s(tart)_h(ead) %e(nd)_h(ead)
%s(tart)_t(ail)        %e(nd)_t(ail)   

Operators and Constants Names

physical constants

head   tail    loop
fullseq(uence) seqnam(e)       seqinf(o)

operator acting on physical

start  end     seq(uence)
len(gth)       direct(strand)  energ(y)

boolean operations

true   false   
not    and     or
equiv(alent)   

numerical comparisons

zero   eq      ne
lt     le      gt
ge     

numerical operations

opp(osite)     sq(uare)        
add    sub(s)(tract)   mul(tiply)
div(ide)       mod(ulo)        

string related

complem(ent)   inver(se)       complinv(erse)
str(ing)cat    s(ub)str(ing)   str(ing)len
str(ing)empty  str(ing)(in)str(ing)    str(ing)beg(ins)
str(ing)end(s) str(ing)c(o)mp(are)     

consensus matrices and pattern searching

scoremat(rix)  
pat(tern)compil(e)     pat(tern)match  pat(tern)search
matchpos(ition)        matcherr(or)(s) matchfrag(ment)

base pairing

b(ase)p(air)compil(e)  scoreb(ase)p(air)       

miscellaneous

set    exist(s)        print(f)

Flow Control

if     else    while

BNF GRAMMAR

rules

progr  : optblk startblk befblk progblk aftblk endblk

optblk : <empty>
       | optblk %pragma OPTNAM OPTVAL

startblk : <empty>
       | %start { <empty> }
       | %start { boolexp }

befblk : <empty>
       | %before { <empty> }
       | %before { boolexp }

progblk        : %program { palblk spanblk crossblk }

aftblk : <empty>
       | %after { <empty> }
       | %after { boolexp }

endblk : <empty>
       | %end { <empty> }
       | %end { boolexp }

palblk : <empty>
       | palblk palunit

spanblk        : span(s) { spandesc }

crossblk       : <empty>
       | cross(es) { boolexp }

palunit        : helix | pal(indrom) { boolexp }

spandesc       : <empty>
       | spandesc spanunit

spanunit       : (SPANTYPE) vdigit

vdigit : (+|-)DIGITS

palexp : PALELT
       | PALELT #DIGITS

boolexp        : VBOOL
       | ( VBOOL )
       | ( BOOLPHYSICAL palexp )
       | ( BOOLMONADIC boolexp )
       | ( BOOLDYADIC boolexp boolexp )
       | ( NUMCOMPMONADIC numdft )
       | ( NUMCOMPDYADIC numdft numdft )
       | ( STRCOMPMONADIC strdft )
       | ( STRCOMPDYADIC strdft strdft )
       | ( PATDYADIC strdft numdft )
       | ( PATTRYADIC strdft numdft boolexp )
       | ( BOOLPAT strdft strdft numdft numdft boolexp )
       | ( SETMONADIC varnamgenexp )
       | ( VARCOMP varnam)
       | ( PRINTDYADIC VSTRING varnam)
       | ( PRINTDYADIC VSTRING genexp )
       | ( IFMONADIC ( boolexp ) boolexp )
       | ( IFMONADIC ( boolexp ) boolexp ELSEMONADIC 
boolexp )
       | ( WHILEMONADIC ( boolexp ) boolexp )
       | ( PRAGMA OPTNAM )
       | ( PRAGMA OPTNAM boolexp )
       | varnam
       | boolexp boolexp

varnam : $LETTERS(DIGITS)


numexp : vdigit
       | ( NUMPHYSICAL palexp )
       | ( NUMMONADIC numdft )
       | ( NUMDYADIC numdft numdft )
       | ( NUMSTRMONADIC strdft )
       | ( NUMSTRDYADIC strdft strdft )
       | ( NUMPAT )
       | NUMPAT 
       | varnam

numdft :       numexp
       |       palexp
       
strexp : VSTRING
       | ( STRPHYSICAL palexp )
       | ( STRMONADIC strdft )
       | ( STRDYADIC strdft strdft )
       | ( STRTRYADIC strdft numdft numdft )
       | ( STRPAT )
       | STRPAT 
       | varnam

strdft : strexp
       | palexp
       
genexp : boolexp
       | numdft
       | strdft


tokens

DIGITS : [0-9]+

VSTRING        : "[^\"\n]*"
       | '[^\"\n]*'

LETTERS        : [a-zA-Z]+


OPTNAM : debug
       | prune
       | volatil

OPTVAL : on
       | off

SPANTYPE       : %s(tart)_h(ead) | %e(nd)_h(ead)
       | %s(tart)_t(ail) | %e(nd)_t(ail)

PALELT : head | tail | loop
       | fullseq(uence) | seqnam(e) | seqinf(o)

VBOOL  : true | false

BOOLPHYSICAL   : direct(strand)

BOOLMONADIC    : not

BOOLDYADIC : and | or | equiv(alent)

NUMCOMPMONADIC : zero

NUMCOMPDYADIC  : eq | ne | gt | ge | lt | le

STRCOMPMONADIC : str(ing)empty

STRCOMPDYADIC  : str(ing)beg(ins)
       | str(ing)end(s)
       | str(ing)c(o)mp(are)

PATDYADIC : pat(tern)match

PATTRYADIC : pat(tern)compil(e)

BOOLPAT        : pat(tern)search

SETMONADIC : set

VARCOMP        : exist(s)

PRINTDYADIC : print(f)

IFMONADIC      : if

WHILEMONADIC : while

PRAGMA : pragma


NUMPHYSICAL    : start | end
       | length | energ(y)

NUMMONADIC     : opp(osite) | sq(uare)

NUMDYADIC : add | sub(s)(tract)
       | mul(tiply) | div(ide) | mod(ulo)

NUMSTRMONADIC  : str(ing)len

NUMSTRDYADIC   : scoremat(rix)

NUMPAT : matchpos(ition)
       | matcherr(or)(s)

STRPHYSICAL    : seq(uence)

STRMONADIC     : complem(ent)
       | inver(se)
       | complinv(erse)

STRDYADIC      : str(ing)cat

STRTRYADIC     : s(ub)str(ing)

STRPAT : matchfrag(ment)