Skip to content

Commit fdfc29c

Browse files
authored
Merge pull request #2012 from farhi/grammar-multiple-comp-copy-extend
Grammar multiple comp copy extend
2 parents 19b4425 + 8cd3780 commit fdfc29c

File tree

9 files changed

+249
-164
lines changed

9 files changed

+249
-164
lines changed

cmake/Modules/InstallMCCODE.cmake

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -261,35 +261,27 @@ macro(installMCCODE)
261261
)
262262

263263

264-
## Generate lex.yy.c with flex
264+
## Generate lex.yy.c with flex (C generator)
265265
add_custom_command(
266266
OUTPUT work/src/lex.yy.c
267267
COMMAND "${FLEX_EXECUTABLE}" -i "${PROJECT_SOURCE_DIR}/src/instrument.l"
268268
WORKING_DIRECTORY work/src
269269
DEPENDS "${PROJECT_SOURCE_DIR}/src/instrument.l"
270270
)
271-
## Generate py-lex.yy.c with flex
271+
## Generate py-lex.yy.c with flex (Python generator)
272272
add_custom_command(
273273
OUTPUT work/src/py-lex.yy.c
274274
COMMAND "${FLEX_EXECUTABLE}" -DGENERATE_PY -o py-lex.yy.c -i "${PROJECT_SOURCE_DIR}/src/instrument.l"
275275
WORKING_DIRECTORY work/src
276276
DEPENDS "${PROJECT_SOURCE_DIR}/src/instrument.l"
277277
)
278-
## Generate instrument.tab.{h,c} with bison
278+
## Generate instrument.tab.{h,c} with bison (both for C and Python generators)
279279
add_custom_command(
280280
OUTPUT work/src/instrument.tab.h work/src/instrument.tab.c
281281
COMMAND "${BISON_EXECUTABLE}" -v -d "${PROJECT_SOURCE_DIR}/src/instrument.y"
282282
WORKING_DIRECTORY work/src
283283
DEPENDS "${PROJECT_SOURCE_DIR}/src/instrument.y" work/src/lex.yy.c
284284
)
285-
## Generate py-instrument.tab.{h,c} with bison for Python
286-
add_custom_command(
287-
OUTPUT work/src/py-instrument.tab.h work/src/py-instrument.tab.c
288-
COMMAND "${BISON_EXECUTABLE}" -v -d "${PROJECT_SOURCE_DIR}/src/py-instrument.y"
289-
WORKING_DIRECTORY work/src
290-
DEPENDS "${PROJECT_SOURCE_DIR}/src/py-instrument.y" work/src/py-lex.yy.c
291-
)
292-
293285

294286
# Handling of system-provided random functions on windows -
295287
# needed only in the link step for mccode and -format
@@ -325,7 +317,7 @@ macro(installMCCODE)
325317
add_executable(
326318
${FLAVOR}-pygen
327319
work/src/pygen.c
328-
work/src/py-cexp.c
320+
work/src/cexp.c
329321
work/src/coords.c
330322
work/src/debug.c
331323
work/src/file.c
@@ -339,8 +331,8 @@ macro(installMCCODE)
339331

340332
# files generated with flex and bison
341333
work/src/py-lex.yy.c
342-
work/src/py-instrument.tab.h
343-
work/src/py-instrument.tab.c
334+
work/src/instrument.tab.h
335+
work/src/instrument.tab.c
344336
)
345337
target_compile_definitions(${FLAVOR}-pygen PUBLIC GENERATE_PY=1)
346338

mccode/src/instrument.l

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@
4141
#endif
4242

4343
#include "mccode.h"
44-
#ifdef GENERATE_PY
45-
#include "py-instrument.tab.h"
46-
#else
4744
#include "instrument.tab.h"
48-
#endif
4945

5046
/* Fix things for bison option %pure_parser. */
5147
#define YY_DECL int yylex(YYSTYPE *yylvalp)

0 commit comments

Comments
 (0)