Skip to content

Commit

Permalink
updated cmake + bump fe
Browse files Browse the repository at this point in the history
  • Loading branch information
leissa committed Nov 29, 2023
1 parent a54f832 commit 1f919c7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 26 deletions.
27 changes: 26 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,30 @@ if(FE_ABSL)
set(ABSL_ENABLE_INSTALL ON)
find_package(abseil)
endif()

add_subdirectory(external/fe)
add_subdirectory(src)

add_executable(let)
target_sources(let
PRIVATE
src/main.cpp
src/let/eval.cpp
src/let/lexer.cpp
src/let/parser.cpp
src/let/stream.cpp
src/let/tok.cpp
include/let/ast.h
include/let/driver.h
include/let/lexer.h
include/let/tok.h
)
target_link_libraries(let PRIVATE fe)
target_include_directories(let
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_compile_features(let PUBLIC cxx_std_${CMAKE_CXX_STANDARD})
if (MSVC AND BUILD_SHARED_LIBS AND FE_ABSL)
target_compile_definitions(liblet PUBLIC ABSL_CONSUME_DLL)
endif()
4 changes: 3 additions & 1 deletion include/let/tok.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Tok {
public:
// clang-format off
enum class Tag {
Nil,
#define CODE(t, _) t,
LET_KEY(CODE)
LET_VAL(CODE)
Expand Down Expand Up @@ -80,6 +81,7 @@ class Tok {
Tag tag() const { return tag_; }
bool isa(Tag tag) const { return tag == tag_; }
bool isa_key() const { return (int)tag() < Num_Keys; }
explicit operator bool() const { return tag_ != Tag::Nil; }

Sym sym() const {
assert(isa(Tag::V_sym));
Expand All @@ -96,7 +98,7 @@ class Tok {

private:
Loc loc_;
Tag tag_;
Tag tag_ = Tag::Nil;
union {
Sym sym_;
uint64_t u64_;
Expand Down
15 changes: 0 additions & 15 deletions src/CMakeLists.txt

This file was deleted.

8 changes: 0 additions & 8 deletions src/let/CMakeLists.txt

This file was deleted.

0 comments on commit 1f919c7

Please sign in to comment.