项目作者: BaseMax

项目描述 :
A tiny calculator project with lexer/parser based on Flex, Bison with pure c programming language.
高级语言: Yacc
项目地址: git://github.com/BaseMax/calculator-flex-bison-c.git
创建时间: 2021-03-25T16:16:52Z
项目社区:https://github.com/BaseMax/calculator-flex-bison-c

开源协议:MIT License

下载


calculator-flex-bison-c

A tiny calculator project with lexer/parser based on Flex, Bison with pure c programming language.

Syntax

  1. print 5;
  2. print 100+10;
  3. a = 50;
  4. print a;
  5. print a+a;
  6. print a+100;

Compile

Easily run bash build.sh.

or do manually:

  1. $ flex myscanner.l
  2. $ yacc -d parser.y
  3. $ gcc y.tab.c lex.yy.c
  4. or
  5. $ cc y.tab.c lex.yy.c

Using

run ./a.out and type print 10; or etc…

Or Run parser and get contents from input.in file via linux/unix command:

  1. $ ./a.out < input.in
  2. Print 5
  3. Print 110
  4. Print 50
  5. Print 100
  6. Print 150

Feel free to participate and develop.

Similar repositories

Acknowledgment

I saw an lecture from Prof. Jonathan Engelsma and It’s encouraged me to do this project myself.

© Copyright Max Base