Coder Social home page Coder Social logo

pocketpy / pocketpy Goto Github PK

View Code? Open in Web Editor NEW
1.5K 17.0 106.0 20.99 MB

Portable Python 3.x Interpreter in Modern C

Home Page: https://pocketpy.dev/

License: MIT License

Python 32.04% C++ 54.45% C 8.48% HTML 0.03% JavaScript 0.32% CSS 0.23% CMake 3.88% Shell 0.30% Lua 0.27%
header-only interpreter language python programming-language scripting-language vm c c11

pocketpy's Introduction

pocketpy: python interpreter in 1 file

C++17 GitHub GitHub release Website

pkpy is a lightweight(~15K LOC) Python interpreter for game scripting, built on C++17 with STL.

It aims to be an alternative to lua for game scripting, with elegant syntax, powerful features and competitive performance. pkpy is extremely easy to embed via a single header file pocketpy.h, without external dependencies.

Please see https://pocketpy.dev for details and try the following resources.

We are moving to v2.0 branch, which is a complete refactor of this project in C11. See Migration Guide for more details.

Supported Platforms

pkpy should work on any platform with a C++17 compiler. These platforms are officially tested.

  • Windows 64-bit
  • Linux 64-bit / 32-bit
  • macOS 64-bit
  • Android 64-bit / 32-bit
  • iOS 64-bit
  • Emscripten 32-bit
  • Raspberry Pi OS 64-bit

Quick Start

You have two options to integrate pkpy into your project.

Use the single header file

Download the pocketpy.h on our GitHub Release page. And #include it in your project. The header can only be included once.

Use CMake

Clone the whole repository as a submodule into your project, In your CMakelists.txt, add the following lines:

add_subdirectory(pocketpy)
target_link_libraries(<your_target> pocketpy)

if(EMSCRIPTEN)
    # exceptions must be enabled for emscripten
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fexceptions")
endif()

See CMakeLists.txt for details.

It is safe to use main branch in production if CI badge is green.

Compile Flags

To compile it with your project, these flags must be set:

  • --std=c++17 flag must be set
  • RTTI must be enabled
  • Exception must be enabled
  • For MSVC, /utf-8 flag must be set

For development build, use this snippet.

# prerequisites
pip install cmake
# build the repo
python cmake_build.py
# unittest
python scripts/run_tests.py

Example

#include <pybind11/pybind11.h>

namespace py = pybind11;

int main() {
    // Start the interpreter
    py::scoped_interpreter guard{};

    // Hello world!
    py::exec("print('Hello world!')");

    // Create a list
    py::exec("a = [1, 2, 3]");

    // Eval the sum of the list
    auto result = py::eval("sum(a)");
    std::cout << "Sum of the list: " << result.cast<int>() << std::endl;  // 6

    // Bindings
    auto m = py::module_::__main__();
    m.def("add", [](int a, int b) {
        return a + b;
    });

    // Call the function
    std::cout << "Sum of 2 variables: " << m.attr("add")(1, 2).cast<int>() << std::endl;  // 10

    return 0;
}

Features

Check this Cheatsheet for a quick overview of the supported features.

Name Example Supported
If Else if..else..elif
Loop for/while/break/continue
Function def f(x,*args,y=1):
Subclass class A(B):
List [1, 2, 'a']
ListComp [i for i in range(5)]
Slice a[1:2], a[:2], a[1:]
Tuple (1, 2, 'a')
Dict {'a': 1, 'b': 2}
F-String f'value is {x}'
Unpacking a, b = 1, 2
Star Unpacking a, *b = [1, 2, 3]
Exception raise/try..catch..finally
Dynamic Code eval()/exec()
Reflection hasattr()/getattr()/setattr()
Import import/from..import
Context Block with <expr> as <id>:
Type Annotation def f(a:int, b:float=1)
Generator yield i
Decorator @cache

Performance

Currently, pkpy is as fast as cpython 3.9. Performance results for cpython 3.9 are applicable to for pkpy.

See https://pocketpy.dev/performance/ for details.

And these are the results of the primes benchmark on Intel i5-12400F, WSL (Ubuntu 20.04 LTS), which roughly reflects the performance among c++, lua, pkpy and cpython.

name version time file
c++ gnu++11 0.104s ■□□□□□□□□□□□□□□□ benchmarks/primes.cpp
lua 5.3.3 1.576s ■■■■■■■■■□□□□□□□ benchmarks/primes.lua
pkpy 1.2.7 2.385s ■■■■■■■■■■■■■□□□ benchmarks/primes.py
cpython 3.8.10 2.871s ■■■■■■■■■■■■■■■■ benchmarks/primes.py

