Skip to content

Commit

Permalink
Changed folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Samathingamajig committed Feb 19, 2021
1 parent ede90d9 commit fabd0fd
Show file tree
Hide file tree
Showing 21 changed files with 72 additions and 69 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bld/

# Visual Studio 2015/2017 cache/options directory
.vs/
.vscode/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

Expand Down
10 changes: 6 additions & 4 deletions BarkScript.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include <iostream>
#include <string>
#include <memory>
#include "lexer.h"
#include "parser.h"
#include "object.h"
#include "interpreter.h"
#include "token/token.h"
#include "lexer/lexer.h"
#include "parser/parser.h"
#include "object/object.h"
#include "interpreter/interpreter.h"
#include "context/context.h"

const std::string bsversion = "0.0.12";

Expand Down
30 changes: 15 additions & 15 deletions BarkScript.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,23 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="BarkScript.cpp" />
<ClCompile Include="Interpreter.cpp" />
<ClCompile Include="Lexer.cpp" />
<ClCompile Include="Object.cpp" />
<ClCompile Include="Parser.cpp" />
<ClCompile Include="interpreter/Interpreter.cpp" />
<ClCompile Include="lexer/Lexer.cpp" />
<ClCompile Include="object/Object.cpp" />
<ClCompile Include="parser/Parser.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ast.h" />
<ClInclude Include="context.h" />
<ClInclude Include="error.h" />
<ClInclude Include="interpreter.h" />
<ClInclude Include="lexer.h" />
<ClInclude Include="object.h" />
<ClInclude Include="parser.h" />
<ClInclude Include="position.h" />
<ClInclude Include="strings_with_arrows.h" />
<ClInclude Include="token.h" />
<ClInclude Include="tokens.h" />
<ClInclude Include="ast/ast.h" />
<ClInclude Include="context/context.h" />
<ClInclude Include="error/error.h" />
<ClInclude Include="interpreter/interpreter.h" />
<ClInclude Include="lexer/lexer.h" />
<ClInclude Include="object/object.h" />
<ClInclude Include="parser/parser.h" />
<ClInclude Include="position/position.h" />
<ClInclude Include="strings_with_arrows/strings_with_arrows.h" />
<ClInclude Include="token/token.h" />
<ClInclude Include="token/tokens.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="syntax.txt" />
Expand Down
30 changes: 15 additions & 15 deletions BarkScript.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,52 +18,52 @@
<ClCompile Include="BarkScript.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Lexer.cpp">
<ClCompile Include="lexer/Lexer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Parser.cpp">
<ClCompile Include="parser/Parser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Interpreter.cpp">
<ClCompile Include="interpreter/Interpreter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Object.cpp">
<ClCompile Include="object/Object.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="tokens.h">
<ClInclude Include="token/tokens.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lexer.h">
<ClInclude Include="lexer/lexer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="token.h">
<ClInclude Include="token/token.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="parser.h">
<ClInclude Include="parser/parser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ast.h">
<ClInclude Include="ast/ast.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="syntax.txt" />
<ClInclude Include="error.h">
<ClInclude Include="error/error.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="position.h">
<ClInclude Include="position/position.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="strings_with_arrows.h">
<ClInclude Include="strings_with_arrows/strings_with_arrows.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="interpreter.h">
<ClInclude Include="interpreter/interpreter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="object.h">
<ClInclude Include="object/object.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="context.h">
<ClInclude Include="context/context.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
windowsvs : build BarkScript.cpp Lexer.cpp Parser.cpp Object.cpp Interpreter.cpp
windowsvs : build BarkScript.cpp lexer/Lexer.cpp parser/Parser.cpp object/Object.cpp interpreter/Interpreter.cpp
.\build.bat

linuxgpp : build BarkScript.cpp Lexer.cpp Parser.cpp Object.cpp Interpreter.cpp
g++ -o ./build/BarkScript -O2 -Wall BarkScript.cpp Lexer.cpp Parser.cpp Object.cpp Interpreter.cpp
linuxgpp : build BarkScript.cpp lexer/Lexer.cpp parser/Parser.cpp object/Object.cpp interpreter/Interpreter.cpp
g++ -o ./build/BarkScript -O2 -Wall BarkScript.cpp lexer/Lexer.cpp parser/Parser.cpp object/Object.cpp interpreter/Interpreter.cpp

cleanobj :
rm BarkScript.obj Lexer.obj Parser.obj Object.obj Interpreter.obj
rm *.obj

cleanobjcmd :
del BarkScript.obj Lexer.obj Parser.obj Object.obj Interpreter.obj
del *.obj

