An open API service indexing awesome lists of open source software.

https://github.com/asynched/yacc-lex-language

A simple language with an interpreter using yacc/lex.
https://github.com/asynched/yacc-lex-language

compiler language lex yacc

Last synced: 3 days ago
JSON representation

A simple language with an interpreter using yacc/lex.

Awesome Lists containing this project

README

          

# yacc-lex-language

A simple language with an interpreter using yacc/lex.

## Building

### Requirements

- GNU/Make
- GCC
- Bison
- Flex

### How to build?

To build the executable, run:

```sh
$ make build
```

> This will generate a `build/` directory with the executable `lang.o`.

## Running the interpreter

To run the interpreter, type in your terminal:

```sh
$ build/lang.o
```

This language only recognizes a few symbols and operations, such as add, subtract, print, etc.

- Adding

```
print 1 + 2;
```

- Subtracting

```
print 2 - 1;
```

- Multiplying

```
print 5 * 2;
```

- Dividing

```
print 10 / 2;
```

- Clearing the screen

```
clear;
```

- Assignment

```
a = 10 + 5;
```

- Exiting

```
exit;
```

## Sources

- [Language tutorial](https://www.youtube.com/watch?v=__-wUHG2rfM)
- [Github Repository](https://github.com/jengelsma/yacc-tutorial)