[gforth] / gforth / vmgen-ex2 / mini.l  

gforth: gforth/vmgen-ex2/mini.l

Diff for /gforth/vmgen-ex2/mini.l between version 1.2 and 1.5

version 1.2, Sun Jun 2 17:02:56 2002 UTC version 1.5, Mon Aug 25 14:17:56 2003 UTC
Line 1 
Line 1 
   %{
 /* front-end scanner for vmgen example  /* front-end scanner for vmgen example
   
   Copyright (C) 2001 Free Software Foundation, Inc.    Copyright (C) 2001,2003 Free Software Foundation, Inc.
   
   This file is part of Gforth.    This file is part of Gforth.
   
Line 21 
Line 22 
   
 /* %option yylineno (flex option, implied by flex -l) */  /* %option yylineno (flex option, implied by flex -l) */
   
 %{  #include <stdlib.h>
 #ifndef __GNUC__  
 #include <string.h>  #include <string.h>
 char *strdup(const char *s);  char *mystrdup(const char *s)
 #endif  {
     char *t=malloc(strlen(s)+1);
     return strcpy(t,s);
   }
 %}  %}
   
 %%  %%
Line 42 
Line 45 
 do      return DO;  do      return DO;
 print   return PRINT;  print   return PRINT;
 [0-9]+                  { yylval.num=strtol(yytext,NULL,10); return NUM; }  [0-9]+                  { yylval.num=strtol(yytext,NULL,10); return NUM; }
 [a-zA-Z\_][a-zA-Z0-9\_]*        { yylval.string=strdup(yytext); return IDENT; }  [a-zA-Z\_][a-zA-Z0-9\_]*        { yylval.string=mystrdup(yytext); return IDENT; }
 [ \t\n] ;  [ \t\n] ;
 [/][/].*        ;  [/][/].*        ;
 .               yyerror("illegal character"); exit(1);  .               yyerror("illegal character"); exit(1);


Generate output suitable for use with a patch program
Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help