home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / EXAMPLES / SUPERLIN / SL_PARSE.LF < prev    next >
Text File  |  1996-06-04  |  2KB  |  108 lines

  1. %
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. %
  4. %
  5. %                                SUPERLINT
  6. %                                ---------
  7. %
  8. %  
  9. %
  10. %
  11. %  AUTHOR : Arnaud Venet                     CREATION : September 7th 1993
  12. %  ------                                    --------
  13. %
  14. %
  15. %                             ---------------                        
  16. %
  17. %                    
  18. %                   Last modification : September 20th 1993 
  19. %
  20. %
  21. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  22. %
  23. %
  24. %
  25. %
  26. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  27. %
  28.  
  29.  
  30.  
  31. module("sl_parser") ?
  32.  
  33.  
  34. public(sl_parse) ?
  35.  
  36.  
  37. %
  38. % ------------------------------------------------------------------------------
  39. %
  40.  
  41.  
  42. write_err("Loading...") ?
  43.  
  44.  
  45. load("c_public_terms") ?
  46.  
  47.  
  48. open("c_public_terms") ?
  49.  
  50.  
  51. %
  52. % ------------------------------------------------------------------------------
  53. %
  54.  
  55.  
  56. import("accumulators") ?
  57.  
  58. acc_info(dcg,Term, Xs, Ys, acc_pred => 'C'(Term,false,Xs,Ys),
  59.      in_name => 0, out_name => rest) ?
  60.  
  61. expand_load(true) ?
  62.  
  63.  
  64. load("c_parser") ?
  65.  
  66.  
  67. open("c_parser") ?
  68.  
  69.  
  70. write_err("done"), nl_err ?
  71.  
  72.  
  73. %
  74. % ------------------------------------------------------------------------------
  75. %
  76.  
  77.  
  78. sl_parse(Term) :-
  79.   c_parse(tree => Tree, parse_mode => heavy, error => ParseError) & Term,
  80.   syntactic_tree <<- Tree,
  81.   cond(ParseError :== true,
  82.     (
  83.       write_err(">>> superlint : error in parse"),
  84.       nl_err,
  85.       write_err(">>> superlint : abort"),
  86.       nl_err,
  87.       halt
  88.     )
  89.   ).
  90.  
  91.  
  92. %
  93. % ------------------------------------------------------------------------------
  94. %
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.