Merdog is a mini C-Like interpreter
- basic types int, real, string, bool,char
- allocate heap objects by key word new based on the std::shared_ptr
- basic control statement if / else / elif / while / do while / for / switch
- support the declaration and defination of a function
- support defining struct, and member function
- support array and vector, deque, map,set
- some basic and useful functions
using vector;
function int sum (int x, int y)
{
return x+y;
}
program main
{
// create 2 ints and init with 0
vector<int> vec(2,0);
vec[0]=std.input_int();
vec[1]=std.input_int();
// it can be replaced by operator +
std.cout(sum(vec[0],vec[1]));
}
-
(passed by) Compilers:
- Windows: Clang 9.0.0 and Visual Studio 2019
- Linux: GCC 6.3.1
-
Website: www.merdog.cn
-
Email huyuantao@outlook.com
-
inspired by:
- Compilers: Principle Techniques and Tools Second Edition
- How to Build an interpreter
Copyright (c) HttoHu. All rights reserved.
Licensed under the MIT license.