Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add example2, example3

  • Loading branch information...
commit 4c89fa5566e7a00e85284664aa94873ebeb8fee5 1 parent 9c5f356
Toru Yamaguchi authored
4 .gitignore
View
@@ -3,5 +3,5 @@ CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
-lex.yy.c
-example1
+*.yy.c
+example?
17 CMakeLists.txt
View
@@ -1,6 +1,17 @@
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 2.8)
project (lex_yacc_howto)
+find_package(BISON)
find_package(FLEX)
-FLEX_TARGET(Scanner example1.l ${CMAKE_CURRENT_BINARY_DIR}/lex.yy.cc)
-add_executable(example1 ${FLEX_Scanner_OUTPUTS})
+
+FLEX_TARGET(Example1Scanner example1.l ${CMAKE_CURRENT_BINARY_DIR}/example1.yy.c)
+add_executable(example1 ${FLEX_Example1Scanner_OUTPUTS})
+target_link_libraries(example1 fl)
+
+FLEX_TARGET(Example2Scanner example2.l ${CMAKE_CURRENT_BINARY_DIR}/example2.yy.c)
+add_executable(example2 ${FLEX_Example2Scanner_OUTPUTS})
+target_link_libraries(example2 fl)
+
+FLEX_TARGET(Example3Scanner example3.l ${CMAKE_CURRENT_BINARY_DIR}/example3.yy.c)
+add_executable(example3 ${FLEX_Example3Scanner_OUTPUTS})
+target_link_libraries(example3 fl)
8 example2.l
View
@@ -0,0 +1,8 @@
+%{
+#include <stdio.h>
+%}
+
+%%
+[0123456789]+ printf("NUMBER\n");
+[a-zA-Z][a-zA-Z0-9]* printf("WORD\n");
+%%
14 example3.l
View
@@ -0,0 +1,14 @@
+%{
+#include <stdio.h>
+%}
+
+%%
+[a-zA-Z][a-zA-Z0-9]* printf("WORD ");
+[a-zA-Z0-9\/.-]+ printf("FILENAME ");
+\" printf("QUOTE ");
+\{ printf("OBRACE ");
+\} printf("EBRACE ");
+; printf("SEMICOLON ");
+\n printf("\n");
+[ \t]+ /* Ignore whitespaces */;
+%%
9 example3.txt
View
@@ -0,0 +1,9 @@
+logging {
+ category lame-servers { null; };
+ category cname { null; };
+};
+
+zone "." {
+ type hint;
+ file "/etc/bind/db.root";
+};
Please sign in to comment.
Something went wrong with that request. Please try again.