Code Monkey home page Code Monkey logo

tryc's Introduction

tryC - a small interpreter written by C

tryC is a very simple interpreter made by hand in C language, about 570 lines:

Use recursive descent method for grammatical analysis, do not explicitly build a grammar tree, generate intermediate code or target code; interpret and execute at the same time as grammatical analysis.

The try language implemented by tryC:

  • Dynamic types, supported data types: double-precision floating-point numbers, character types, strings, arrays of floating-point numbers;
  • Support the definition of functions and variables, recursive call of functions, nested scope;

tryC是一个用c语言手搓的非常简单的解释器,大约570行:

采用递归下降法进行语法分析,不显式构建语法树,不生成中间代码或目标代码,在语法分析的同时进行解释执行;

tryC实现的try语言:

  • 动态类型,支持的数据类型:双精度浮点数、字符型、字符串、浮点数数组
  • 支持函数和变量的定义、函数的递归调用、嵌套作用域

files:

source:tryC.c

example:test.try

build and run:

build:

gcc -o tryc tryC.c

usage:

tryc [-d] filename

documents in Chinese

用c语言手搓一个600行的类c语言解释器: 给编程初学者的解释器教程(1)- 目标和前言

用c语言手搓一个600行的类c语言解释器: 给编程初学者的解释器教程(2)- 简介和设计

用c语言手搓一个600行的类c语言解释器: 给编程初学者的解释器教程(3)- 词法分析

用c语言手搓一个600行的类c语言解释器: 给编程初学者的解释器教程(4)- 语法分析1:EBNF和递归下降文法

用c语言手搓一个600行的类c语言解释器: 给编程初学者的解释器教程(5)- 语法分析2: tryC的语法分析实现

用c语言手搓一个600行的类c语言解释器: 给编程初学者的解释器教程(6)- 语义分析:符号表和变量、函数

tryc's People

Contributors

yunwei37 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tryc's Issues

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.