🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1357

Grammer continued 5/5

#1357
From: Cobus Debeer
Date: Mon, 29 Oct 1990 05:19
117 lines
3252 bytes
Grammer continued .... 
 
 
for_statement : FOR ident colon_equals expression TO expression by_opt 
                DO statement_list END; 
by_opt : | by; 
by : BY const_expression; 
with_statement : WITH designator DO statement_list END; 
expression : simple_expression | simple_expression relation 
simple_expression; 
simple_expression : sign_opt term | simple_expression add_operator term; 
add_operator : plus | minus | OR; 
sign_opt : | sign; 
sign : plus | minus; 
term : factor | term mul_operator factor; 
mul_operator : asterisk | slash | DIV | MOD | AND | ampersand; 
factor : number | string | set | designator actual_parameters_opt | 
         left_parenthesis expression right_parenthesis | NOT factor; 
number : integer | real; 
set : qualident_opt left_curley_bracket element_list_opt 
      right_curley_bracket; 
qualident_opt : | qualident; 
element_list_opt :  | element_list; 
element_list : element | element_list comma element; 
element : case_label; 
%% 
#include <stdio.h> 
char *filename="-"; 
main(argc, argv)  
int argc; 
char *argv[]; 
{  
  register int rc=0; 
  extern int yynerrs; 
  extern int yylineno; 
  if (argc <= 1)  
      yyparse(); 
  else  
     { 
       while (argc > 1)  
       { if (freopen(argv[1], "r", stdin)==NULL) { 
             fprintf(stderr, "m2c: %s: cannot open\n", argv[1]); 
             rc++; } 
         else { 
             filename=argv[1]; 
             yylineno=1; 
             yyparse(); } 
         argc--; argv++; 
       } 
      } 
   if (yynerrs > 0) rc++;  
   return(rc); 
} 
#include "lex.yy.c" 
yyerror(s) 
 char *s; 
{ 
 fprintf(stderr, "\"%s\", line %d: %s\n",  
         filename, yylineno, s); 
} 
====makefile 
m2c : m2c.l m2c.y 
        lex m2c.l; yacc m2c.y; cc y.tab.c -ll -o m2c 
====m2c.1 (=man page) 
.\" $Header: m2c.1, 87/05/26 corn Stab $ 
.de SB 
.\" SuBheader 
.sp 1 
.nr Sf \\n(.f 
.ft B 
.PP 
\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 
.ft \\n(Sf 
.sp 1 
.. 
.TH M2C I 
.ad 
.SH NAME 
m2c \- Modula 2 Syntax Checker 
.SH SYNOPSIS 
\fBm2c\fP [file...] 
.SH DESCRIPTION 
.PP 
.PP 
.PP 
.PP 
\fIm2c\fP accepts any number of file arguments.  
.PP 
.SH "SEE ALSO" 
.PD 0 
.br 
.nf 
.fi 
.PP 
.SH KNOWN BUGS/BODGES/LIMITATIONS 
.PP 
m2c does not always recover from syntax errors. 
.PP 
Feel free to distribute m2c further but please acknowledge use/references. 
.PP 
.SH AUTHOR 
.PP 
.nf 
Cornelia Boldyreff 
Department of Computer Science 
Brunel University 
Uxbridge UB8 3PH 
The United Kingdom 
.br 
 
Regards  
- Cobus de Beer 


--  
uucp: uunet!m2xenix!puddle!5!491!1.0!Cobus.Debeer
Internet: Cobus.Debeer@p0.f1.n491.z5.fidonet.org
Technical Details
Message-ID: <293.27304630@puddle.fidonet.org>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p0.f1.n491.z5.fidonet.org!Cobus.Debeer

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p0.f1.n491.z5.fidonet.org!Cobus.Debeer
From: Cobus.Debeer@p0.f1.n491.z5.fidonet.org (Cobus Debeer)
Newsgroups: comp.lang.modula2
Subject: Grammer continued 5/5
Message-ID: <293.27304630@puddle.fidonet.org>
Date: 29 Oct 90 05:19:22 GMT
Sender: ufgate@puddle.fidonet.org (newsout1.26)
Organization: FidoNet node 5:491/1.0 - Golden City Opus, Johannesburg RSA
Lines: 117