Code Monkey home page Code Monkey logo

Comments (14)

Yuhanun avatar Yuhanun commented on June 26, 2024

I'm aware that you should use

veronac main.verona --output a.out

And then use the interpreter to interpret the bytecode, but still :)

However, Inference is failing for method main() aswel,

 ~  veronac main.ver 
main.ver:2:5: error: Inference failed for method main
    main() { 
    ^~~~~~~~
1 error generated

 ✘  ~  cat main.ver 
class Main {
    main() { 
        Builtin.print1("Hello World!"); 
    }
}

from verona.

mjp41 avatar mjp41 commented on June 26, 2024

The interpreter runs on bytecode produced by the compiler:

veronac main.verona --output main.bc
interpreter main.bc

You are trying to interpet the source as bytecode. We haven't put checks in for that yet.

Your program should be

Builtin.print("Hello World!"); 

as there are no arguments other than the format.

from verona.

Yuhanun avatar Yuhanun commented on June 26, 2024

Ah okay, thank you :)

General question, I'd like to contribute to the project, is this possible or is this meant to be more of a "microsoft employee"-only thing?

from verona.

mjp41 avatar mjp41 commented on June 26, 2024

We are definitely keen to build a community and it is definitely not a Microsoft employee project: @plietar has the largest changes since we open sourced and is a student at Imperial College London.

But at this stage it we don't have many issues that are easy to give to new people. As the project grows, I hope that will change, and we will flag issues as good for new people.

Thanks for your interest.

from verona.

Yuhanun avatar Yuhanun commented on June 26, 2024

Alright, thank you very much!

from verona.

plietar avatar plietar commented on June 26, 2024

We should add some magic number at the start of the bytecode, and give a nice error message if it isn't found.

from verona.

Yuhanun avatar Yuhanun commented on June 26, 2024

We should add some magic number at the start of the bytecode, and give a nice error message if it isn't found.

I'm fairly confident that's how python identifies versions in their bytecode (pyc) files, it starts with some magic number that indicates the version.

from verona.

mjp41 avatar mjp41 commented on June 26, 2024

@Yuhanun If you want to get involved adding that to the bytecode format would be a useful feature.

from verona.

orcmid avatar orcmid commented on June 26, 2024

You might want to look into some representation of a prefix and elements that also allow for verification of the integrity of a pyc file, with the prospect of a digital signature. You want to know it is likely a pyc and also the version, I suspect. Might want to look into known magic-number schemes and avoid collisions too.

It doesn't have to happen immediately, but it is useful to anticipate it. On the edge of research use, but don't want it to be disruptive if not anticipated?

from verona.

Yuhanun avatar Yuhanun commented on June 26, 2024

Could I get some feedback on this:
https://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html

I was thinking:

4 bytes of verona specific magic number
12 bytes of verona version (MAJOR.MINOR.BUILD)
-- rest of bytecode.

Would you also like there to be a 64 bit timestamp (future-proof 8 byte instead of 4, 2037 isn't that far away 👀 )

from verona.

mjp41 avatar mjp41 commented on June 26, 2024

So we don't expect to support the interpreter long-term. Once we have built the native codegen, the interpreter is only expected to be used for compile-time evaluation.

Personally, I would like to just use a magic number at the start of the file to catch incorrect use of what we have. If we decide we actually want a versioned bytecode in the future, we just pick a new magic number.

64bit magic number would make sense to me.

@davidchisnall , @sylvanc thoughts?

from verona.

Yuhanun avatar Yuhanun commented on June 26, 2024

Oh, so the plan is to go to a native language? I thought this was going to be bytecode, but damn i would way prefer native.

Okay, so basically double the size of the magic number and then only validate that + remove the version numbers?

from verona.

davidchisnall avatar davidchisnall commented on June 26, 2024

The goal is to generate native code. I think a 64-bit magic number is fine for now. For anything that we actually intend to support longer term, we need to think about upstreaming libmagic support as well, but I don't think we should for the current bytecode.

from verona.

mjp41 avatar mjp41 commented on June 26, 2024

#81 closes this.

from verona.

Related Issues (20)

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.