Mon, 01 Sep 2025 00:14:59 +0800
Initial Lexer/Parser
| 0 | 1 | project('tlvc', 'c', |
| 2 | version : '0.1', | |
| 3 | default_options : ['warning_level=3']) | |
| 4 | ||
| 5 | flex = find_program('flex') | |
| 6 | bison = find_program('bison') | |
| 7 | ||
| 8 | lexer = generator( | |
| 9 | flex, | |
| 10 | output : [ '@BASENAME@.yy.c', '@BASENAME@.yy.h' ], | |
| 11 | arguments : [ | |
| 12 | '--outfile=@OUTPUT0@', | |
| 13 | '--header-file=@OUTPUT1@', | |
| 14 | '@INPUT@' | |
| 15 | ] | |
| 16 | ) | |
| 17 | ||
| 18 | parser = generator( | |
| 19 | bison, | |
| 20 | output : [ '@BASENAME@.tab.c', '@BASENAME@.tab.h' ], | |
| 21 | arguments : [ | |
| 22 | '-d', '@INPUT@', '-v', | |
| 23 | '--output=@OUTPUT0@', | |
| 24 | '--defines=@OUTPUT1@' | |
| 25 | ] | |
| 26 | ) | |
| 27 | ||
| 28 | parser_src = parser.process('tlvc.y') | |
| 29 | lexer_src = lexer.process('tlvc.l') | |
| 30 | ||
| 31 | SOURCES = [ | |
| 32 | 'tlvc.c', | |
| 33 | parser_src, | |
| 34 | lexer_src, | |
| 35 | ] | |
| 36 | ||
| 37 | exe = executable('tlvc', SOURCES, | |
| 38 | include_directories : include_directories('.'), | |
| 39 | install : true) | |
| 40 | ||
| 41 | test('basic', exe) |