Git Product home page Git Product logo

vork's Introduction

Vork

Vork will eventually be a fully fledged V implementation, including parser, compiler and interpreter (and maybe more will see how much time I will have)

Right now it is only the parser and interpreter, once I get the interpreter to have all/most of V's features I will move on to work on a compiler.

vlib

The vlib shipped with the compiler is mostly copied from the official vlib. main differences are that most of the implementation of the builtins moved to be part of the code gen.

for example while the official vlib has alot of the array functions be implemented in V, and the compiler will turn say [1,2,3,4] to a new_array_from_c_array, we don't do that, and leave the creation of the array to the implementation of the code gen.

this allows to easily have the interpreter without starting to have different builtin implementations in v itself (for example, currently the js code gen of v has different v builtin implementation)

Implemented

currently the program will generate a first AST using Earley parser (V is too ambiguous for a LALR). Then it will transform the Tree into bytecode like AST; which then we can either run directly in the interpreter or later on maybe do code gen with it.

  • All binary and unary expressions (postfix and prefix operators are missing currently)
  • Integers, Boolean and Float types
  • Arrays (can technically parse Ref and Opt but does not actually handle them)
  • Functions and function calling
  • Modules and imports
  • Structs and access modifiers
  • Methods
  • asserts
  • if\else\if else and most of the for loops
  • variable declaration and assignment (and op assignment +=) with mutability checking
  • consts
  • Interop functions (the interpreter handles what to do for each interop function)

TODO

kinda in the order I wanna work on stuff and kinda not

  • ranged for loops (0..x)
  • enums
  • optionals
  • strings
  • maps
  • go statement
  • match
  • expression if
  • references/pointers/whatever
  • figure postfix and prefix ++/--
  • interfaces
  • attributes
  • fix embedded structs
  • operator overloading
  • generics
  • compile time if

vork's People

Contributors

chaoscat avatar itay2805 avatar

Watchers

 avatar

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.