build :
mkdir build
4 changes: 2 additions & 2 deletions ast.h → ast/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#define AST_H
#include <string>
#include <memory>
#include "token.h"
#include "position.h"
#include "../token/token.h"
#include "../position/position.h"

namespace nodetypes {
using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" && cl.exe /EHsc BarkScript.cpp Lexer.cpp Parser.cpp Object.cpp Interpreter.cpp /link /out:build/BarkScript.exe
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" && cl.exe /EHsc BarkScript.cpp lexer/Lexer.cpp parser/Parser.cpp object/Object.cpp interpreter/Interpreter.cpp /link /out:build/BarkScript.exe
2 changes: 1 addition & 1 deletion context.h → context/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define CONTEXT_H
#include <memory>
#include <string>
#include "position.h"
#include "../position/position.h"

struct Context;

Expand Down
6 changes: 3 additions & 3 deletions error.h → error/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#ifndef ERROR_H
#define ERROR_H
#include <string>
#include "position.h"
#include "context.h"
#include "strings_with_arrows.h"
#include "../position/position.h"
#include "../context/context.h"
#include "../strings_with_arrows/strings_with_arrows.h"

namespace errortypes {
using namespace std;
Expand Down
4 changes: 2 additions & 2 deletions Interpreter.cpp → interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <iostream>
#include <string>
#include <stdexcept>
#include "ast.h"
#include "object.h"
#include "../ast/ast.h"
#include "../object/object.h"

bool RuntimeResult::hasError() { return error != nullptr; }

Expand Down
6 changes: 3 additions & 3 deletions interpreter.h → interpreter/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#ifndef INTERPRETER_H
#define INTERPRETER_H
#include <memory>
#include "ast.h"
#include "context.h"
#include "error.h"
#include "../ast/ast.h"
#include "../context/context.h"
#include "../error/error.h"

struct Object;
typedef std::shared_ptr<Object> spObject;
Expand Down
6 changes: 3 additions & 3 deletions Lexer.cpp → lexer/Lexer.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "lexer.h"
#include <vector>
#include <memory>
#include "tokens.h"
#include "position.h"
#include "error.h"
#include "../token/tokens.h"
#include "../position/position.h"
#include "../error/error.h"

Lexer::Lexer(std::string input, std::string filename) {
this->input = input;
Expand Down
4 changes: 2 additions & 2 deletions lexer.h → lexer/lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#define LEXER_H
#include <string>
#include <vector>
#include "token.h"
#include "error.h"
#include "../token/token.h"
#include "../error/error.h"

struct SingleLexResult {
Token token;
Expand Down
2 changes: 1 addition & 1 deletion Object.cpp → object/Object.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "object.h"
#include <math.h>
#include <sstream>
#include "interpreter.h"
#include "../interpreter/interpreter.h"

bool didOverflow(double value) {
return std::numeric_limits<double>::max() < value;
Expand Down
8 changes: 4 additions & 4 deletions object.h → object/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#define OBJECT_H
#include <string>
#include <memory>
#include "token.h"
#include "position.h"
#include "context.h"
#include "interpreter.h"
#include "../token/token.h"
#include "../position/position.h"
#include "../context/context.h"
#include "../interpreter/interpreter.h"

namespace objecttypes {
using namespace std;
Expand Down
6 changes: 3 additions & 3 deletions Parser.cpp → parser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include <vector>
#include <memory>
#include <functional>
#include "token.h"
#include "tokens.h"
#include "ast.h"
#include "../token/token.h"
#include "../token/tokens.h"
#include "../ast/ast.h"

// https://stackoverflow.com/a/20303915/12101554
bool in_array(const std::string& value, const std::vector<std::string>& array) {
Expand Down
6 changes: 3 additions & 3 deletions parser.h → parser/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <vector>
#include <memory>
#include <functional>
#include "token.h"
#include "ast.h"
#include "error.h"
#include "../token/token.h"
#include "../ast/ast.h"
#include "../error/error.h"

struct ParseResult {
spError error = nullptr;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define STRINGS_WITH_ARROWS_H
#include <string>
#include <regex>
#include "position.h"
#include "../position/position.h"

// Translation from python: https://github.com/davidcallanan/py-myopl-code/blob/master/ep2/strings_with_arrows.py
inline std::string strings_with_arrows(std::string text, Position positionStart, Position positionEnd) {
Expand Down
2 changes: 1 addition & 1 deletion token.h → token/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define TOKEN_H
#include <string>
#include "tokens.h"
#include "position.h"
#include "../position/position.h"

struct Token {
std::string type;
Expand Down
File renamed without changes.

0 comments on commit fabd0fd

Please sign in to comment.