fork download
  1. lex_by_file( FileName ) :-
  2. get_input_from_file( FileName, TokenList ),
  3. lex( TokenList, OutputList ),
  4. %write_output( OutputList ), !.
  5. maplist(writeln,OutputList),!.
  6.  
  7. %% atom_number(atom, number)
  8. %{
  9. #include<stdio.h>
  10. %}
  11.  
  12. %%
  13. [1*001+01*]+] {printf("valid");}
  14.  
  15. .* {printf("invalid"); }
  16. %%
  17.  
  18.  
  19. int main()
  20. {
  21. printf("\n Enter the input");
  22. yylex();
  23. return 0;
  24. }
Success #stdin #stdout #stderr 0.04s 6984KB
stdin
10010
stdout
Standard output is empty
stderr
ERROR: /home/RHLMUE/prog:24:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit