diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-07-26 23:17:36 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-07-26 23:17:36 +0200 |
| commit | 264ae2f047a53ffac92271e4609038d17605738e (patch) | |
| tree | 480c68814f822439850029df0e0249a2cafb8177 /exam_final/subjects/12-0-brainfuck/subject.en.txt | |
| parent | ad9867052d496f2c2a7f120a512208fb4dd4e787 (diff) | |
| download | piscine-264ae2f047a53ffac92271e4609038d17605738e.tar.gz piscine-264ae2f047a53ffac92271e4609038d17605738e.tar.bz2 piscine-264ae2f047a53ffac92271e4609038d17605738e.zip | |
exam final
Diffstat (limited to 'exam_final/subjects/12-0-brainfuck/subject.en.txt')
| -rw-r--r-- | exam_final/subjects/12-0-brainfuck/subject.en.txt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/exam_final/subjects/12-0-brainfuck/subject.en.txt b/exam_final/subjects/12-0-brainfuck/subject.en.txt new file mode 100644 index 0000000..a926e71 --- /dev/null +++ b/exam_final/subjects/12-0-brainfuck/subject.en.txt @@ -0,0 +1,32 @@ +Assignment name : brainfuck +Expected files : *.c, *.h +Allowed functions: write, malloc, free +-------------------------------------------------------------------------------- + +Write a Brainfuck interpreter program. +The source code will be given as first parameter. +The code will always be valid, with no more than 4096 operations. +Brainfuck is a minimalist language. It consists of an array of bytes +(in our case, let's say 2048 bytes) initialized to zero, +and a pointer to its first byte. + +Every operator consists of a single character : +- '>' increment the pointer ; +- '<' decrement the pointer ; +- '+' increment the pointed byte ; +- '-' decrement the pointed byte ; +- '.' print the pointed byte on standard output ; +- '[' go to the matching ']' if the pointed byte is 0 (while start) ; +- ']' go to the matching '[' if the pointed byte is not 0 (while end). + +Any other character is a comment. + +Examples: + +$>./brainfuck "++++++++++[>+++++++>++++++++++>+++>+<<<<-] +>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." | cat -e +Hello World!$ +$>./brainfuck "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>." | cat -e +Hi$ +$>./brainfuck | cat -e +$ |
