Coder Social home page Coder Social logo

guntermueller / vsl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from perlawk/vsl

1.0 0.0 0.0 288 KB

the source code of the book Introduction to compiling techniques, J.P. Bennett

C 81.88% Makefile 2.24% Yacc 12.91% Groff 2.09% Shell 0.88%

vsl's Introduction

This is my n times to learn the compiler techniques. Lex and yacc are very good for the beginner to study the primary skills of writing a compiler even a toy one.

This book is a pre-runner of the time. Even today it's very fasional. A small book contains both lexing, parsing, code generation, assembler, byte code generation, virtual machine. Especially the virtual machine is the hot topic in the internet of the programming geeks. Nearly every newly invented languages have their own virual machine.

The original codes is mixed with dos and unix. And it doesn't initially work when compile the code. So the bug fixing started. Luckily, it took me less than few days to find the problem and fixed them all. Any further problem in compiling is welcome to discuss.

Since I don't use window$ product more than 20 years. So any question about the dos part is ignored.

Changes of the original codes: Some syntax erros when run the program because of the header and lib is dos oriented, the evil '\r' is the source. I removed them all. To prevent this from loading a source code of vsl, vas is generated from a dos/window$ systems, I change the scanner.l, parser.y and vas.y and let the '\r' as part of the '\n'. It only true in Linux system, other unix system like OSX may be problem. Please be careful!.

A minimal vsl and hell.vsl is added to the sample directory. The author's minimal vsl is

FUNC main() { CONTINUE }

but I found the braces are unecessary, so:

FUNC main() CONTINUE

is enough. Of course, the author's minimal program is more clear. It's up to you.

A vsl compiling script is added to the code directory. After compile the compiler, assembler and vam. Just run:

./vsl ../sample/hello.vsl

In the vc.h, change the value of LIB_DIR to any location you want and place the lib and header file there and recompile the vc. The new compiler will search the lib and header there.

The disasm is compiled for your convenient.

Enjoy the study of this great book.

vsl's People

Stargazers

Fidel H Viegas avatar

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.