⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 encode.g

📁 編譯器的accent語法分析器
💻 G
📖 第 1 页 / 共 2 页
字号:
      where(Pos+N+3 -> NextPos)      PC <- NextPos      LastClauseKey <- Key      Key'Pos <- Pos      Key'NextClausePos <- NextPos      CurLhsPos -> LhsPos      Key'LhsPos <- LhsPos'action' Length(ELEMS -> INT)   'rule' Length(elems(Elems, Elem) -> N+1)      Length(Elems -> N)   'rule' Length(nil -> 0)--------------------------------------------------------------------------------'action' write_code_LHSKEYS(LHSKEYS)   'rule' write_code_LHSKEYS(keys(Keys,Key))      write_code_LHSKEYS(Keys)      write_code_LHSKEY(Key)   'rule' write_code_LHSKEYS(nil)'action' write_code_LHSKEY(LHSKEY)   'rule' write_code_LHSKEY(Key)      Key'Clauses -> Clauses      write_code_CLAUSEKEYS(Clauses)'action' write_code_CLAUSEKEYS(CLAUSEKEYS)   'rule' write_code_CLAUSEKEYS(clausekeys(Clauses, Clause))      write_code_CLAUSEKEYS(Clauses)      write_code_CLAUSEKEY(Clause)   'rule' write_code_CLAUSEKEYS(nil)'action' write_code_CLAUSEKEY(CLAUSEKEY)   'rule' write_code_CLAUSEKEY(Key)      Key'Elems -> Elems      Key'NextClausePos -> Chain      set_field(Chain)      write_code_ELEMS(Elems)      Key'LhsPos -> LhsPos      set_field(-LhsPos)      Key'Number -> RuleNumber      set_field(RuleNumber)'action' write_code_ELEMS(ELEMS)   'rule' write_code_ELEMS(elems(Elems, Elem))      write_code_ELEMS(Elems)      write_code_ELEM(Elem)   'rule' write_code_ELEMS(nil)'action' write_code_ELEM(ELEM)   'rule' write_code_ELEM(nonterm(Id,_,_))      LhsKeyForNonterm(Id -> LhsKey)      LhsKey'Pos -> Pos      set_field(Pos)   'rule' write_code_ELEM(token(N))      term_base -> TERMBASE      set_field(N+TERMBASE)   'rule' write_code_ELEM(subphrase(SKey,_,_))      LhsKeyForSubphrase(SKey -> LhsKey)      LhsKey'Pos -> Pos      set_field(Pos)'var' FieldIndex: INT'action' set_field(INT)   'rule' set_field(N)      FieldIndex -> X      Put("/* ") PutI(X) Put(" */ ") PutI(N) Put(",") Nl      FieldIndex <- X+1--------------------------------------------------------------------------------'action' write_annotation_LHSKEYS(LHSKEYS)   'rule' write_annotation_LHSKEYS(keys(Keys,Key))      write_annotation_LHSKEYS(Keys)      write_annotation_LHSKEY(Key)   'rule' write_annotation_LHSKEYS(nil)'action' write_annotation_LHSKEY(LHSKEY)   'rule' write_annotation_LHSKEY(Key)      Key'Clauses -> Clauses      write_annotation_CLAUSEKEYS(Clauses)'action' write_annotation_CLAUSEKEYS(CLAUSEKEYS)   'rule' write_annotation_CLAUSEKEYS(clausekeys(Clauses, Clause))      write_annotation_CLAUSEKEYS(Clauses)      write_annotation_CLAUSEKEY(Clause)   'rule' write_annotation_CLAUSEKEYS(nil)'action' write_annotation_CLAUSEKEY(CLAUSEKEY)   'rule' write_annotation_CLAUSEKEY(Key)      Key'Elems -> Elems      Key'NextClausePos -> Chain      set_field(Chain)      write_annotation_ELEMS(Elems)      Key'LhsPos -> LhsPos      set_field(-LhsPos)      Key'RuleAnnotation -> Annotation      (|	 where(Annotation -> prio(N))         set_field(N)      ||	 where(Annotation -> undef)	 set_field(-1)      |)'action' write_annotation_ELEMS(ELEMS)   'rule' write_annotation_ELEMS(elems(Elems, Elem))      write_annotation_ELEMS(Elems)      write_annotation_ELEM(Elem)   'rule' write_annotation_ELEMS(nil)'action' write_annotation_ELEM(ELEM)   'rule' write_annotation_ELEM(nonterm(Id, Annotation,_))      (|	 where(Annotation -> short)	 set_field(1)      ||	 where(Annotation -> long)	 set_field(2)      ||	 where(Annotation -> undef)	 set_field(-1)      |)   'rule' write_annotation_ELEM(token(N))      term_base -> TERMBASE      set_field(N+TERMBASE)   'rule' write_annotation_ELEM(subphrase(SKey,Annotation,_))      (|	 where(Annotation -> short)	 set_field(1)      ||	 where(Annotation -> long)	 set_field(2)      ||	 where(Annotation -> undef)	 set_field(-1)      |)--------------------------------------------------------------------------------'action' write_coordinates_LHSKEYS(LHSKEYS)   'rule' write_coordinates_LHSKEYS(keys(Keys,Key))      write_coordinates_LHSKEYS(Keys)      write_coordinates_LHSKEY(Key)   'rule' write_coordinates_LHSKEYS(nil)'action' write_coordinates_LHSKEY(LHSKEY)   'rule' write_coordinates_LHSKEY(Key)      Key'Clauses -> Clauses      write_coordinates_CLAUSEKEYS(Clauses)'action' write_coordinates_CLAUSEKEYS(CLAUSEKEYS)   'rule' write_coordinates_CLAUSEKEYS(clausekeys(Clauses, Clause))      write_coordinates_CLAUSEKEYS(Clauses)      write_coordinates_CLAUSEKEY(Clause)   'rule' write_coordinates_CLAUSEKEYS(nil)'action' write_coordinates_CLAUSEKEY(CLAUSEKEY)   'rule' write_coordinates_CLAUSEKEY(Key)      Key'Elems -> Elems      Key'NextClausePos -> Chain      set_field(9999)      write_coordinates_ELEMS(Elems)      Key'LhsPos -> LhsPos      set_field(9999)      Key'Coordinate -> Coordinate      POS_to_INT(Coordinate -> N)      set_field(N)'action' write_coordinates_ELEMS(ELEMS)   'rule' write_coordinates_ELEMS(elems(Elems, Elem))      write_coordinates_ELEMS(Elems)      write_coordinates_ELEM(Elem)   'rule' write_coordinates_ELEMS(nil)'action' write_coordinates_ELEM(ELEM)   'rule' write_coordinates_ELEM(nonterm(Id, Annotation, Coordinate))      POS_to_INT(Coordinate -> N)      set_field(N)   'rule' write_coordinates_ELEM(token(N))      set_field(9999)   'rule' write_coordinates_ELEM(subphrase(SKey, _, Coordinate))      POS_to_INT(Coordinate -> N)      set_field(N)--------------------------------------------------------------------------------'action' write_dir_sets_LHSKEYS(LHSKEYS)   'rule' write_dir_sets_LHSKEYS(keys(Keys,Key))      write_dir_sets_LHSKEYS(Keys)      write_dir_sets_LHSKEY(Key)   'rule' write_dir_sets_LHSKEYS(nil)'action' write_dir_sets_LHSKEY(LHSKEY)   'rule' write_dir_sets_LHSKEY(Key)      Key'Clauses -> Clauses      write_dir_sets_CLAUSEKEYS(Clauses)'action' write_dir_sets_CLAUSEKEYS(CLAUSEKEYS)   'rule' write_dir_sets_CLAUSEKEYS(clausekeys(Clauses, Clause))      write_dir_sets_CLAUSEKEYS(Clauses)      write_dir_sets_CLAUSEKEY(Clause)   'rule' write_dir_sets_CLAUSEKEYS(nil)'action' write_dir_sets_CLAUSEKEY(CLAUSEKEY)   'rule' write_dir_sets_CLAUSEKEY(Key)      Key'Number -> K      Key'RuleHandle -> Handle      get_dirset(Handle -> Set)      write_set(K, Set)--------------------------------------------------------------------------------'action' write_set(INT, SET)--------------------------------------------------------------------------------'action' encode_root_rule'rule' encode_root_rule    set_field(0)    set_field(6)    term_base -> TERMBASE    set_field(TERMBASE)    set_field(-1)    set_field(0)--------------------------------------------------------------------------------'action' LhsKeyForNonterm(IDENT -> LHSKEY)   'rule' LhsKeyForNonterm(Id -> K)      LHS_List -> L      lookup_Id(L, Id -> K)'action' lookup_Id(LHSKEYS, IDENT -> LHSKEY)   'rule' lookup_Id(keys(Keys, Key), Id -> K):      (|         Key'Lhs -> nonterm(Id0)	 eq(Id, Id0)	 where(Key -> K)      ||	 lookup_Id(Keys, Id -> K)      |)   'rule' lookup_Id(nil, Id -> K)      K :: LHSKEY      K'Lhs <- nonterm(Id)      K'Clauses <- nil      LHS_List -> List      LHS_List <- keys(List, K)--------------------------------------------------------------------------------'action' LhsKeyForSubphrase(SUBPHRASEKEY -> LHSKEY)   'rule' LhsKeyForSubphrase(Id -> K)      LHS_List -> L      lookup_Subphrase(L, Id -> K)'action' lookup_Subphrase(LHSKEYS, SUBPHRASEKEY -> LHSKEY)   'rule' lookup_Subphrase(keys(Keys, Key), Id -> K):      (|         Key'Lhs -> subphrase(Id0)	 eq(Id, Id0)	 where(Key -> K)      ||	 lookup_Subphrase(Keys, Id -> K)      |)   'rule' lookup_Subphrase(nil, Id -> K)      K :: LHSKEY      K'Lhs <- subphrase(Id)      K'Clauses <- nil      LHS_List -> List      LHS_List <- keys(List, K)--------------------------------------------------------------------------------'action' write_printnames'rule' write_printnames   LHS_List -> LhsKeys   Put("char * yyprintname(n)") Nl   Put("   int n;") Nl   Put("{") Nl   term_base -> TERMBASE   Put("   if (n <= ") PutI(TERMBASE)Put (")") Nl   Put("      switch(n) {") Nl   write_nonterms_LHSKEYS(LhsKeys)   Put("   }") Nl   Put("   else ") Nl   Put("      switch(n-") PutI(TERMBASE) Put(") {") Nl   lex_printnames   Put("   }") Nl   Put("   return \"<character>\";") Nl   Put("}") Nl'action' write_nonterms_LHSKEYS(LHSKEYS)   'rule' write_nonterms_LHSKEYS(keys(Keys,Key))      write_nonterms_LHSKEYS(Keys)      write_nonterms_LHSKEY(Key)   'rule' write_nonterms_LHSKEYS(nil)'action' write_nonterms_LHSKEY(LHSKEY)   'rule' write_nonterms_LHSKEY(Key)      Key'Lhs -> Lhs      Key'Pos -> Pos      Put("         case ")      PutI(Pos)      Put(": return \"")      (|	 where(Lhs -> nonterm(Id))	 id_to_string(Id -> Str)	 Put(Str)      ||	 where(Lhs -> subphrase(Sub))	 Put("Subphrase")      |)      Put("\"; break;")      Nl'action' POS_to_INT (POS -> INT)'var' TABLEUPB2: INT'action' TableUpb2(INT)   'rule' TableUpb2(N)      TABLEUPB2 -> Old      [|	 gt(N, Old)	 TABLEUPB2 <- N      |]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -