Hello All,
I have moved my blog to my website so I can be more free using Word Press.
All the posts will stay here, and I have duplicated them there.
Thanks and Happy Holidays
Hello All,
I have moved my blog to my website so I can be more free using Word Press.
All the posts will stay here, and I have duplicated them there.
Thanks and Happy Holidays
I use Python everyday, it has become my first tool to use when I need to do anything. In Arabic (in Shami Arabic specifically) I’d say that Python has become my hand and leg
Yesterday I was writing a small Python script to read the YACC file and generate a list of all the specified rules inside it, so I don’t have to scroll through the long file to find out what rules are inside it
I use Notepad++ as my default text editor on Windows, and I was writing the script using it – Notepad++. I wanted to test if the script is working, so I ran an instance of Command Line Prompt, and as I was going to change the directory to the directory of the script I thought; “Why doesn’t Notepad++ have a Run In Python command in it?”. So as usual I got pissed off and decided to create my own plugin to have that command in Notepad++ ![]()
(more…)
Brainfuck is a programming language
This is the definition from Wikipedia:
The brainfuck programming language is an esoteric programming language noted for its extreme minimalism. It is a Turing tarpit, designed to challenge and amuse programmers, and is not suitable for practical use. Its name has been variously bowdlerized. The name of the language is generally not capitalized, although it is a proper noun.
This programming language is very easy to learn, very hard to do work with. As the Wikipedia article describes it; the language is an esoteric language, which means it was created for fun 
I discovered the language while I was reading an article about writing the perfect settings file for Django. The author used DPaste website to link to pieces of code. DPaste website says that it uses Pygments for syntax highlighting. Pygments say that their syntax highlighter even supports brainfuck. And that’s how I got to brainfuck 
After I read articles about the language I wanted to test some code of it, I found some online interpreters, but I wanted to test some code on my machine. I found a compiler for it, but I’m using Windows 7 on my machine and the compiler is not compatible with it. I got pissed off and I decided I have to write my own interpreter 
In my faculty – Informatics Engineering, Damascus University -, in the 4th year of Software Engineering Department, we have to build a compiler
.
I like using NetBeans for developing applications, it supports lots of languages and tools; like C, C++, Java, Python, Ruby and more. The compiler would be implemented in C++.
The first two phases of implementing a compiler are: building a lexer (tokenizer) and building a parser. The lexer is implemented using GNU Flex while the parser is implemented using GNU Bison.
The first problem I faced when starting the project was to tell NetBeans how to handle the lex file:
The lex file must be passed to the flex tool to generate a C++ code file.
The second problem was that when the code file is generated it contains errors:
#ifdef __cplusplus #include <stdlib.h> class istream; #include <unistd.h>
When using building the file you’ll find that it contains errors regarding the usage of istream. (You might not face this problem, then you’re a lucky programmer).
(more…)