include generated lemon code so lemon isn't needed.

This commit is contained in:
Kelvin Sherlock 2021-05-30 23:29:34 -04:00
parent a70270be52
commit 4730a70874
5 changed files with 3251 additions and 16 deletions

View File

@ -13,25 +13,30 @@ add_custom_command(
MAIN_DEPENDENCY lexer.rl
)
add_custom_command(
OUTPUT parser.cpp parser.h
COMMAND cp -f "${CMAKE_CURRENT_SOURCE_DIR}/parser.lemon" "parser.lemon"
find_program(LEMON NAMES lemon)
if (LEMON)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/parser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/parser.h
# COMMAND cp -f "${CMAKE_CURRENT_SOURCE_DIR}/parser.lemon" "parser.lemon"
COMMAND lemon parser.lemon
COMMAND mv -f parser.c parser.cpp
MAIN_DEPENDENCY parser.lemon
DEPENDS debugger.h
)
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
add_custom_command(
OUTPUT template_parser.cpp template_parser.h
COMMAND cp -f "${CMAKE_CURRENT_SOURCE_DIR}/template_parser.lemon" "template_parser.lemon"
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/template_parser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/template_parser.h
# COMMAND cp -f "${CMAKE_CURRENT_SOURCE_DIR}/template_parser.lemon" "template_parser.lemon"
COMMAND lemon template_parser.lemon
COMMAND mv -f template_parser.c template_parser.cpp
MAIN_DEPENDENCY template_parser.lemon
DEPENDS debugger.h
)
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
endif()
add_custom_command(

1868
bin/parser.cpp Normal file

File diff suppressed because it is too large Load Diff

51
bin/parser.h Normal file
View File

@ -0,0 +1,51 @@
#define tkPIPEPIPE 1
#define tkAMPAMP 2
#define tkPIPE 3
#define tkCARET 4
#define tkAMP 5
#define tkEQEQ 6
#define tkBANGEQ 7
#define tkLT 8
#define tkLTEQ 9
#define tkGT 10
#define tkGTEQ 11
#define tkLTLT 12
#define tkGTGT 13
#define tkPLUS 14
#define tkMINUS 15
#define tkSTAR 16
#define tkSLASH 17
#define tkPERCENT 18
#define tkBANG 19
#define tkTILDE 20
#define tkEOL 21
#define tkPRINT 22
#define tkBREAK 23
#define tkBACKTRACE 24
#define tkCONTINUE 25
#define tkTBREAK 26
#define tkRBREAK 27
#define tkWBREAK 28
#define tkRWBREAK 29
#define tkNEXT 30
#define tkDUMP 31
#define tkCOLON 32
#define tkAT 33
#define tkLIST 34
#define tkSTACKCRAWL 35
#define tkSEMI 36
#define tkSEMIH 37
#define tkSEMII 38
#define tkSEMIL 39
#define tkSEMIDATE 40
#define tkSEMIERROR 41
#define tkSEMIT 42
#define tkIDENTIFIER 43
#define tkDREGISTER 44
#define tkEQ 45
#define tkAREGISTER 46
#define tkXREGISTER 47
#define tkHELP 48
#define tkLPAREN 49
#define tkRPAREN 50
#define tkINTEGER 51

1291
bin/template_parser.cpp Normal file

File diff suppressed because it is too large Load Diff

20
bin/template_parser.h Normal file
View File

@ -0,0 +1,20 @@
#define tkTYPEDEF 1
#define tkIDENTIFIER 2
#define tkSTRUCT 3
#define tkLBRACE 4
#define tkRBRACE 5
#define tkSEMI 6
#define tkTEMPLATE 7
#define tkLBRACKET 8
#define tkINTEGER 9
#define tkRBRACKET 10
#define tkVOLATILE 11
#define tkSIGNED 12
#define tkUNSIGNED 13
#define tkCHAR 14
#define tkSHORT 15
#define tkLONG 16
#define tkTYPECODE 17
#define tkVOID 18
#define tkSTAR 19
#define tkINT 20