A PLATYPUS compiler for a course-wide assignment
Go to file
Victor Fernandes d54a25668f Delete Assignment1_Victor Fernandes_040772243.docx 2017-05-10 14:01:15 -04:00
buffer new project for stable 2017-04-04 18:38:59 -04:00
orig_big_file_test Bulk commit 2017-02-02 16:44:26 -05:00
orig_test_files Bulk commit 2017-02-02 16:44:26 -05:00
output_files Output test files: All working according to specs 2017-02-07 12:40:37 -05:00
src_test_files Cleanup, working Scanner matching output files and specs 2017-03-20 13:32:38 -04:00
.gitattributes BNF: Add C's syntax for conditional expressions as potential solution 2017-02-21 14:25:21 -05:00
.gitignore .gitignore: add VS-related project files 2017-02-13 18:39:58 -05:00
Ass01_W17.pdf Remove junk files, add program specs sheet 2017-02-01 18:16:33 -05:00
Ass04_W17.pdf The final push, the Parser 2017-04-17 10:48:33 -04:00
Makefile make: default to build gcc+clang 2017-02-02 15:09:35 -05:00
PLATYPUS Grammar Specification.md merge 2017-03-13 19:14:01 -04:00
PLATYPUS Grammar Specification.txt Modified grammar for the parser 2017-04-28 17:15:46 -04:00
PLATYPUS_Regex.md Fix transition table(finally) 2017-03-18 17:23:57 -04:00
PLATYPUS_Symbol_Table_Masks.xlsx symbol table masks demo 2017-04-04 17:36:22 -04:00
PLATYPUS_Transition_Table.xlsx Fix transition table(finally) 2017-03-18 17:23:57 -04:00
README.md Update README and file headers 2017-05-10 13:46:04 -04:00
buffer.c Update README and file headers 2017-05-10 13:46:04 -04:00
buffer.h Memory management 2017-04-10 11:33:16 -04:00
parser.c Update README and file headers 2017-05-10 13:46:04 -04:00
parser.h Update README and file headers 2017-05-10 13:46:04 -04:00
platy.c Update README and file headers 2017-05-10 13:46:04 -04:00
platy_bt.c Update README and file headers 2017-05-10 13:46:04 -04:00
platy_st.c Update README and file headers 2017-05-10 13:46:04 -04:00
platy_tt.c Update README and file headers 2017-05-10 13:46:04 -04:00
scanner.c Update README and file headers 2017-05-10 13:46:04 -04:00
stable.c Update README and file headers 2017-05-10 13:46:04 -04:00
stable.h Update README and file headers 2017-05-10 13:46:04 -04:00
table.h Update README and file headers 2017-05-10 13:46:04 -04:00
templates.txt Update file/function comment template 2017-03-24 21:05:14 -04:00
token.h Update README and file headers 2017-05-10 13:46:04 -04:00

README.md

PLATYPUS

Frontend compiler for the PLATYPUS language specification

Building

In macOS/Linux

Requires

gcc (tested in version 6.3.x) or clang (tested under LLVM clang-0800.0.42.1)

  • make [gcc | clang]
    • No argument will build both versions (this is an aftermath of having to check behaviour in the binary from multiple compilers)
    • It is safe to modify the default to either gcc or clang if you wish. ** SEE NOTES BELOW **
  • NOTE: I haven't tested or created make targets for the final implementation yet. This is somewhat buried deep into the backburner

Windows

Requires

  • msvc (tested under Visual Studio 2015 with Update 3, however VS 2012 and 2013 shouldn't behave abnormally either, nor should 2017)
  • Disable language extensions (use ANSI C)

Running

Running the Buffer only

  • macOS/linux
    • $ ./buffer_<compiler> <file> [f | a | m] > <out_file>
  • Windows
    • $ buffer <file> f | a | m] > <out_file>

Usage

  • F: fixed capacity mode. Buffe will not auto-resize if not enough space for the file
  • A: additive mode: Buffer will resize in a linear increment.
  • M: multiplicative mode: Buffer will resize based on a pre-set multiplier based on remaining allowed memory space ($SHRT_MAX bytes)

Notes

This is in no way complete, or ready for production in any shape or form. It works up to the parser, but still contains incorrect grammar parsing and some edge cases that causes crashes.

You can modify the initial capacity and increment factor defined in platy.c (should really make that a command line parameter in a future release)

  • Increment factor range for additive mode: 1 - 255. (setting this to 0 implies fixed mode, regardless of the mode given in the command line)
  • Initial capacity range (in bytes): 0 - 32767 (SHRT_MAX)
  • This is an issue caused by my environment's install locations for the C include libraries:
    • buffer.h contains an #ifdef directive checking if WIN32 exists. Due to an upgrade issue with GCC in macOS (possibly only in my machine), malloc.h is actually named mm_maloc.h. If your system uses malloc.h, you can safely delete the check and use the regular filename instead.