-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
320 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Build stuff | ||
common.cpp | ||
cmake/* | ||
CMakeLists.txt | ||
build | ||
dist | ||
.DS_Store | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#include "craft/common.h" | ||
#include "craft/all.h" | ||
|
||
#include "replxx/replxx.hxx" | ||
#include "lisp/semantics/cult/cult.h" | ||
#include "lisp/library/system/prelude.h" | ||
#include "lisp/features/repl.h" | ||
|
||
using namespace craft; | ||
using namespace craft::lisp; | ||
|
||
|
||
|
||
int main(int argc, char** argv) | ||
{ | ||
craft::types::boot(); | ||
|
||
if (argc != 1) | ||
{ | ||
instance<Environment> global_env = instance<Environment>::make(spdlog::stdout_color_mt("environment")); | ||
instance<Namespace> ns = global_env->ns_user; | ||
std::string f; | ||
try | ||
{ | ||
f = fs::read<std::string>(path::normalize(argv[1]), fs::string_read).get(); | ||
} | ||
catch (...) | ||
{ | ||
global_env->log()->info("No Such File: {0}", argv[1]); | ||
} | ||
try | ||
{ | ||
auto live_module = ns->requireModule(fmt::format("file:{0}", f)); | ||
live_module->initialize(); | ||
} | ||
catch (stdext::exception e) | ||
{ | ||
global_env->log()->error(e.what()); | ||
return -1; | ||
} | ||
catch (std::exception e) | ||
{ | ||
global_env->log()->error(e.what()); | ||
return -1; | ||
} | ||
} | ||
else | ||
{ | ||
features::LispRepl r; | ||
|
||
while (true) | ||
{ | ||
try | ||
{ | ||
auto eval = r.step(); | ||
std::cout << eval.toString() << "\n"; | ||
} | ||
catch (features::ReplExitException e) | ||
{ | ||
break; | ||
} | ||
catch (features::ReplParseException e) | ||
{ | ||
std::cout << "Parse Error: " << e.what() << "\n"; | ||
} | ||
catch (stdext::exception e) | ||
{ | ||
std::cout << e.what() << "\n"; | ||
} | ||
catch (std::exception e) | ||
{ | ||
std::cout << "Unhandled Internal Exception: " << e.what() << "\n"; | ||
} | ||
} | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
id: Craft | ||
namespace: Cultlang | ||
shortname: Standard Distribution of cult | ||
version: "0.1.0" | ||
repo: https://github.com/cultlang/cultlang | ||
entry-name: cult | ||
dependencies: | ||
- Util@OffByOneStudios | ||
- Types@OffByOneStudios | ||
- Lisp@OffByOneStudios | ||
- Backendllvm | ||
- Http | ||
- Lsp | ||
- Sodium | ||
- Sqlite3 | ||
- Uv | ||
- Zmq | ||
|
||
|
||
include-directories: [] | ||
|
||
vendor-dependencies: | ||
x86_64-pc-windows-msvccoff: [] | ||
x86_64-apple-macosx-macho: [] | ||
x86_64-pc-linux-gnu: [] | ||
|
||
platform-dependencies: | ||
x86_64-pc-windows-msvccoff: [] | ||
x86_64-apple-macosx-macho: [] | ||
x86_64-pc-linux-gnu: [] | ||
|
||
platform-compile-flags: | ||
x86_64-pc-windows-msvccoff: | ||
- "/std:c++latest" | ||
x86_64-apple-macosx-macho: | ||
- "-std=c++1z" | ||
- "-stdlib=libc++" | ||
- "-Wc++11-extensions" | ||
x86_64-pc-linux-gnu: | ||
- "-std=gnu++1z" | ||
- "-pthread" | ||
- "-fpermissive" | ||
|
||
platform-link-flags: | ||
x86_64-pc-windows-msvccoff: | ||
- "/ignore:4099" | ||
|
||
platform-defines: | ||
x86_64-pc-windows-msvccoff: | ||
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS: yes | ||
x86_64-apple-macosx-macho: {} | ||
x86_64-pc-linux-gnu: {} | ||
|
||
artifacts: | ||
library: | ||
primary: yes | ||
kind: dll craft-types | ||
files: | ||
- src/**/*.* | ||
test: | ||
kind: test | ||
files: | ||
- test/**/*.* | ||
entry: | ||
kind: exe | ||
files: | ||
- entry/**/*.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "craft/common.h" | ||
|
||
#include "all.h" | ||
|
||
#include "lisp/library/system/prelude.h" | ||
#include "lisp/semantics/cult/calling.h" | ||
|
||
|
||
using namespace craft; | ||
using namespace craft::lisp; | ||
using namespace craft::types; | ||
|
||
|
||
|
||
#define lMM semantics->builtin_implementMultiMethod | ||
|
||
#include "typedefs.h" | ||
|
||
|
||
instance<Module> cultlang::craft::make_craft_bindings(instance<lisp::Namespace> ns, instance<> loader) | ||
{ | ||
auto ret = instance<Module>::make(ns, loader); | ||
auto sem = instance<CultSemantics>::make(ret); | ||
ret->builtin_setSemantics(sem); | ||
|
||
auto semantics = ret->require<CultSemantics>(); | ||
|
||
lMM("/craft/version", []() { return instance<std::string>::make("0.0.1");}); | ||
|
||
return ret; | ||
} | ||
|
||
BuiltinModuleDescription cultlang::craft::BuiltinCraft("cult/craft", cultlang::craft::make_craft_bindings); | ||
|
||
|
||
#include "types/dll_entry.inc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
#include "craft/common.h" | ||
|
||
namespace cultlang { | ||
namespace craft | ||
{ | ||
extern ::craft::lisp::BuiltinModuleDescription BuiltinCraft; | ||
|
||
CULTLANG_CRAFT_EXPORTED::craft::instance<::craft::lisp::Module> make_craft_bindings(::craft::instance<::craft::lisp::Namespace> ns, ::craft::instance<> loader); | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#include "defines.h" | ||
|
||
// C++ | ||
#include <string> | ||
#include <regex> | ||
#include <fstream> | ||
#include <iostream> | ||
#include <sstream> | ||
#include <utility> | ||
#include <vector> | ||
#include <map> | ||
#include <algorithm> | ||
#include <iterator> | ||
#include <stack> | ||
#include <queue> | ||
#include <set> | ||
#include <chrono> | ||
#include <memory> | ||
#include <type_traits> | ||
#include <functional> | ||
|
||
|
||
// Vendor | ||
#include <spdlog/spdlog.h> | ||
#include <spdlog/fmt/ostr.h> | ||
|
||
// Deps | ||
#include "util/all.h" | ||
#include "types/core.h" | ||
#include "lisp/lisp.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
// | ||
// Platform Dynamic Library | ||
// | ||
#if defined _WIN32 || defined __CYGWIN__ | ||
#ifdef __GNUC__ | ||
#define CULTLANG_CRAFT_EXPORTED_EXPORT __attribute__ ((dllexport)) | ||
#define CULTLANG_CRAFT_EXPORTED_IMPORT __attribute__ ((dllimport)) | ||
#else | ||
#define CULTLANG_CRAFT_EXPORTED_EXPORT __declspec(dllexport) | ||
#define CULTLANG_CRAFT_EXPORTED_IMPORT __declspec(dllimport) | ||
#endif | ||
#else | ||
#if __GNUC__ >= 4 | ||
#define CULTLANG_CRAFT_EXPORTED_EXPORT __attribute__ ((visibility ("default"))) | ||
#define CULTLANG_CRAFT_EXPORTED_IMPORT | ||
#else | ||
#define CULTLANG_CRAFT_EXPORTED_EXPORT | ||
#define CULTLANG_CRAFT_EXPORTED_IMPORT | ||
#endif | ||
#endif | ||
|
||
|
||
// | ||
// Engine Compile | ||
// | ||
|
||
#ifdef CULTLANG_CRAFT_DLL | ||
#define CULTLANG_CRAFT_EXPORTED CULTLANG_CRAFT_EXPORTED_EXPORT | ||
#else | ||
#define CULTLANG_CRAFT_EXPORTED CULTLANG_CRAFT_EXPORTED_IMPORT | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
typedef instance<std::string> t_str; | ||
|
||
typedef instance<int8_t> t_i8; | ||
typedef instance<uint16_t> t_i16; | ||
typedef instance<uint32_t> t_i32; | ||
typedef instance<uint64_t> t_i64; | ||
typedef instance<mpz_class> t_i; | ||
|
||
typedef instance<uint8_t> t_u8; | ||
typedef instance<uint16_t> t_u16; | ||
typedef instance<uint32_t> t_u32; | ||
typedef instance<uint64_t> t_u64; | ||
|
||
|
||
typedef instance<float> t_f32; | ||
typedef instance<double> t_f64; | ||
typedef instance<mpf_class> t_f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "craft/common.h" | ||
#include "craft/all.h" | ||
|
||
int main(int argc, char** argv) { | ||
|
||
} |