Used By

Description
TIC-80 TIC-80 is a fantasy computer for making, playing and sharing tiny games.
MiniPythonIDE A python ide base on pocketpy
py-js Python3 externals for Max / MSP
crescent Crescent is a cross-platform 2D fighting and beat-em-up game engine.

Submit a pull request to add your project here.

Contribution

All kinds of contributions are welcome.

  • Submit a Pull Request
    • fix a bug
    • add a new feature
  • Open an Issue
    • any suggestions
    • any questions

If you find pkpy useful, consider star this repository (●'◡'●)

Sponsor this project

You can sponsor this project via these ways.

Your sponsorship will help us develop pkpy continuously.

Reference

  • cpython

    The official implementation of Python programming language.

  • byterun

    An excellent learning material. It illustrates how Python's virtual machine works.

Star History

Star History Chart

License

MIT License

pocketpy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pocketpy's Issues

Make build faster.

I think that pocketpy is awesome, but i really would like to have a more efficient edit-compile-run cycle, I was thinking of bridging this to c++20 modules, but im not sure it would work bc of static members and stuff.

optimiazte emhash8

you can define maco EMH_WYHASH_HASH before including head file hash_table8.hpp
which is more efficient than std::hash

c example

Hi @blueloveTH

Very cool project. Thanks very sharing!

Incidentally, I had trouble compiling the c-example on macOS 12.6.3 (Monterey) x86_64 without changing this line

VM* vm = pkpy_new_vm(true);

to

pkpy::VM* vm = pkpy_new_vm(true);

using

clang++ --std=c++17 -o demo demo.cpp

post 1.0 bind_builtin_func not allowing lambda variable capture

I've been recently converting my project's pocketpy code to the latest pocketpy 1.0 version and I found (at least for me) what looks like a bug or a feature regression:

In the older 0.9.5 code, I could a bind a builtin function like this without issues:

    x->py->vm->bind_builtin_func<1>("out_int", [x](VM* vm, Args& args) {
        i64 a = CAST(i64, args[0]);
        outlet_int(x->outlet, a);
        return vm->None;
    });

When I translated the same code to the new 1.0+ idioms:

    x->py->vm->bind_builtin_func<1>("out_int", [x](VM* vm, ArgsView args) {
        i64 a = CAST(i64, args[0]);
        outlet_int(x->outlet, a);
        return vm->None;
    });

I cannot compile it and I get the following error:

