Changeset 3855


Ignore:
Timestamp:
Jul 18, 2008, 10:40:53 PM (12 years ago)
Author:
yura
Message:
  • Program and Sentence
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/doc/abstract_syntax_new.txt

    r3854 r3855  
     1// PROGRAM
     2
    13t.Syntax ::= t.Module | t.Interface
    24
    3 t.Module ::= (MODULE t.ModuleName e.ModuleBody)
     5t.Module ::= (MODULE t.Pragma t.Name e.Body)
    46
    5 t.Interface ::= (INTERFACE t.InterfaceName e.InterfaceBody)
     7t.Interface ::= (INTERFACE t.Pragma t.Name e.Body)
    68
    7 t.ModuleName ::= t.Name
    8 
    9 t.InterfaceName ::= t.Name
    10 
    11 e.ModuleBody ::= t.Item | e.ModuleBody t.Item
     9e.Body ::= [Empty] | e.ModuleBody t.Item
    1210
    1311t.Item ::= t.Function | t.Object | t.Const
    1412
    1513s.Linkage ::= s.IntLinkage | s.ExtLinkage
    16 
    1714s.IntLinkage ::= EXPORT | LOCAL
    18 
    1915s.ExtLinkage ::= IMPORT
    2016
    21 t.Function ::= (s.IntLinkage s.FunctionTag t.Pragma t.FunctionName
    22                 t.InputFormat t.OutputFormat t.Branch)
    23              | (s.ExtLinkage s.FunctionTag t.Pragma t.FunctionName
    24                 t.InputFormat t.OutputFormat)
    25 
     17t.Function ::= (FUNC t.Pragma s.IntLinkage s.FunctionTag t.Name t.Format t.Format t.Sentence)
     18             | (FUNC t.Pragma s.ExtLinkage s.FunctionTag t.Name t.Format t.Format)
    2619s.FunctionTag ::= FUNC | FUNC?
    2720
    28 t.Pragma ::= (PRAGMA e.PragmaBody)
    2921
    30 e.PragmaBody ::= [Empty] | t.PragmaTerm e.PragmaBody
     22t.Object ::= (OBJECT t.Pragma s.Linkage s.ObjectType t.Name)
     23s.ObjectType ::= TABLE | BOX | STRING | VECTOR | CHANNEL
    3124
    32 t.PragmaTerm ::= (FILE e.FileName)
    33                | (LINE s.Line s.Column)
    34                | (TRACE e.TraceNames)
     25t.Const ::= (CONST t.Pragma s.Linkage t.Name t.ConstExpression)
    3526
    36 e.FileName ::= [Sequence of liters]
     27// new:
     28t.Value ::= (VALUE t.Pragma s.Linkage t.Name t.ResultExpression)
     29t.Initializer ::= (EXEC e.ResultExpression)
    3730
    38 s.Line ::= [Number]
     31// SENTENCE
    3932
    40 s.Column ::= [Number]
     33e.Sentences ::= [Empty] | t.Sentence e.Sentences
    4134
    42 e.TraceNames ::= [Empty] | t.TraceName e.TraceNames
     35t.Sentence ::= (BRANCH t.Pragma e.Statements)
    4336
    44 t.TraceName ::= t.Name
    45 
    46 t.FunctionName ::= t.Name
    47 
    48 t.InputFormat ::= t.FunFormat
    49 
    50 t.OutputFormat ::= t.FunFormat
    51 
    52 t.FunFormat ::= (e.HardExpression)
    53 
    54 t.Format ::= (FORMAT t.Pragma e.HardExpression)
    55 
    56 e.Sentence ::= [Empty] | t.Statement e.Sentence
     37e.Statements ::= [Empty] | t.Statement e.Statements
    5738
    5839t.Statement ::= t.Action | t.Operator | t.ComplexOperator
     
    6041t.Action ::= t.Alt | t.Pattern | t.Result | t.Format
    6142
    62 t.Alt ::= (ALT  t.Pragma e.Branches)
    63         | (ALT? t.Pragma e.Branches)
     43t.Alt ::= (ALT t.Pragma s.type e.Sentences)
     44s.type ::= FAIL | NOFAIL
    6445
    65 e.Branches ::= [Empty] | t.Branch e.Branches
     46t.Pattern ::= (PATTERN t.Pragma s.Direction t.PatternExpression)
     47s.Direction ::= LEFT | RIGHT
    6648
    67 t.Branch ::= (BRANCH t.Pragma e.Sentence)
     49t.Result ::= (RESULT t.Pragma t.ResultExpression)
     50
     51t.Format ::= (FORMAT t.Pragma t.HardExpression)
    6852
    6953t.Operator ::= (CUT    t.Pragma)
     
    7357             | (NOFAIL t.Pragma)
    7458
    75 t.ComplexOperator ::= (NOT   t.Branch)
    76                     | (ERROR t.Branch)
    77                     | (ITER  t.IterBody t.IterVars)
    78                     | (TRY   t.TryBranch t.CatchBranch)
     59t.ComplexOperator ::= (NOT   t.Pragma t.Sentence)
     60                    | (ERROR t.Pragma t.Sentence)
     61                    | (ITER  t.Pragma t.Sentence t.HardExpression)
     62                    | (TRY   t.Pragma t.Sentence t.Sentence)
    7963
    80 t.IterBody ::= t.Branch
    81 
    82 t.IterVars ::= t.Format
    83 
    84 t.TryBranch ::= t.Branch
    85 
    86 t.CatchBranch ::= t.Branch
    87 
    88 t.Pattern ::= (LEFT  t.Pragma e.PatternExpression)
    89             | (RIGHT t.Pragma e.PatternExpression)
    90 
    91 t.Name ::= (e.QualifiedName)
    92 
    93 e.QualifiedName ::= [Word] | e.QualifiedName [Word]
    94 
    95 t.Result ::= (RESULT t.Pragma e.ResultExpression)
    96 
    97 s.ObjectSymbol ::= [Symbol]
    98 
    99 t.Object ::= (s.Linkage s.ObjectType t.Pragma t.ObjectName)
    100 
    101 s.ObjectType ::= TABLE | BOX | STRING | VECTOR | CHANNEL
    102 
    103 t.ObjectName ::= t.Name
    104 
    105 t.Initializer ::= (EXEC e.ResultExpression)
    106 
    107 t.Const ::= (s.Linkage CONST t.Pragma t.ConstName e.ConstExpression)
    108 
    109 t.ConstName ::= t.Name
    110 
    111 
    112 
     64// EXPRESSION
    11365
    11466t.ConstExpression   ::= t.Expression  // without call, vars
     
    12981t.Symbol ::= (SYMBOL t.Pragma e.Data) | (REF t.Pragma t.Name)
    13082
    131 t.Variable ::= (VAR t.Pragma s.Type t.Name) | (VAR t.Pragma s.Type)
     83t.Variable ::= (VAR t.Pragma s.VarType t.Name) | (VAR t.Pragma s.VarType)
    13284
    133 s.Type ::= E | V | T | S
     85s.VarType ::= E | V | T | S
    13486
    135 t.Name ::= (NAME t.Pragma e.Name)
     87// NAME
     88
     89t.Name ::= (NAME t.Pragma e.QualifiedName)
     90
     91e.QualifiedName ::= [Word] | [Word] e.QualifiedName
     92
     93// PRAGMA
     94
     95t.Pragma ::= (PRAGMA e.PragmaBody)
     96
     97e.PragmaBody ::= [Empty] | t.PragmaTerm e.PragmaBody
     98
     99t.PragmaTerm ::= (FILE e.FileName)
     100               | (LINE s.Line s.Column)
     101               | (TRACE e.TraceNames)
     102               | ...
     103
     104e.FileName ::= [Sequence of liters]
     105
     106s.Line ::= [Number]
     107
     108s.Column ::= [Number]
     109
     110e.TraceNames ::= [Empty] | t.Name e.TraceNames
Note: See TracChangeset for help on using the changeset viewer.