当前位置: 首页 > news >正文

模版网站如何建站哪里可以做免费网站

模版网站如何建站,哪里可以做免费网站,四川成都现在可以去吗,证件制作Lex Flex 简介Lex是lexical compiler的缩写#xff0c;是Unix环境下非常著名的工具#xff0c; Lex (最早是埃里克施密特和 Mike Lesk 制作)是许多 UNIX 系统的标准词法分析器(lexical analyzer)产生程式#xff0c;而且这个工具所作的行为被详列为 POSIX 标准的一部分…Lex Flex 简介Lex是lexical compiler的缩写是Unix环境下非常著名的工具 Lex (最早是埃里克·施密特和 Mike Lesk 制作)是许多 UNIX 系统的标准词法分析器(lexical analyzer)产生程式而且这个工具所作的行为被详列为 POSIX 标准的一部分。Lex的基本工作原理为由正则表达式生成NFA将NFA变换成DFADFA经化简后模拟生成词法分析器。Lex 主要功能是生成一个词法分析器(scanner)的 C 源码,描述规则采用正则表达式(regular expression)。描述词法分析器的文件 *.l 经过lex编译后生成一个lex.yy.c 的文件然后由 C 编译器编译生成一个词法分析器。词法分析器简言之就是将输入的各种符号转化成相应的标识符(token)转化后的标识符很容易被后续阶段处理如Yacc 或 Bison过程如图 在linux系统上我们最常用的是FlexFlex (fast lexical analyser generator) 是 Lex 的另一个替代品。它经常和自由软件 Bison 语法分析器生成器 一起使用。Flex 最初由 Vern Paxson 于 1987 年用C语言写成。Flex手册里对 Flex 描述如下:FLEX (fast lexical analyzer generator) is a tool/computer program for generating lexical analyzers (scanners or lexers) written by Vern Paxson in C around 1987. It is used together with Berkeley Yacc parser generator or GNU Bison parser generator. Flex and Bison both are more flexible than Lex and Yacc and produces faster code.Bison produces parser from the input file provided by the user. The function yylex() is automatically generated by the flex when it is provided with a .l file and this yylex() function is expected by parser to call to retrieve tokens from current/this token stream.Lex Flex 输入文件格式Flex 的输入文件包含了三部分分别是定义区(definitions)、规则区(rules)和用户代码区(user code)并且由单独占一行的两个连续的百分号(%%)分隔开definitions%%rules%%user code下面对 Flex 输入文件的三个部分做出解释1 定义部分定义部分包含变量的声明正则定义清单常量。在定义部分文本放在“{}”括号中。用花括号括起来的所有内容都会直接复制到lex.yy.c文件中。语法%{// Definitions%}2 规则部分rules部分包含一系列规则格式为pattern action并且模式 pattern 位于行首不能缩进action 也应该起始于同一行规则部分包含在“%% %%”中。语法%%pattern action%%下表显示了一些模式匹配。PatternIt can match with[0-9]all the digits between 0 and 9[09]either 0, or 9[0, 9]either 0, ‘, ‘ or 9[0 9]either 0, ‘ ‘ or 9[-09]either -, 0 or 9[-0-9]either – or all digit between 0 and 9[0-9]one or more digit between 0 and 9[^a]all the other characters except a[^A-Z]all the other characters except the upper case lettersa{2, 4}either aa, aaa or aaaaa{2, }two or more occurrences of aa{4}exactly 4 a’s i.e, aaaa.any character except newlinea*0 or more occurrences of aa1 or more occurrences of a[a-z]all lower case letters[a-zA-Z]any alphabetic letterw(x \y)zwxz or wyz3 用户代码部分这部分包含C语句和其他功能。我们还可以分别编译这些函数并使用词法分析器加载。如何运行程序要运行该程序首先应将其保存为扩展名.l或.lex。在终端上运行以下命令以运行程序文件。步骤1lex filename.l或lex filename.lex取决于扩展文件步骤2gcc lex.yy.c步骤3./ a.out步骤4在需要时将输入提供给程序注意按Ctrl D或使用某些规则停止接受用户输入。请查看以下程序的输出图像以清除是否有疑问以运行程序。简单例子计算字符串中的字符数/*** Definition Section has one variablewhich can be accessed inside yylex()and main() ***/%{int count 0;%}/*** Rule Section has three rules, first rulematches with capital letters, second rulematches with any character except newline andthird rule does not take input after the enter***/%%[A-Z] {printf(%s capital letter\n, yytext);count;}. {printf(%s not a capital letter\n, yytext);}\n {return 0;}%%/*** Code Section prints the number ofcapital letter present in the given input***/int yywrap(){}int main(){// Explanation:// yywrap() - wraps the above rule section/* yyin - takes the file pointerwhich contains the input*//* yylex() - this is the main flex functionwhich runs the Rule Section*/// yytext is the text in the buffer// Uncomment the lines below// to take input from file// FILE *fp;// char filename[50];// printf(Enter the filename: \n);// scanf(%s,filename);// fp fopen(filename,r);// yyin fp;yylex();printf(\nNumber of Captial letters in the given input - %d\n, count);return 0;}运行查找读取文本所有整数%{/*用flex写一个查找读取文本所有整数的程序*/int count 0;%}%%[-]?[0-9] { count; printf(%s\n, yytext); } /* Print integers */\n {} /* newline */. {} /* For others, do nothing */%%void main() {yylex();printf(Number count is %d\n, count);}int yywrap() {return 1;}运行参考文章
http://wiki.neutronadmin.com/news/237313/

相关文章:

  • 网站运营内容包含哪些怎么下载浏览器里的视频
  • 泉州北京网站建设手机网站 普通网站
  • 烟台做网站电话交易平台网站建设
  • 北京各大网站推广服务公司wordpress 更改插件目录
  • 网站制作关键杭州企业网站制作哪个好
  • 商城网站建设哪家便宜tag in wordpress
  • 如何建立p2p网站做一个官网需要多少钱
  • 珠海品牌型网站建设wordpress 地区联动
  • 网站指向邮箱超链接怎么做wordpress 移动端 主题
  • 想学做宝宝食谱上什么网站网站开发新手什么软件好
  • 网站改版公司哪家好建设工程安全管理网站
  • 一个网站上面有名优网页设计师证书报名官网
  • 网站建设学校培训学校宝塔安装wordpress无法访问
  • 网站底部浮动wordpress 修改title
  • 网站建设名词解析小程序 wordpress打包
  • 网站建站第十四课dede响应式网站模板下载
  • 桂林医院网站建设公司包装推广
  • phpcms 移动网站模板房地产公司 网站建设
  • 做网站要用到数据库吗国家市场监督管理
  • 领硕网站seo优化网络浏览器
  • 优建网站无锡大型设计网站报价
  • 高考志愿网站开发p2p网站建设方案书
  • 用照片做视频的网站好打开陕西建设厅网站
  • 自己创建网站个人怎么注册小型公司
  • 能够做冶金工程毕业设计的网站医药网站建设中图片
  • 如何申请免费的网站空间备案域名购买
  • 成品网站整套源码大型门户网站建设所具有的功能模块主要有几种类型
  • 山西手机响应式网站建设网站模板后台怎么做
  • 庙行网站建设php网站的登陆注册怎末做的
  • 织梦dede做网站的优点赣州