Skip to content

adamamer1801/documatic-hackathon-5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-- Compiler

It's like C++, but written backwards. and flipped.

About

C-- is C++ but reversed and flipped. Yes it just reverses the code and compiles it using a regular C++ compiler, but I read that we were graded on quality. Granted this code is probably not quality either. You can check the examples folder for C-- code, C++ code, Windows executables, and Unix (Linux/MacOS) binaries.

But to make it a bit more quality, I added an online compiler which compiles Windows executables, over HTTP.



How to run

Note:** Jarfile is in dist folder

I tried to convert the .jar into the binaries for Windows, MacOS and Linux but all the Java wrappers are either paid, outdated, or complicated so just run the jarfile with java -jar cli.jar [..arguments].

Normal person

  1. Download the jarfile
  2. Write a C++ program
  3. Convert it to a C-- program using java -jar cli.jar ToCMM file.cpp
  4. Compile the file using java -jar cli.jar compile file.cmm

Psychopath edition

  1. Download the jarfile
  2. Write a C-- program
  3. Compile the file using java -jar cli.jar compile file.cmm



Subcommands

So we have 3 sub-commands, ToCMM, FromCMM, and compile
  • ToCMM: ToCMM just turns C++ code into C-- code
    • -o: Specify output of conversion
  • FromCMM: FromCMM turns C-- code into C++ code
    • -o: Specify output of conversion
  • compile: Compiles the C-- code
    • -o: Specify output of compilation
    • -on: Whether to use online compiling or not
    • -c: Which compiler to use (e.g. g++)


Online Compiler

So a few hours into this project I realised that C++ compilers are stupid and annoying and i hate them

Although the CLI does support local compiling, it also has an online compiler which compiles code on a server, and returns the code. It only works for Windows (64bit) operating systems, but it works.

also it doesn't work with includes not built in with C++

List of local compilers / platform

Windows:

  • Mingw-w64 (not tested)

Linux/MacOS (unix):

  • make
  • g++



Just a note (module usage)

In the Java CLI, I used a snippet of FilenameUtils and IOUtils from Apache CommonsIO. I took them from their module since the compiled cli would've been 2MB, removing CommonsIO removed 1.5MB, making the size ~400KB. I also used PicoCLI to avoid parsing the CLI arguments myself. I tried it but the code was just too messy and since it will be judged on quality, I don't see how that would suffice.
In the (Golang) online compiler, I used the Gin framework for HTTP, and a bunch of _built-in_ modules for strings, logging, input/output, etc.
The online compiler is also hosted under https://compile.cmm.danky.dev/ and is integrated into the CLI.

About

Hackathon entry for Documatic's 5th hackathon

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published