-
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
39 changed files
with
669 additions
and
795 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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# SPDX-License-Identifier: ISC | ||
# | ||
# Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
--- | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: DontAlign | ||
|
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# SPDX-License-Identifier: ISC | ||
# | ||
# Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
--- | ||
FormatStyle: file | ||
HeaderFilterRegex: "" | ||
|
@@ -9,26 +6,28 @@ InheritParentConfig: false | |
Checks: | | ||
-* | ||
bugprone-* | ||
-bugprone-easily-swappable-parameters | ||
cert-*-c | ||
clang-analyzer-core | ||
-clang-analyzer-core.uninitialized.NewArraySize | ||
clang-analyzer-deadcode | ||
clang-analyzer-nullability | ||
clang-analyzer-security | ||
-clang-analyzer-security.insecureAPI.decodeValueOfObjCType | ||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling | ||
clang-analyzer-unix | ||
clang-analyzer-valist | ||
misc-* | ||
-misc-no-recursion | ||
performance-* | ||
portability-* | ||
readability-* | ||
-bugprone-branch-clone | ||
-bugprone-easily-swappable-parameters | ||
-clang-analyzer-core.uninitialized.NewArraySize | ||
-clang-analyzer-security.insecureAPI.decodeValueOfObjCType | ||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling | ||
-misc-no-recursion | ||
-readability-braces-around-statements | ||
-readability-function-cognitive-complexity | ||
-readability-identifier-length | ||
-readability-magic-numbers | ||
-readability-non-const-parameter | ||
WarningsAsErrors: | | ||
-* | ||
|
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# SPDX-License-Identifier: ISC | ||
# | ||
# Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
--- | ||
CompileFlags: | ||
CompilationDatabase: builddir | ||
|
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 |
---|---|---|
@@ -1,7 +1,3 @@ | ||
# SPDX-License-Identifier: ISC | ||
# | ||
# Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
|
||
root = true | ||
|
||
[*] | ||
|
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# SPDX-License-Identifier: ISC | ||
# | ||
# Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
--- | ||
name: Test | ||
|
||
|
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 |
---|---|---|
@@ -1,7 +1,3 @@ | ||
# SPDX-License-Identifier: ISC | ||
# | ||
# Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
|
||
# Ignore everything | ||
* | ||
|
||
|
@@ -43,9 +39,9 @@ | |
!man/ | ||
!man/** | ||
|
||
!src/ | ||
!src/**/ | ||
!src/**/*.c | ||
!source/ | ||
!source/**/ | ||
!source/**/*.c | ||
|
||
!test/ | ||
!test/**/ | ||
|
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# SPDX-License-Identifier: ISC | ||
# | ||
# Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
--- | ||
options: | ||
editorconfig: true |
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
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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
// SPDX-License-Identifier: ISC | ||
// | ||
// Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
|
||
#ifndef PLOY_CORE_H | ||
#define PLOY_CORE_H | ||
#pragma once | ||
|
||
#include "type.h" | ||
|
||
Object const *Append(Object const *target, Object const *object); | ||
// Object const *Apply(Object const *object); | ||
Object const *Car(Object const *object); | ||
Object const *Cdr(Object const *object); | ||
Object const *Cons(Object const *car, Object const *cdr); | ||
// Object const *Define(Object const *env, Object const *symbol, Object const *value); | ||
Object const *Eval(Object const *object); | ||
// Object const *For(Object const *expr, Object const *body); | ||
// Object const *Format(char const *form, ...); | ||
// Object const *If(Object const *expr, Object const *body); | ||
// Object const *Lambda(Object const *env, Object const *args, Object const *body); | ||
// Object const *Let(Object const *env, Object const *args, Object const *body); | ||
Object const *Print(Object const *object); | ||
// Object const *Quasiquote(Object const *object); | ||
// Object const *Quote(Object const *object); | ||
Object const *Read(char const *input); | ||
Object const *Reverse(Object const *object); | ||
static Object *Nil = &(Object){ .type = NIL }; | ||
static Object *True = &(Object){ .type = NIL, .boolean = true }; | ||
static Object *False = &(Object){ .type = NIL, .boolean = false }; | ||
|
||
Object *Append(Object *target, Object *object); | ||
Object *Apply(Object *object); | ||
Object *Assert(bool condition); | ||
Object *Car(Object *object); | ||
Object *Cdr(Object *object); | ||
Object *Cons(Object *car, Object *cdr); | ||
Object *Define(Object *env, Object *args, Object *body); | ||
Object *Error(char *error); | ||
Object *Eval(Object *object); | ||
Object *For(Object *expr, Object *body); | ||
Object *Format(char *form, ...); | ||
Object *If(Object *expr, Object *body); | ||
Object *Lambda(Object *env, Object *args, Object *body); | ||
Object *Let(Object *env, Object *args, Object *body); | ||
Object *Print(Object *object); | ||
Object *Read(char *input); | ||
Object *Reverse(Object *object); | ||
|
||
#endif // PLOY_CORE_H | ||
Object *Number(int64_t i64); | ||
Object *String(char *string); | ||
Object *Symbol(char *symbol); |
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 |
---|---|---|
@@ -1,13 +1,5 @@ | ||
// SPDX-License-Identifier: ISC | ||
// | ||
// Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
|
||
#ifndef PLOY_EVALUATOR_H | ||
#define PLOY_EVALUATOR_H | ||
#pragma once | ||
|
||
#include "type.h" | ||
|
||
Object const *evaluator(Object const *object); | ||
|
||
#endif // PLOY_EVALUATOR_H | ||
Object *evaluator(Object *object); |
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 |
---|---|---|
@@ -1,9 +1,3 @@ | ||
// SPDX-License-Identifier: ISC | ||
// | ||
// Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
|
||
#ifndef PLOY_MATH_H | ||
#define PLOY_MATH_H | ||
#pragma once | ||
|
||
#include "type.h" | ||
|
@@ -12,14 +6,12 @@ | |
// Arithmetic | ||
// | ||
|
||
Object const *Add(Object const *object); | ||
Object const *Subtract(Object const *object); | ||
Object const *Multiply(Object const *object); | ||
Object const *Divide(Object const *object); | ||
|
||
Object const *Exponent(Object const *object); | ||
Object const *Log(Object const *object); | ||
Object const *Modulo(Object const *object); | ||
Object const *NthRoot(Object const *object); | ||
Object *Add(Object *object); | ||
Object *Subtract(Object *object); | ||
Object *Multiply(Object *object); | ||
Object *Divide(Object *object); | ||
|
||
#endif // PLOY_MATH_H | ||
// Object *Exponent(Object *object); | ||
// Object *Log(Object *object); | ||
// Object *Modulo(Object *object); | ||
// Object *NthRoot(Object *object); |
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 |
---|---|---|
@@ -1,13 +1,5 @@ | ||
// SPDX-License-Identifier: ISC | ||
// | ||
// Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
|
||
#ifndef PLOY_PRINTER_H | ||
#define PLOY_PRINTER_H | ||
#pragma once | ||
|
||
#include "type.h" | ||
|
||
void printer(Object const *object); | ||
|
||
#endif // PLOY_PRINTER_H | ||
void printer(Object *object); |
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 |
---|---|---|
@@ -1,13 +1,5 @@ | ||
// SPDX-License-Identifier: ISC | ||
// | ||
// Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
|
||
#ifndef PLOY_READER_H | ||
#define PLOY_READER_H | ||
#pragma once | ||
|
||
#include "type.h" | ||
|
||
Object const *reader(char const *input); | ||
|
||
#endif // PLOY_READER_H | ||
Object *reader(char *input); |
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 |
---|---|---|
@@ -1,50 +1,36 @@ | ||
// SPDX-License-Identifier: ISC | ||
// | ||
// Copyright (c) 2023 Johnathan C Maudlin <[email protected]> | ||
|
||
#ifndef PLOY_TYPE_H | ||
#define PLOY_TYPE_H | ||
#pragma once | ||
|
||
#include <math.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
||
typedef enum Type { | ||
TYPE_NIL = 0, | ||
TYPE_BOOLEAN, | ||
TYPE_ERROR, | ||
// TYPE_LAMBDA, | ||
TYPE_LIST, | ||
TYPE_NUMBER, | ||
TYPE_STRING, | ||
TYPE_SYMBOL, | ||
} Type; | ||
|
||
// struct Lambda { | ||
// struct Object const *args, *body; | ||
// }; | ||
|
||
struct List { | ||
struct Object const *car, *cdr; | ||
}; | ||
|
||
typedef struct Object { | ||
Type type; | ||
typedef struct object Object; | ||
struct object { | ||
enum { | ||
NIL = 0, | ||
BOOLEAN, | ||
ERROR, | ||
// LAMBDA, | ||
LIST, | ||
STRING, | ||
SYMBOL, | ||
|
||
// F64, | ||
I64, | ||
// U64, | ||
} type; | ||
union { | ||
bool boolean; | ||
// struct Lambda *lambda; | ||
struct List *list; | ||
int64_t number; | ||
char const *string; | ||
struct /* lambda */ { | ||
Object *args, *body; | ||
}; | ||
struct /* list */ { | ||
Object *car, *cdr; | ||
}; | ||
char *string; | ||
|
||
double_t f64; | ||
int64_t i64; | ||
uint64_t u64; | ||
}; | ||
} Object; | ||
|
||
static Object const NIL = { .type = TYPE_NIL }; | ||
|
||
Object *Boolean(bool boolean); | ||
Object *Error(char const *error); | ||
Object *Number(int64_t number); | ||
Object *String(char const *string); | ||
Object *Symbol(char const *symbol); | ||
|
||
#endif // PLOY_TYPE_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 |
---|---|---|
|
@@ -10,3 +10,7 @@ | |
(greet greeting) | ||
|
||
(print (format "The answer is {}." (+ 40 2))) | ||
|
||
(+ 1 1) | ||
|
||
(+ 43 -1) |
Oops, something went wrong.