Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
BasedOnStyle: Chromium
AlignAfterOpenBracket: AlwaysBreak
AllowShortBlocksOnASingleLine: "Always"
AllowShortIfStatementsOnASingleLine: WithoutElse
BasedOnStyle: Chromium
ColumnLimit: '100'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
Cpp11BracedListStyle: 'true'
Expand Down Expand Up @@ -38,6 +40,3 @@ SpaceBeforeCpp11BracedList: 'true'
SpacesInContainerLiterals: 'true'
Standard: Cpp11
TabWidth: '4'
AllowShortIfStatementsOnASingleLine: "WithoutElse"
AllowShortLoopsOnASingleLine: "true"
AllowShortBlocksOnASingleLine: "Always"
1 change: 0 additions & 1 deletion .clangd
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
CompileFlags:
Add: [-std=c++23, -Wall]
Compiler: /usr/bin/clang++
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.7
rev: v21.1.8
hooks:
- id: clang-format
- repo: https://github.com/cmake-lint/cmake-lint
rev: 1.4.3
hooks:
- id: cmakelint
- repo: https://github.com/rhysd/actionlint
rev: v1.7.9
rev: v1.7.10
hooks:
- id: actionlint
- repo: https://github.com/sco1/brie-commit
rev: v1.1.0
hooks:
- id: brie-commit
- repo: https://github.com/GideonBear/pre-comet
rev: v1.0.0
hooks:
- id: pre-comet
13 changes: 2 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.30)
#use(CMAKE_CXX_COMPILER "/usr/bin/clang++")
project(winter LANGUAGES CXX)

option(RUN_TESTS "Run unit tests" OFF)
Expand All @@ -12,18 +11,10 @@ add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Wconversion)
add_compile_options(-Wimplicit-fallthrough)
add_compile_options(-Wfatal-errors)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)

# repl
add_subdirectory(src/winter)
add_subdirectory(src)
add_executable(winter src/main.cpp)
target_link_libraries(winter PUBLIC winter-lang)

# public-interface
add_executable(public src/main2.cpp)
target_link_libraries(winter PUBLIC winter-lang)
target_link_libraries(winter PUBLIC winter_src)

if(RUN_TESTS)
message(STATUS "UNIT TESTS ENABLED")
Expand Down
33 changes: 0 additions & 33 deletions milestones.md

This file was deleted.

5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include_directories(${PROJECT_SOURCE_DIR}/src)

add_library(winter_src STATIC
t.cpp
)
27 changes: 11 additions & 16 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,36 @@
#include <string>
#include <string_view>

#include "winter/winter.h"
#include "winter.h"

using namespace std::string_view_literals;

void startRepl() {}
void usage() {}

int main(int argc, char* argv[]) {
const auto args = std::span(argv, argc);
bool enable_debug;
std::string filename = "";

const auto args = std::span(argv, argc);
if (args.size() == 1) {
startRepl();
return 0;
usage();
return 1;
}

bool enable_debug;
std::string filename = "";

for (auto&& elem : args) {
std::string_view str = std::string_view(elem);

if (str == "-D"sv) { enable_debug = true; }
if (str.ends_with(".wt"sv)) { filename = std::string(elem); }
if (str.ends_with(".wtx"sv)) { filename = std::string(elem); }
}

if (filename.empty()) {
std::println("Error: No file provided");
usage();
return 1;
}

auto vm = Winter::VM(enable_debug);
Winter::retcode_t ret = vm.doFile(filename);
if (!ret.has_value()) {
std::println("ERROR: {}", ret.error().msg);
return 0;
};
// TODO: here goes the lexing/parsing etc

return ret.value();
return 0;
}
28 changes: 0 additions & 28 deletions src/main2.cpp

This file was deleted.

Empty file added src/t.cpp
Empty file.
Empty file added src/winter.h
Empty file.
11 changes: 0 additions & 11 deletions src/winter/CMakeLists.txt

This file was deleted.

145 changes: 0 additions & 145 deletions src/winter/ast_nodes.h

This file was deleted.

Loading
Loading