Skip to content

Commit

Permalink
adding debug ebnf
Browse files Browse the repository at this point in the history
  • Loading branch information
mike dupont committed Nov 13, 2023
1 parent 1f778c1 commit 1dddcdb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ project("llama.cpp" C CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)

if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
Expand Down
4 changes: 4 additions & 0 deletions common/grammar-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace grammar_parser {
static uint32_t get_symbol_id(parse_state & state, const char * src, size_t len) {
uint32_t next_id = static_cast<uint32_t>(state.symbol_ids.size());
auto result = state.symbol_ids.insert(std::make_pair(std::string(src, len), next_id));
fprintf(stderr, "added id %s with id %d\n",src,next_id);
return result.first->second;
}

Expand All @@ -41,8 +42,11 @@ namespace grammar_parser {
uint32_t rule_id,
const std::vector<llama_grammar_element> & rule) {
if (state.rules.size() <= rule_id) {
fprintf(stderr, "resize id %d\n",rule_id);
state.rules.resize(rule_id + 1);
}

fprintf(stderr, "adding rule id %d\n",rule_id);
state.rules[rule_id] = rule;
}

Expand Down

0 comments on commit 1dddcdb

Please sign in to comment.