src/pktpy/pktpy.cpp:436:16: fatal error: no matching member function for call to 'bind_builtin_func'
    x->py->vm->bind_builtin_func<1>("out_int", [x](VM* vm, ArgsView args) {
    ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
src/pktpy/pocketpy.h:3727:15: note: candidate function template not viable: 
no known conversion from '(lambda at src/pktpy/pktpy.cpp:436:48)' to 'pkpy::NativeFuncC' (aka 'pkpy::PyObject *(*)(pkpy::VM *, pkpy::ArgsView)') for 2nd argument
    PyObject* bind_builtin_func(Str name, NativeFuncC fn) {
              ^

Is there any way to resolve this?

flutter build apk Fail on Linux Ubuntu

flutter build apk
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!

💪 Building with sound null safety 💪

Building with Flutter multidex support enabled.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':pocketpy:buildCMakeRelWithDebInfo[arm64-v8a]'.

Build command failed.
Error while executing process /home/mkw/Android/Sdk/cmake/3.18.1/bin/ninja with arguments {-C /home/mkw/.pub-cache/hosted/pub.dev/pocketpy-0.9.3/android/.cxx/RelWithDebInfo/161p5t12/arm64-v8a pocketpy}
ninja: Entering directory `/home/mkw/.pub-cache/hosted/pub.dev/pocketpy-0.9.3/android/.cxx/RelWithDebInfo/161p5t12/arm64-v8a'
[1/2] Building CXX object CMakeFiles/pocketpy.dir/pocketpy.cpp.o
FAILED: CMakeFiles/pocketpy.dir/pocketpy.cpp.o
/home/mkw/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/mkw/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/mkw/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DDART_SHARED_LIB -Dpocketpy_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O2 -g -DNDEBUG -fPIC -fno-rtti -std=gnu++17 -MD -MT CMakeFiles/pocketpy.dir/pocketpy.cpp.o -MF CMakeFiles/pocketpy.dir/pocketpy.cpp.o.d -o CMakeFiles/pocketpy.dir/pocketpy.cpp.o -c /home/mkw/.pub-cache/hosted/pub.dev/pocketpy-0.9.3/src/pocketpy.cpp
In file included from /home/mkw/.pub-cache/hosted/pub.dev/pocketpy-0.9.3/src/pocketpy.cpp:1:
In file included from /home/mkw/.pub-cache/hosted/pub.dev/pocketpy-0.9.3/src/pocketpy.h:19:
In file included from /snap/flutter/current/usr/include/c++/9/regex:45:
/snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/mkw/.pub-cache/hosted/pub.dev/pocketpy-0.9.3/src/pocketpy.cpp:1:
/home/mkw/.pub-cache/hosted/pub.dev/pocketpy-0.9.3/src/pocketpy.h:5353:54: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
std::uintptr_t addr = self.is_tagged() ? 0 : (uintptr_t)self.get();
^~~~~~~~~~~~~~~~~~~~~
2 errors generated.
ninja: build stopped: subcommand failed.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 7s
Running Gradle task 'assembleRelease'... 8.5s
Gradle task assembleRelease failed with exit code 1

Support for result if cond else alternative

I wanted to get a quick idea about performance in a one liner, compared to python (3.10.6):

$ time (echo -e "def f(x): return 1 if x <= 2 else f(x-1) + f(x-2)\n\nfor i in range(1,34): print (f(i))" | python3)
real	0m0,935s
user	0m0,934s
sys	0m0,000s

But that fails to run in pocketpy atm:

File "main.py", line 1
    def f(x): return 1 if x <= 2 else f(x-1) + f(x-2)
                       ^
SyntaxError: expected statement end

So here's the pocketpy version with traditional if:

// == pocketpy-fib.cc ==
#include "pocketpy.h"
int main (int argc, const char *argv[]) {
  VM *vm = pkpy_new_vm (true);
  const char *fib = "def f(x):\n"
                    "  if x <= 2: return 1\n"
                    "  return f(x-1) + f(x-2) \n"
                    "\n"
                    "for i in range(1,34): print (f(i))\n";
  pkpy_vm_exec (vm, fib);
  pkpy_delete (vm);
  return 0;
}
$ g++ -std=gnu++17 -Wall -O3 -march=native pocketpy-fib.cc && time ./a.out
real	0m4,976s
user	0m4,975s
sys	0m0,000s

Nice tiny interpreter! ;-)

Sponsorship Inquiry and Technical Advisor Invitation for pikapython

Hello @blueloveTH

I hope this message finds you well. First and foremost, I want to express my appreciation for the work you've done on the pocketpy project. I believe it's a valuable tool that has been beneficial to many users in the Python community.

I'm writing this issue to let you know that I would like to provide sponsorship to the pocketpy project. While I may not be able to contribute a significant amount, I would still like to offer some support to help the project continue to grow and thrive.

In addition to this, I would also like to extend an invitation for you to become a technical advisor for the pikapython project (https://github.com/pikastech/pikapython). Your expertise and experience with pocketpy could be extremely valuable for our team as we continue to develop and improve our project.

Please note that the sponsorship offer stands regardless of whether you accept the technical advisor invitation or not.

Please let me know how I can proceed with the sponsorship and if you're interested in becoming a technical advisor for pikapython. I look forward to hearing from you soon.

Thank you for your time and consideration.

pythonpath or execfile support?

Hi,

Thanks very much for creating this project. I'm really enjoying using your library in a max external plugin, I have been working on recently:

screanshot

I'm really interested in setting the working directory for imports (like a pythonpath) or in some kind of execfile(path) support where path is python script.

Is this something already available or planned?

`pkpy` syntax errors that are valid in cpython

Hello @blueloveTH,
I've been playing with pocketpy and here are some syntax errors that are valid in cpython but not in pkpy.

1-tuple or empty tuple:

(1,)     # SyntaxError
1,       # SyntaxError
()       # SyntaxError
tuple()  # TypeError

Empty list slice:

[][:-1] # std::exception

One line if/function:

if 1: pass    # SyntaxError
def f(): pass # SyntaxError

Do you think they should be valid pkpy code as well?

About the operation of large numbers

When I used this interpreter to calculate 99**99, there was an overflow. Do you need to solve this problem? I know this is a lightweight interpreter, and I'm not a game developer, just a simple curiosity, thanks.

split header design

There's a common use case of wanting to use the pocketpy.h header as a header (without implementation) and also as a header (with implementation): basically to compile the implementation part into a dynamic or static library and then use it with only the header part.

Currently the header is really just the implementation:

#ifndef POCKETPY_H
#define POCKETPY_H

// ... header + implementation

#endif // POCKETPY_H

whereas I suggest to change it to a classic split structure:

#ifndef POCKETPY_H
#define POCKETPY_H

// ... only header part

#endif // POCKETPY_H

#ifdef POCKETPY_IMPLEMENTATION

// ... only implementation part

#endif // POCKETPY_IMPLEMENTATION

In the latter case, I can use pocketpy.h in header-only mode as follows:

#include "pocketpy.h"

and as header + implementation mode as follows:

#include "pocketpy.h"
#define POCKETPY_IMPLEMENTATION

`dir("s")` gives segfault

Hello, I was playing with the REPL and when I type the following code, it gives segmentation fault:

>>> dir("s")
[1]    144790 segmentation fault (core dumped)  ./pocketpy

And this one as well:

>>> s = "s"
>>> dir(s)
[1]    144790 segmentation fault (core dumped)  ./pocketpy

I only got this error when using dir with strings, it seems to work properly for other types.

TODO: subclass enabled native struct wrapper

Currently, user defined classes are not able to derive from a c implemented type (unsafe).

We are planning a feature. One can mark a c implemented type as subclass enabled. And provide a special CAST macro for this case.

Add partial execution of compiled code

Idk how hard it would be to implement, but here is my idea:
Instead of executing whole code at once add a function that will work something like this:

auto code = vm->compile("some long python code", EXEC_MODE)
auto max_pass_bytecode_instructions = 1000 // maximum amount of instructions that vm can execute in one pass
while (true) {
   //nullptr because code is not finished executing
    if (vm->_exec_partial(max_pass_bytecode_instructions, code, vm->_main) != nullptr) {break;}
}

This will allow to have several separate VM's running on one thread without making several threads for each VM.

CS0656 when using .NET Standard 2.1 in Unity

Assets\PocketPy\FFI.cs(27,52): 
error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'

Reproducible by creating an empty 3d project in Unity 2021.3.15f1 and importing PocketPy from the Asset Store.
Setting the 'Api Compatibility Level' option in Player settings from .NET Standard 2.1 (default) to .NET Framework fixes this error.

The code referenced:

static object invoke_f_any(string s)
{
    var parts = s.Split(' ');
    List<dynamic> args = new List<dynamic>();
    for (int i = 1; i < parts.Length; i++) args.Add(parse(parts[i]));
    var f = mappings[parts[0]];
    return f.DynamicInvoke(args.ToArray());
}

I believe it could be related to List args being dynamic

Scope of the language / deviations from Python

I would like to get a better sense of how PocketPy intends to develop as a language. Does it aim to strictly retain as close a relationship to Python as possible, in terms of syntax and functionality? Or, does it aim to simply be Python-like in spirit?

For example, here are some non-Python features / syntax I would like to see (and will probably try to implement on my fork):

  • Dotted access for dictionary keys
d = {"a": 1} ; assert d.a == 1
  • Less verbose lambda syntax. One idea:
add = x, y -> x + y
const = None -> 1
((x, y, z) -> x + y + z)(1,1,1)
  • Labeled for loops. One idea:
for x in Iter1 as outer:
  for y in Iter2 as inner:
    if f(x, y):
     break outer # Break out of both loops 

Another thing I noticed is that dict is implemented in Pocketpy, instead of in CPP. Could you explain the motivation for this? Is this motivated by keeping the language core as small as possible?

Generally, I am trying to gauge what sort of contributions that extend the language, would be welcome.

Flutter support again?

I recently found PocketPy through Flutter but ran into issues building it with Flutter. It looks like the API was removed.

Are there plans to bring it back to life or is Flutter officially dropped as a supported target?

TODO: impl `pickle` module

The pickle module implements binary protocols for serializing and de-serializing a Python object structure. “Pickling” is the process whereby a Python object hierarchy is converted into a byte stream, and “unpickling” is the inverse operation, whereby a bytes object is converted back into an object hierarchy.

Currently, the bytes class in pkpy has been implemented. A serialization mechanism similar to pickle is highly needed to achieve deep copying of objects. Our pickle mechanism should have similar functionality to cpython, but it does not necessarily need to be compatible (if achieving compatibility is complex)

C-API: how to exchange scalar data or arrays or lists

Thank for this clever python alike library! This could be useful for many applications, not only gaming.

Sorry for my ignorance: What is the easiest way to exchange scalar data (float, int) beside of chars with the help of the C-API? And is there a way to exchange arrays of data of uniform data types?

And as I'm curious: what is the meaning of pkpy_setup_callbacks?

I'm thinking of using pocketpy as a kind of programmable input-file for data processing.

_exec return value

it seems like _exec should give you the pyobject that results from the last statement it runs, but instead it seems like it always returns None.

This might be intended behavior and if it is that is fine, I just figured I would check

pocketpy not compiling with gcc

checking out the repository and running the command

g++ --std=c++17 main.cpp

in the src/ directory does not successfully compile, it fails with this error :

In file included from ceval.h:3,
                 from pocketpy.h:3,
                 from main.cpp:4:
lexer.h: In function ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’:
common.h:127:23: error: expression ‘<throw-expression>’ is not a constant expression
  127 | #define FATAL_ERROR() throw std::runtime_error( __FILE__ + std::string(":") + std::to_string(__LINE__) + " FATAL_ERROR()!");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lexer.h:41:5: note: in expansion of macro ‘FATAL_ERROR’
   41 |     FATAL_ERROR();
      |     ^~~~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h: In member function ‘void pkpy::Lexer::add_token(pkpy::TokenIndex, pkpy::TokenValue)’:
lexer.h:264:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  264 |             case TK("{"): case TK("["): case TK("("): brackets_level++; break;
      |                  ~~^~~~~
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
lexer.h:264:34: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  264 |             case TK("{"): case TK("["): case TK("("): brackets_level++; break;
      |                                ~~^~~~~
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
lexer.h:264:48: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  264 |             case TK("{"): case TK("["): case TK("("): brackets_level++; break;
      |                                              ~~^~~~~
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
lexer.h:265:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  265 |             case TK(")"): case TK("]"): case TK("}"): brackets_level--; break;
      |                  ~~^~~~~
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
lexer.h:265:34: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  265 |             case TK(")"): case TK("]"): case TK("}"): brackets_level--; break;
      |                                ~~^~~~~
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
lexer.h:265:48: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  265 |             case TK(")"): case TK("]"): case TK("}"): brackets_level--; break;
      |                                              ~~^~~~~
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h: In member function ‘virtual void pkpy::Literal0Expr::emit(pkpy::CodeEmitContext*)’:
expr.h:247:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  247 |             case TK("None"):    ctx->emit(OP_LOAD_NONE, BC_NOARG, line); break;
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:248:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  248 |             case TK("True"):    ctx->emit(OP_LOAD_TRUE, BC_NOARG, line); break;
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:249:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  249 |             case TK("False"):   ctx->emit(OP_LOAD_FALSE, BC_NOARG, line); break;
      |                  ~~^~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:250:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  250 |             case TK("..."):     ctx->emit(OP_LOAD_ELLIPSIS, BC_NOARG, line); break;
      |                  ~~^~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h: In member function ‘virtual void pkpy::BinaryExpr::emit(pkpy::CodeEmitContext*)’:
expr.h:673:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  673 |             case TK("+"):   ctx->emit(OP_BINARY_ADD, BC_NOARG, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:674:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  674 |             case TK("-"):   ctx->emit(OP_BINARY_SUB, BC_NOARG, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:675:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  675 |             case TK("*"):   ctx->emit(OP_BINARY_MUL, BC_NOARG, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:676:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  676 |             case TK("/"):   ctx->emit(OP_BINARY_OP, 3, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:677:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  677 |             case TK("//"):  ctx->emit(OP_BINARY_FLOORDIV, BC_NOARG, line);  break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:678:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  678 |             case TK("%"):   ctx->emit(OP_BINARY_MOD, BC_NOARG, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:679:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  679 |             case TK("**"):  ctx->emit(OP_BINARY_OP, 6, line);  break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:681:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  681 |             case TK("<"):   ctx->emit(OP_COMPARE_LT, BC_NOARG, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:682:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  682 |             case TK("<="):  ctx->emit(OP_COMPARE_LE, BC_NOARG, line);  break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:683:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  683 |             case TK("=="):  ctx->emit(OP_COMPARE_EQ, BC_NOARG, line);  break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:684:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  684 |             case TK("!="):  ctx->emit(OP_COMPARE_NE, BC_NOARG, line);  break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:685:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  685 |             case TK(">"):   ctx->emit(OP_COMPARE_GT, BC_NOARG, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:686:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  686 |             case TK(">="):  ctx->emit(OP_COMPARE_GE, BC_NOARG, line);  break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:687:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  687 |             case TK("in"):      ctx->emit(OP_CONTAINS_OP, 0, line);   break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:688:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  688 |             case TK("not in"):  ctx->emit(OP_CONTAINS_OP, 1, line);   break;
      |                  ~~^~~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:689:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  689 |             case TK("is"):      ctx->emit(OP_IS_OP, 0, line);         break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:690:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  690 |             case TK("is not"):  ctx->emit(OP_IS_OP, 1, line);         break;
      |                  ~~^~~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:692:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  692 |             case TK("<<"):  ctx->emit(OP_BITWISE_LSHIFT, BC_NOARG, line);  break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:693:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  693 |             case TK(">>"):  ctx->emit(OP_BITWISE_RSHIFT, BC_NOARG, line);  break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:694:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  694 |             case TK("&"):   ctx->emit(OP_BITWISE_AND, BC_NOARG, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:695:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  695 |             case TK("|"):   ctx->emit(OP_BITWISE_OR, BC_NOARG, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
expr.h:696:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  696 |             case TK("^"):   ctx->emit(OP_BITWISE_XOR, BC_NOARG, line);  break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h: In member function ‘void pkpy::Compiler::exprUnaryOp()’:
compiler.h:287:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  287 |             case TK("-"):
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:290:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  290 |             case TK("*"):
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h: In member function ‘bool pkpy::Compiler::try_compile_assignment()’:
compiler.h:666:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  666 |             case TK("+="): case TK("-="): case TK("*="): case TK("/="): case TK("//="): case TK("%="):
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:666:35: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  666 |             case TK("+="): case TK("-="): case TK("*="): case TK("/="): case TK("//="): case TK("%="):
      |                                 ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:666:50: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  666 |             case TK("+="): case TK("-="): case TK("*="): case TK("/="): case TK("//="): case TK("%="):
      |                                                ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:666:65: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  666 |             case TK("+="): case TK("-="): case TK("*="): case TK("/="): case TK("//="): case TK("%="):
      |                                                               ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:666:80: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  666 |             case TK("+="): case TK("-="): case TK("*="): case TK("/="): case TK("//="): case TK("%="):
      |                                                                              ~~^~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:666:96: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  666 |             case TK("+="): case TK("-="): case TK("*="): case TK("/="): case TK("//="): case TK("%="):
      |                                                                                              ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:667:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  667 |             case TK("<<="): case TK(">>="): case TK("&="): case TK("|="): case TK("^="): {
      |                  ~~^~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:667:36: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  667 |             case TK("<<="): case TK(">>="): case TK("&="): case TK("|="): case TK("^="): {
      |                                  ~~^~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:667:52: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  667 |             case TK("<<="): case TK(">>="): case TK("&="): case TK("|="): case TK("^="): {
      |                                                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:667:67: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  667 |             case TK("<<="): case TK(">>="): case TK("&="): case TK("|="): case TK("^="): {
      |                                                                 ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:667:82: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  667 |             case TK("<<="): case TK(">>="): case TK("&="): case TK("|="): case TK("^="): {
      |                                                                                ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:678:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  678 |             case TK("="):
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h: In member function ‘void pkpy::Compiler::compile_stmt()’:
compiler.h:703:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  703 |             case TK("break"):
      |                  ~~^~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:708:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  708 |             case TK("continue"):
      |                  ~~^~~~~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:713:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  713 |             case TK("yield"):
      |                  ~~^~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:721:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  721 |             case TK("yield from"):
      |                  ~~^~~~~~~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:734:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  734 |             case TK("return"):
      |                  ~~^~~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:745:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  745 |             case TK("if"): compile_if_stmt(); break;
      |                  ~~^~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:746:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  746 |             case TK("while"): compile_while_loop(); break;
      |                  ~~^~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:747:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  747 |             case TK("for"): compile_for_loop(); break;
      |                  ~~^~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:748:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  748 |             case TK("import"): compile_normal_import(); break;
      |                  ~~^~~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:749:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  749 |             case TK("from"): compile_from_import(); break;
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:750:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  750 |             case TK("def"): compile_function(); break;
      |                  ~~^~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:751:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  751 |             case TK("@"): compile_decorated(); break;
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:752:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  752 |             case TK("try"): compile_try_except(); break;
      |                  ~~^~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:753:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  753 |             case TK("pass"): consume_end_stmt(); break;
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:755:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  755 |             case TK("assert"):
      |                  ~~^~~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:760:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  760 |             case TK("global"):
      |                  ~~^~~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:767:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  767 |             case TK("raise"): {
      |                  ~~^~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:778:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  778 |             case TK("del"): {
      |                  ~~^~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:785:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  785 |             case TK("with"): {
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:799:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  799 |             case TK("label"): {
      |                  ~~^~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:806:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  806 |             case TK("goto"):
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h: In member function ‘pkpy::PyObject* pkpy::Compiler::read_literal()’:
compiler.h:980:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  980 |             case TK("-"): {
      |                  ~~^~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:985:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  985 |             case TK("@num"): return to_object(prev().value);
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:986:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  986 |             case TK("@str"): return to_object(prev().value);
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:987:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  987 |             case TK("True"): return VAR(true);
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:988:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  988 |             case TK("False"): return VAR(false);
      |                  ~~^~~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:989:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  989 |             case TK("None"): return vm->None;
      |                  ~~^~~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:4,
                 from main.cpp:4:
compiler.h:990:20: error: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ called in a constant expression
  990 |             case TK("..."): return vm->Ellipsis;
      |                  ~~^~~~~~~
In file included from expr.h:5,
                 from compiler.h:5,
                 from pocketpy.h:4,
                 from main.cpp:4:
lexer.h:34:22: note: ‘constexpr pkpy::TokenIndex pkpy::TK(const char*)’ declared here
   34 | constexpr TokenIndex TK(const char token[]) {
      |                      ^~
In file included from pocketpy.h:9,
                 from main.cpp:4:
io.h: In constructor ‘pkpy::FileIO::FileIO(pkpy::VM*, pkpy::Str, pkpy::Str)’:
io.h:34:41: error: invalid conversion from ‘int’ to ‘std::ios_base::openmode’ [-fpermissive]
   34 |         std::ios_base::openmode extra = 0;
      |                                         ^
      |                                         |
      |                                         int
io.h:39:53: error: no matching function for call to ‘std::basic_fstream<char>::open(std::string_view, std::_Ios_Openmode)’
   39 |             _fs.open(file.sv(), std::ios::in | extra);
      |                                                     ^
In file included from main.cpp:1:
/usr/include/c++/10/fstream:1177:7: note: candidate: ‘void std::basic_fstream<_CharT, _Traits>::open(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::ios_base::openmode]’
 1177 |       open(const char* __s,
      |       ^~~~
/usr/include/c++/10/fstream:1177:24: note:   no known conversion for argument 1 from ‘std::string_view’ {aka ‘std::basic_string_view<char>’} to ‘const char*’
 1177 |       open(const char* __s,
      |            ~~~~~~~~~~~~^~~
/usr/include/c++/10/fstream:1218:7: note: candidate: ‘void std::basic_fstream<_CharT, _Traits>::open(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::string = std::__cxx11::basic_string<char>; std::ios_base::openmode = std::ios_base::openmode]’
 1218 |       open(const std::string& __s,
      |       ^~~~
/usr/include/c++/10/fstream:1218:31: note:   no known conversion for argument 1 from ‘std::string_view’ {aka ‘std::basic_string_view<char>’} to ‘const string&’ {aka ‘const std::__cxx11::basic_string<char>&’}
 1218 |       open(const std::string& __s,
      |            ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/fstream:1240:2: note: candidate: ‘template<class _Path> std::_If_fs_path<_Path, void> std::basic_fstream<_CharT, _Traits>::open(const _Path&, std::ios_base::openmode) [with _Path = _Path; _CharT = char; _Traits = std::char_traits<char>]’
 1240 |  open(const _Path& __s,
      |  ^~~~
/usr/include/c++/10/fstream:1240:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/fstream: In substitution of ‘template<class _Path> std::_If_fs_path<_Path, void, decltype (declval<_Path&>().make_preferred().filename())> std::basic_fstream<char>::open<_Path>(const _Path&, std::ios_base::openmode) [with _Path = std::basic_string_view<char>]’:
io.h:39:53:   required from here
/usr/include/c++/10/fstream:1240:2: error: ‘class std::basic_string_view<char>’ has no member named ‘make_preferred’
In file included from pocketpy.h:9,
                 from main.cpp:4:
io.h:41:54: error: no matching function for call to ‘std::basic_fstream<char>::open(std::string_view, std::_Ios_Openmode)’
   41 |             _fs.open(file.sv(), std::ios::out | extra);
      |                                                      ^
In file included from main.cpp:1:
/usr/include/c++/10/fstream:1177:7: note: candidate: ‘void std::basic_fstream<_CharT, _Traits>::open(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::ios_base::openmode]’
 1177 |       open(const char* __s,
      |       ^~~~
/usr/include/c++/10/fstream:1177:24: note:   no known conversion for argument 1 from ‘std::string_view’ {aka ‘std::basic_string_view<char>’} to ‘const char*’
 1177 |       open(const char* __s,
      |            ~~~~~~~~~~~~^~~
/usr/include/c++/10/fstream:1218:7: note: candidate: ‘void std::basic_fstream<_CharT, _Traits>::open(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::string = std::__cxx11::basic_string<char>; std::ios_base::openmode = std::ios_base::openmode]’
 1218 |       open(const std::string& __s,
      |       ^~~~
/usr/include/c++/10/fstream:1218:31: note:   no known conversion for argument 1 from ‘std::string_view’ {aka ‘std::basic_string_view<char>’} to ‘const string&’ {aka ‘const std::__cxx11::basic_string<char>&’}
 1218 |       open(const std::string& __s,
      |            ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/fstream:1240:2: note: candidate: ‘template<class _Path> std::_If_fs_path<_Path, void> std::basic_fstream<_CharT, _Traits>::open(const _Path&, std::ios_base::openmode) [with _Path = _Path; _CharT = char; _Traits = std::char_traits<char>]’
 1240 |  open(const _Path& __s,
      |  ^~~~
/usr/include/c++/10/fstream:1240:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/fstream: In substitution of ‘template<class _Path> std::_If_fs_path<_Path, void, decltype (declval<_Path&>().make_preferred().filename())> std::basic_fstream<char>::open<_Path>(const _Path&, std::ios_base::openmode) [with _Path = std::basic_string_view<char>]’:
io.h:41:54:   required from here
/usr/include/c++/10/fstream:1240:2: error: ‘class std::basic_string_view<char>’ has no member named ‘make_preferred’
In file included from pocketpy.h:9,
                 from main.cpp:4:
io.h:43:54: error: no matching function for call to ‘std::basic_fstream<char>::open(std::string_view, std::_Ios_Openmode)’
   43 |             _fs.open(file.sv(), std::ios::app | extra);
      |                                                      ^
In file included from main.cpp:1:
/usr/include/c++/10/fstream:1177:7: note: candidate: ‘void std::basic_fstream<_CharT, _Traits>::open(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::ios_base::openmode]’
 1177 |       open(const char* __s,
      |       ^~~~
/usr/include/c++/10/fstream:1177:24: note:   no known conversion for argument 1 from ‘std::string_view’ {aka ‘std::basic_string_view<char>’} to ‘const char*’
 1177 |       open(const char* __s,
      |            ~~~~~~~~~~~~^~~
/usr/include/c++/10/fstream:1218:7: note: candidate: ‘void std::basic_fstream<_CharT, _Traits>::open(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::string = std::__cxx11::basic_string<char>; std::ios_base::openmode = std::ios_base::openmode]’
 1218 |       open(const std::string& __s,
      |       ^~~~
/usr/include/c++/10/fstream:1218:31: note:   no known conversion for argument 1 from ‘std::string_view’ {aka ‘std::basic_string_view<char>’} to ‘const string&’ {aka ‘const std::__cxx11::basic_string<char>&’}
 1218 |       open(const std::string& __s,
      |            ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/fstream:1240:2: note: candidate: ‘template<class _Path> std::_If_fs_path<_Path, void> std::basic_fstream<_CharT, _Traits>::open(const _Path&, std::ios_base::openmode) [with _Path = _Path; _CharT = char; _Traits = std::char_traits<char>]’
 1240 |  open(const _Path& __s,
      |  ^~~~
/usr/include/c++/10/fstream:1240:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/fstream: In substitution of ‘template<class _Path> std::_If_fs_path<_Path, void, decltype (declval<_Path&>().make_preferred().filename())> std::basic_fstream<char>::open<_Path>(const _Path&, std::ios_base::openmode) [with _Path = std::basic_string_view<char>]’:
io.h:43:54:   required from here
/usr/include/c++/10/fstream:1240:2: error: ‘class std::basic_string_view<char>’ has no member named ‘make_preferred’

this is on a raspberry pi 4b, with gcc version 10.2.1

attempting to compile the main.cpp with the release pocketpy.h results in the same issue

TODO: impl `OP_LOAD_FAST`

The access of local variables is really fast in cpython via OP_LOAD_FAST.

We should implement it.

`__getattr__`

Will __getattr__ be available for overriding? Would this amount to binding the CPP method when classes are instantiated?

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.