Giter Site home page Giter Site logo

night's Issues

Building a Wiki?

It's just some things remain a mystery, especially for those that just stumble upon this. For example, I, still don't know whether I could make void function in Night.

Errors in docs

You say in the docs that there is some support for loops, arrays and assignment operators (is that what they're called?) which the readme says there isn't. Also, the readme has an error. In the if-else if-else bit I think there is meant to be "\n" at the end of the print statements.

Favicon icon and meta tags of documentation page.

Hello, I've been visiting the Night documentation page and I've noticed that there's no favicon icon and meta tags for the website. I strongly suggest putting a favicon icon and meta tags for the documentation site to increase the SEO of the page. I would like to be assigned for this issue :)

[ENHANCEMENT] Update release to access on Replit

Hiya!

About

I found this Repl that allowed Replit Users to use (pretty much any lang that had a release) custom langs. However, the current release seems (very) outdated, and I would like to ask if any of the devs could make a new release that includes all the current code? That way, we can access the current version on Replit (I'm testing with it to test my own lang as well :P). Thanks!

Question

So just to clarify, the question was if you could release a release that holds all the current code :)

night

if the language is called night, and opposites attract, and chrome(the material) is the opposite color of night(black), why is this not supported for chromebooks?

Missing docs for source build

In the website there is a tab Source build and yet the HTML is empty.
You also appear to have a PE bin in the root, indicating a Windows build.
Do you plan to use Autoconf and Make?

Is This a Lexer Bug?

Found this on line 46 of the lexer.cpp:

if (i < code_line.length() - 1 && code_line[i] == '\\' && code_line[i] == '"')

but then, shouldn't it always evaluate as false? Since '\\' != '"'

Interested in writing a package manager?

I was thinking on calling it twilight or dusk, which do you think?
Also for the package manager should I go for a normal C program piggybacking on libcurl or a node.js script for getting data from the cdn?

Syscalls

Is there anyway I could invoke syscalls within Night?
I think this would best suited for a library since syscalls are a Unix/Linux only feature.
It might be possible with a foreign function interface.

Segmentation fault when trying recursion

I was trying to make a 99 bottles of beer program for Rosetta Code. I used a recursive function but it gave me a segmentation fault.
This was my code:

null bottles(int x) {
  if(x == 1) {
    print("1 bottle of beer on the wall,\n");
    print("1 bottle of beer,\n");
    print("Take it down, pass it around,\n");
    print("No more bottles of beer.\n");
  }
  else {
    print(x);
    print(" bottles of beer on the wall,\n");
    print(x);
    print(" bottles of beer,\n");
    print("Take one down, pass it around,\n");
    print(x - 1);
    print(" bottles of beer on the wall,");
    bottles(x-1);
  }
}
bottles(99);

When I get rid of the recursive call, there is no segmentation fault, but nothing is printed (Neither the if statement or the else statement are working). I know you are working on arrays now so you can leave this until v3.0 or later if you want. In the mean time I will just replace it with a loop.

Compiled editions for platforms

some users cannot compile the language due to a package that is not supported or is hard to get... CMake or things like it.
And otherusers just don't know how - because you did not have instructions on how to compile or they don't have permissions (like me :( ) or they could just be getting started programming (it is like downloading discord and they tell you that you have to set it up on your own by playing around with electron for hours with no instructions). What i am suggesting is we have the full compiled version in the releases for every major OS (windows (.exe), macos (.app) and linux (elf)) but the source code as well for advanced users.

Continuing with making users set it up on their own might deter them from getting it in the first place.

you do not have to accept this idea.

Enter Rosetta Code

Rosetta Code is a website with many different problems that are trying to be solved in as many different programming languages as possible. Anybody can add a solution to one of the problems in a new programming language. Perhaps you (or I can try if you want) could add Night to popularise it?

Website

JDOG and I are wondering if your website is on github, if so, can we make some PRs?
Thanks,
HahaYes

CI isn't working

The CI using Travis isn't working. I'm trying to use cmake to generate a .elf file for Linux.

Compilation error

In file included from src/lib/error.h:3, from src/night.cpp:3: src/lib/./string.h:271:62: error: 'night::string operator""_s(const char*, unsigned int)' has invalid argument list night::string operator""_s(const char* str, unsigned int len) ^ In file included from src/night.cpp:3: src/lib/error.h: In constructor 'Error::Error(const night::string&, const night::array&, int, int, const night::string&)': src/lib/error.h:41:21: error: unable to find string literal operator 'operator""_s' with 'const char [2]', 'long long unsigned int' arguments code[a].value = "'"_s + code[a].value + "'"; ^~~~~ src/lib/error.h:43:21: error: unable to find string literal operator 'operator""_s' with 'const char [2]', 'long long unsigned int' arguments code[a].value = "\""_s + code[a].value + "\""; ^~~~~~ src/lib/error.h: In member function 'night::string Error::what() const': src/lib/error.h:51:21: error: unable to find string literal operator 'operator""_s' with 'const char [9]', 'long long unsigned int' arguments output += I_RED + "Error - "_s + RESET; ^~~~~~~~~~~~ src/lib/error.h:52:33: error: unable to find string literal operator 'operator""_s' with 'const char [3]', 'long long unsigned int' arguments output += U_RED + errorType + "\n\n"_s + RESET; ^~~~~~~~ In file included from src/file_extraction.h:11, from src/night.cpp:4: src/./lexer.h: In function 'night::array Lexer(const night::string&)': src/./lexer.h:326:89: error: unable to find string literal operator 'operator""_s' with 'const char [7]', 'long long unsigned int' arguments throw Error(night::_invalid_token_, tokens, tokens.length() - 1, tokens.length() - 1, "token "_s + token + "' is not a valid token"_s); ^~~~~~~~~~ src/./lexer.h:326:110: error: unable to find string literal operator 'operator""_s' with 'const char [23]', 'long long unsigned int' arguments throw Error(night::_invalid_token_, tokens, tokens.length() - 1, tokens.length() - 1, "token "_s + token + "' is not a valid token"_s); ^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from src/interpreter/interpreter.h:12, from src/file_extraction.h:13, from src/night.cpp:4: src/interpreter/./expr_parser.h: In function 'void EvaluateNumeric(night::array&, int, const night::string&)': src/interpreter/./expr_parser.h:62:72: error: unable to find string literal operator 'operator""_s' with 'const char [11]', 'long long unsigned int' arguments throw Error(night::_invalid_expression_, expr, index - 1, index + 1, "operator '"_s + op + "' can only be used on values of type 'int' or 'dec', or if one of the values is of type 'str'"); ^~~~~~~~~~~~~~ In file included from src/interpreter/interpreter.h:12, from src/file_extraction.h:13, from src/night.cpp:4: src/interpreter/./expr_parser.h: In function 'void EvaluateNumComparison(night::array&, int, const night::string&)': src/interpreter/./expr_parser.h:81:72: error: unable to find string literal operator 'operator""_s' with 'const char [11]', 'long long unsigned int' arguments throw Error(night::_invalid_expression_, expr, index - 1, index + 1, "operator '"_s + op + "' can only be used on values of type 'int' or 'dec'"); ^~~~~~~~~~~~~~ src/interpreter/./expr_parser.h: In function 'void EvaluateComparison(night::array&, int, const night::string&)': src/interpreter/./expr_parser.h:91:4: error: unable to find string literal operator 'operator""_s' with 'const char [11]', 'long long unsigned int' arguments "operator '"_s + op + "' can only compare to values of the same type"); ^~~~~~~~~~~~~~ src/interpreter/./expr_parser.h:94:72: error: unable to find string literal operator 'operator""_s' with 'const char [11]', 'long long unsigned int' arguments throw Error(night::_invalid_expression_, expr, index - 1, index - 1, "operator '"_s + op + "' can only compare values of type 'bit', 'syb', 'int', 'dec', or 'str'"); ^~~~~~~~~~~~~~ src/interpreter/./expr_parser.h:97:72: error: unable to find string literal operator 'operator""_s' with 'const char [11]', 'long long unsigned int' arguments throw Error(night::_invalid_expression_, expr, index + 1, index + 1, "operator '"_s + op + "' can only compare values of type 'bit', 'syb', 'int', 'dec', or 'str'"); ^~~~~~~~~~~~~~ src/interpreter/./expr_parser.h: In function 'void EvaluateBoolean(night::array&, int, const night::string&)': src/interpreter/./expr_parser.h:118:72: error: unable to find string literal operator 'operator""_s' with 'const char [11]', 'long long unsigned int' arguments throw Error(night::_invalid_expression_, expr, index - 1, index + 1, "operator '"_s + op + "' can only be used on values of type 'bit'"); ^~~~~~~~~~~~~~ src/interpreter/./expr_parser.h: In function 'Token ParseExpression(night::array, night::array&, night::array&, night::array&)': src/interpreter/./expr_parser.h:246:71: error: unable to find string literal operator 'operator""_s' with 'const char [11]', 'long long unsigned int' arguments throw Error(night::_invalid_function_, expr, 0, expr.length(), "expecting "_s + night::itos(function->params.length()) + " parameters"); ^~~~~~~~~~~~~~ src/interpreter/./expr_parser.h:328:63: error: unable to find string literal operator 'operator""_s' with 'const char [60]', 'long long unsigned int' arguments throw Error(night::_invalid_array_, expr, a + 3, b - 1, "array index is out of range; the last element is at index '"_s + night::itos(array->elems.length() - 1) + "'"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from src/file_extraction.h:13, from src/night.cpp:4: src/interpreter/interpreter.h: In function 'void Interpreter(night::array >&)': src/interpreter/interpreter.h:141:79: error: unable to find string literal operator 'operator""_s' with 'const char [19]', 'long long unsigned int' arguments throw Error(night::_invalid_variable_, code[a], 2, code[a].length() - 2, "variable of type '"_s + night::ttos(variable->type) + "' cannot be assigned with expression of type '" + night::ttos(expression.type) + "'"); ^~~~~~~~~~~~~~~~~~~~~~ src/interpreter/interpreter.h:173:61: error: unable to find string literal operator 'operator""_s' with 'const char [19]', 'long long unsigned int' arguments throw Error(night::_invalid_variable_, code[a], 1, 1, "variable of type '"_s + night::ttos(variable->type) + "' cannot be used with a '" + code[a][1].value + "' operator"); ^~~~~~~~~~~~~~~~~~~~~~ src/interpreter/interpreter.h:193:57: error: unable to find string literal operator 'operator""_s' with 'const char [24]', 'long long unsigned int' arguments throw Error(night::_invalid_array_, code[a], 2, 2, "array must be of type '"_s + night::ttos(array->type) + "'"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ src/interpreter/interpreter.h:229:58: error: unable to find string literal operator 'operator""_s' with 'const char [16]', 'long long unsigned int' arguments throw Error(night::_invalid_array_, code[a], b, b, "array of type '"_s + night::ttos(array->type) + "' cannot be assigned to array of type '" + night::ttos(evaluateElement.type) + "'"); ^~~~~~~~~~~~~~~~~~~ src/interpreter/interpreter.h:350:76: error: unable to find string literal operator 'operator""_s' with 'const char [11]', 'long long unsigned int' arguments throw Error(night::_invalid_function_, code[a], 0, code[a].length(), "expecting "_s + night::itos(function->params.length()) + " parameters"); ^~~~~~~~~~~~~~ src/interpreter/interpreter.h:387:74: error: unable to find string literal operator 'operator""_s' with 'const char [11]', 'long long unsigned int' arguments throw Error(night::_invalid_function_, code[a], 0, code[a].length(), "expecting "_s + night::itos(function->params.length()) + " parameters"); ^~~~~~~~~~~~~~ src/interpreter/interpreter.h:465:85: error: unable to find string literal operator 'operator""_s' with 'const char [16]', 'long long unsigned int' arguments throw Error(night::_invalid_array_, code[a], closeSquare + 3, closeSquare + 3, "array of type '"_s + night::ttos(code[a][0].type) + "' cannot be initialized with an array of type '" + night::ttos(assignArray->type) + "'"); ^~~~~~~~~~~~~~~~~~~ src/interpreter/interpreter.h:499:87: error: unable to find string literal operator 'operator""_s' with 'const char [38]', 'long long unsigned int' arguments throw Error(night::_invalid_array_, code[a], closeSquare, code[a].length() - 1, "too many elements in array; expected "_s + night::itos(arrayLength) + " elements"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/interpreter/interpreter.h:549:66: error: unable to find string literal operator 'operator""_s' with 'const char [60]', 'long long unsigned int' arguments throw Error(night::_invalid_array_, code[a], 2, closeSquare, "array index is out of range; the last element is at index '"_s + night::itos(array->elems.length() - 1) + "'"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/interpreter/interpreter.h:553:89: error: unable to find string literal operator 'operator""_s' with 'const char [54]', 'long long unsigned int' arguments throw Error(night::_invalid_array_, code[a], closeSquare + 2, code[a].length() - 2, "array can only be assigned to an expression of type '"_s + night::ttos(array->type) + "'"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/interpreter/interpreter.h:596:69: error: unable to find string literal operator 'operator""_s' with 'const char [60]', 'long long unsigned int' arguments throw Error(night::_invalid_array_, code[a], b + 3, c - 1, "array index is out of range; the last element is at index '"_s + night::itos(array->elems.length() - 1) + "'"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make: *** [build_night] Error 1

Trouble compiling night

I'm trying to compile night, but I get errors using g++, clang++, and make.
g++ error:

In file included from src/../include/night.hpp:3:0,
                 from src/night.cpp:1:
src/../include/token.hpp:203:7: error: ‘variant’ in namespace std’ does not name a template type
  std::variant<
       ^~~~~~~
exit status 1

clang++ error:

In file included from src/night.cpp:1:
In file included from src/../include/night.hpp:3:
src/../include/token.hpp:203:7: error: no template named 'variant' in namespace
      'std'
        std::variant<
        ~~~~~^
1 error generated.
exit status 1

make error:

Makefile:4: recipe for target 'build' failed
make: *** [build] Error 1
exit status 2

I found a problem

Uh so, I was testing night for the first time, and I was doing something with an if and Woops! an error that sdhouldn't exist.
image
I did put a semicolon, weird.
Tip: add the bitwise XOR operator ^

About non-coding stuff...?

EXAMPLE:

  • Building better docs?
  • Making a github 'Night' team/organisation profile (like a lot of big languages)?
  • Github action for main and side project progress tracking?
  • A task list for everyone? TBH I'm bored
  • etc, etc; that kind of stuff

some problems

I would like to ask a question. Why doesn't the code run?

if(1 < 2) {
}

And why the definitions of greater than sign, less than sign, greater than or equal sign, less than or equal sign are different, as follows:

{ '>', { { '=', TokenType::ASSIGN }, { '\0', TokenType::BINARY_OP } } },
{ '<', { { '=', TokenType::ASSIGN }, { '\0', TokenType::BINARY_OP } } },

I'm trying to learn to read projects, so there are some places lol

Do you have an FAQ?

This language looks quite similar to C++, but I'm curious if you have any goals for it, that would help someone decide why to write in Night instead of C++?

Create a new release

For the PKGBUILD, a new release is needed so that the tarball can be fetched, and the repo contains a bugfix allowing code to run, so, perhaps create a v3.0.1 bugfix release. Thanks!

\n doesn't work

When in a function and I try to print something including \n it prints \n instead of a newline. Also, a character whose value is ' ', '\n' or '\0' (perhaps others as well) it disappears. Code: print("Hello world" + '\n');
Result:

Error - expression is invalid

"Hello world" + 
              ~ 
expected value after operator '+'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.