Giter Site home page Giter Site logo

mathvm's Introduction

                Introduction.

  This folder contains partial source code for a simple VM, with few
 intentionally missing pieces. This VM implements simple language
 (MVM language) with basic computational functionality and flow control.

                MVM language.

   Language has simple C-style syntax and is intentionally rather
 basic. Language has 3 types: 
     - 64-bit integer type, called 'int'
     - ANSI C compatible double type, called 'double'
     - immutable strings (C equivalent: const char*), called 'string'

  Every variable is scoped, scope is marked with curly braces ({ and }).
 Variable has to be declared before first use, otherwise translation
 error will happen.

  Values in variable could be modified with traditional C-style
 expressions, like x = 2+y*3; with traditional C-style operators
 precedence, i.e. aforementioned expression is evaluated as 
  x= (2+(y*3));

  Variables in topmost scope could be bound to 'Var' class
 instances, to allow interoperability between MVM programs and C++. 

 Literals can be:
   - integer, such as 42 or 123456789012345
   - double, such as 42.0 or 1e-18
   - string, such as '42' or 'Hello \'World\'\n'

 Flow control is as following:
    - 'for' loop, with semantics:
         for (i in -10..x) { print('i=', i,    '\n'); }
    - 'if' conditions, such as
         if (x == 8 && y <= 2) { 
             print('c1\n'); 
         } else {
             print('c2\n'); 
         }

               Implementation.

   We provide generic source -> AST (abstract syntax tree)
 translator, so that implementors can focus on VM-specific issues.
 It means we give scanner and top-down parser, generating tree
 of AST nodes, representing program structure.
 It is up to implementors to provide remaining pieces for fully
 functional VM.

                Tests.

  Directory 'tests' contains set of tests on basic language features,
 along with test scripts taskN.py. Generally, for every MVM program 
 we have an .expect file, which contains expected result of execution
 for given MVM program.

                Source tree layout.

  Folder 'include' contains generic declarations of language constructs
 (as AST nodes), set of bytecodes with description, and certain basic
 interfaces.

  Folder 'tests' contains MVM tests. Feel free to implement your own tests.

  Folder 'vm' contain source code for the VM.

                Building.

  Build shall be pretty straightforward, just type 'make' in command
 line (known to work with MacOS and Linux). Use 'make OPT=1' for an optimized
 build. NO_JIT variables controls if JIT dependencies shall be compiled in.
  Create your own implementation in students/<year>/<your last name> folder,
using Makefile.student template.

mathvm's People

Contributors

the7winds avatar yorovsobir avatar ldvsoft avatar equivalence1 avatar demiurg906 avatar wtf42 avatar cripson1994 avatar dkhalansky avatar bibaev avatar alejes avatar esengie avatar airvan21 avatar simiyutin avatar wimag avatar e5l avatar dorooleg avatar isilence avatar lizatretyakova avatar aspirisha avatar antongitname avatar alexvangogen avatar baydindima avatar rauf-kurbanov avatar golovanovsrg avatar edgarzhavoronkov avatar svloyso avatar dsavvinov avatar fbocharov avatar kravtsun avatar angelikamukhina 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.