About: Flex lexical analyser   Sponge Permalink

An Entity of Type : dbkwik:resource/ZwE4O3utshWv1Qc47xdU6Q==, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

This is an example of a Flex scanner for the instructional programming language PL/0. The tokens recognized are: '+', '-', '*', '/', '=', '(', ')', ',', ';', '.', ':=', '<', '<=', '<>', '>', '>='; numbers: 0-9 {0-9}; identifiers: a-zA-Z {a-zA-Z0-9} and keywords: begin, call, const, do, end, if, odd, procedure, then, var, while. %{1. * include "y.tab.h" %} digit [0-9] letter [a-zA-Z] yylval.id = strdup(yytext); return IDENT; } {digit}+ { yylval.num = atoi(yytext); return NUMBER; } [ ] /* skip whitespace */ . { printf("Unknown character [%c] ",yytext[0]); %%

AttributesValues
rdf:type
rdfs:label
  • Flex lexical analyser
rdfs:comment
  • This is an example of a Flex scanner for the instructional programming language PL/0. The tokens recognized are: '+', '-', '*', '/', '=', '(', ')', ',', ';', '.', ':=', '<', '<=', '<>', '>', '>='; numbers: 0-9 {0-9}; identifiers: a-zA-Z {a-zA-Z0-9} and keywords: begin, call, const, do, end, if, odd, procedure, then, var, while. %{1. * include "y.tab.h" %} digit [0-9] letter [a-zA-Z] yylval.id = strdup(yytext); return IDENT; } {digit}+ { yylval.num = atoi(yytext); return NUMBER; } [ ] /* skip whitespace */ . { printf("Unknown character [%c] ",yytext[0]); %%
dcterms:subject
foaf:homepage
dbkwik:babyish/pro...iPageUsesTemplate
Name
  • flex
Genre
  • Lexical analyzer generator
latest release version
  • 2(xsd:double)
License
Operating System
Website
Developer
abstract
  • This is an example of a Flex scanner for the instructional programming language PL/0. The tokens recognized are: '+', '-', '*', '/', '=', '(', ')', ',', ';', '.', ':=', '<', '<=', '<>', '>', '>='; numbers: 0-9 {0-9}; identifiers: a-zA-Z {a-zA-Z0-9} and keywords: begin, call, const, do, end, if, odd, procedure, then, var, while. %{1. * include "y.tab.h" %} digit [0-9] letter [a-zA-Z] %% "+" { return PLUS; } "-" { return MINUS; } "*" { return TIMES; } "/" { return SLASH; } "(" { return LPAREN; } ")" { return RPAREN; } ";" { return SEMICOLON; } "," { return COMMA; } "." { return PERIOD; } ":=" { return BECOMES; } "=" { return EQL; } "<>" { return NEQ; } "<" { return LSS; } ">" { return GTR; } "<=" { return LEQ; } ">=" { return GEQ; } "begin" { return BEGINSYM; } "call" { return CALLSYM; } "const" { return CONSTSYM; } "do" { return DOSYM; } "end" { return ENDSYM; } "if" { return IFSYM; } "odd" { return ODDSYM; } "procedure" { return PROCSYM; } "then" { return THENSYM; } "var" { return VARSYM; } "while" { return WHILESYM; } {letter}({letter}|{digit})* {yylval.id = strdup(yytext); return IDENT; } {digit}+ { yylval.num = atoi(yytext); return NUMBER; } [ ] /* skip whitespace */ . { printf("Unknown character [%c] ",yytext[0]); return UNKNOWN; } %% int yywrap(void){return 1;} The hand-written C code equivalent would likely be at least twice as many lines, and considerably harder to read.
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software