This is an implementation of the Nothing programming language. The language spec is as follows:
Design philosophy
In the current software industry focus lays on solving complex problems by using complicated algorithms. The language "Nothing" was created to shift this focus from complex problems towards the expectations of the programmer and the user. This way even the most complicated programming challenges swiftly disappear as if they never have existed before. Basically, the main strengths of the language "Nothing" are:
- to create bug-free and portable software https://esolangs.org/wiki/Nothing
- to shift focus from complex technical solutions towards the expectation of the programmers and users
Program structure
Nothing has a very simple and straightforward structure. It is a typeless language which does not use any of the known programming constructs like loops, choices and the like. It is the only language which can be considered 1GL, 2GL, 3GL, 4GL and 5GL all at the same time.
What I would like to know:
- Does my program conform to the language specs?
- Does it follow the design philosophy?
- Readability, performance, etc. Any improvements welcome
Source code:
/*
* A 'Nothing' compiler
* <http://www.turtle.dds.nl/nothing/>
* September 2010, RoPe Development Inc.
*
* Author: authorname
*/
#include <iostream>
#include <fstream>
#include <cstdlib> // EXIT_FAILURE
#include <string> // std::char_traits<char>::eof
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cerr << "nothing: fatal error: no input files\n";
std::cerr << "compilation terminated.";
return EXIT_FAILURE;
}
std::ifstream program(argv[1]);
if (!program)
{
std::cerr << "nothing: error: " << argv[1] << ": No such file or directory\n";
std::cerr << "nothing: fatal error: no input files\n";
std::cerr << "compilation terminated.";
return EXIT_FAILURE;
}
if (program.peek() != std::char_traits<char>::eof())
{
std::cerr << "nothing: fatal error: program is not empty\n";
std::cerr << "compilation terminated.";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Example:
# bash
$ touch helloworld.not
$ ./nothing helloworld.not
$
chmod
fromsys/stat.h
on an empty file. \$\endgroup\$ – user82302 Aug 29 '15 at 21:27