dorooleg / mathvm Goto Github PK
View Code? Open in Web Editor NEWThis project forked from olonho/mathvm
Educational virtual machine
This project forked from olonho/mathvm
Educational virtual machine
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, 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 driver 'run.py'. Generally, for every MVM program we have an .expect file, which contains expected result of execution for given MVM program. By default, 'run.py' will run all tests it knows about. 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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.