Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
ahfriedman committed Jan 9, 2023
1 parent 6982fc9 commit fddf381
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# README

This Alex Friedman's implementation of the Worcester Polytechnic Instutite, WPI, Programming Language (WPL).
This programming language was created by Alex Friedman based on the process calculus theory that I created. ).


## Prerequisites
Expand Down Expand Up @@ -32,7 +32,7 @@ If you made changes for your platform to any of the .cmake files or CMakeLists.t
- `/antlr` - Contains the relevant ANTLR library.
- `/build` - Automatically generated output files of the project.
- `/cmake` - Contains the cmake files required to setup the project's depedencies. Each file corresponds to a separate part of the project.
- `/programs` - Contains sample WPL programs used for testing the compiler. ***Many test cases rely on calculating the sha256 hash of these programs. Editing them may cause test cases to break!***
- `/programs` - Contains sample programs used for testing the compiler. ***Many test cases rely on calculating the sha256 hash of these programs. Editing them may cause test cases to break!***
- `/src` - Contains the main project files--including wplc.cpp which is the main entry point for the compiler
- `/src/codegen` - Code generation phase of the compiler
- `/src/generated` - Automatically generated ANTLR files based on the language's grammmar
Expand Down
9 changes: 5 additions & 4 deletions cmake/Runtime.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Runtime module for linking
# The WPL runtime code will go in the ${RUNTIME_DIR}
# The language's runtime code will go in the ${RUNTIME_DIR}

set (RUNTIME_DIR ${CMAKE_SOURCE_DIR}/src/runtime)
#################################################
# I will supply the runtime library sources and
# the appropriate CMake files.
#
# Runtime Entry Points (and easily accessible fns)
#
#################################################
set (RUNTIME_SOURCES
${RUNTIME_DIR}/wpl_runtime.c
Expand All @@ -15,7 +16,7 @@ set (RUNTIME_SOURCES

###################################################
#
# PRISM Core Includes
# PRISM Core Includes # FIXME: FIND A WAY TO PREVENT THSE FROM BEING ACCESSED BY USERS DIRECTLY!
#
###################################################

Expand Down
2 changes: 1 addition & 1 deletion makeArchive.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
git archive --prefix=ahfriedman-wpl/ --format zip -o "ahfriedman-wpl-$(git rev-parse --short HEAD).zip" HEAD
git archive --prefix=ahfriedman-prism/ --format zip -o "ahfriedman-prism-$(git rev-parse --short HEAD).zip" HEAD
5 changes: 5 additions & 0 deletions programs/_temp2.prism
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
define struct program {}

# define func program () {
# return; # FIXME: DO THESE HAVE TO END IN RETURN?
# }
2 changes: 1 addition & 1 deletion runArchiveTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ unzip $1 -d ./tmp # Unzip the folder in a ./tmp

cd ./tmp # Change to inner directory

sudo docker run -it -v $PWD/ahfriedman-wpl:/home/shared ahfriedman/cs544-cs4533-docker
sudo docker run -it -v $PWD/ahfriedman-prism:/home/shared ahfriedman/cs544-cs4533-docker

# User then does stuff

Expand Down
5 changes: 2 additions & 3 deletions src/codegen/CodegenVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ std::optional<Value *> CodegenVisitor::visit(MatchStatementNode *n)

if (BlockNode *blkStmtCtx = dynamic_cast<BlockNode *>(caseNode.second))
{
// WPLParser::BlockContext *blkCtx = blkStmtCtx->block();
if (!endsInReturn(blkStmtCtx))
{
builder->CreateBr(mergeBlk);
Expand Down Expand Up @@ -865,7 +864,7 @@ std::optional<Value *> CodegenVisitor::visit(EqExprNode *n)
/**
* @brief Generates code for Logical Ands
*
* Tested in: test2.wpl
* Tested in: test2.prism
*
* @param ctx LogAndExprContext to generate this from
* @return std::optional<Value *> The resulting value or {} if errors.
Expand Down Expand Up @@ -940,7 +939,7 @@ std::optional<Value *> CodegenVisitor::visit(LogAndExprNode *n)
/**
* @brief Generates code for Logical Ors.
*
* Tested in: test2.wpl
* Tested in: test2.prism
*
* @param ctx Context to generate code from
* @return std::optional<Value *> The resulting value or {} if errors.
Expand Down
2 changes: 0 additions & 2 deletions src/codegen/include/CodegenVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include "WPLBaseVisitor.h"
#include "CompilerFlags.h"

// #include "WPLTypedVisitor.h"

#include "PropertyManager.h"
#include "WPLErrorHandler.h"
#include "SemanticVisitor.h"
Expand Down
4 changes: 2 additions & 2 deletions src/lexparse/WPL.g4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Alex Friedman (ahfriedman@wpi.edu)
* Grammar file for WPI Programming Language (WPL).
* Grammar file for PRISM
*/
grammar WPL;

Expand Down Expand Up @@ -278,7 +278,7 @@ fragment SAFE_STRING : ~["\\] ;
/*
WPL has two types of comments, inline comments and standard comments.
Prism has two types of comments, inline comments and standard comments.
Inline comments start with a '#' character that is not in a string
literal, and continue to the end of the line (or end of file if this
is the last line of the program).
Expand Down
4 changes: 0 additions & 4 deletions src/wplc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
* @date 2022-09-07
*
* @copyright Copyright (c) 2022
*
* NOTE: You may want to allow multiple files and
* loop through them so that you can compile multiple
* files with one command line.
*/

#include "wplc.h"
Expand Down

0 comments on commit fddf381

Please sign in to comment.