Skip to content

chyyuu/compiler_lab

Repository files navigation

compiler_lab

All programs have been tested on ubuntu 17.04 64 bit, and some programs have been tested on windows 10 64bit.

lex & yacc

  1. count line num using lex&clang
  2. upper chars using lex&clang
  3. calculator using lex&yacc&clang
  4. calculator using jlex&cup&java
  5. calculator using ply&python
  6. some simple examples using ply&python
  7. calculator using rust
  8. lexers using rust/nom
  9. Solving LL(1) First/Follow/PS Sets

some automaton, turing machine codes

For understanding some concepts and internals of "Formal Languages and Automata"

automaton

From https://github.com/cforth/toys/tree/master/Automaton

书籍《计算的本质:深入剖析程序和计算机》中第三章以及第四章的自动机实现。

  1. section 3.1 确定性有限自动机(Deterministic Finite Automaton,DFA)
  2. section 3.2 非确定性有限自动机(Nondeterministic Finite Automata,NFA)
  3. section 3.3 正则表达式的实现
  4. section 3.4 NFA与DFA的等价性
  5. section 4.1 确定性下推自动机(Deterministic PushDown Automaton,DPDA)
  6. section 4.2 非确定性下推自动机(Nondeterministic Pushdown Automaton,NPDA)
  7. section 4.3.1 词法分析(Lexical Analyzer)
  8. section 4.3.2 语法分析(Grammar Analyzer)
  9. minimised DFA from DFA from NFA from Regular_Expression

automata in rust

  1. show nfa/dfa

turing machine

From https://github.com/cforth/toys/tree/master/Turing

《计算的本质:深入剖析程序和计算机》中第五章的图灵机实现。

  1. section 5.1 确定型图灵机(Deterministic Turing Machine,DTM)

compiler, interpreter, simulator

  1. Very basic IDE and vizualization/simulation of Mini-C compiler using kotlin
  2. BASIC language & interpreter using ply &python
  3. simple stack machine using python

little toy in rust

  1. interpreter in rust
  2. compiler in rust