Tuesday 9 August 2016

My Experiment with Compiler Writing. Part-1

Introduction

Well, I have written a small OS kernel(NanoOS) earlier(2008-2010). It was written in C++ and assembly language for Self learning as well as for Fellow colleagues at Redhat, Pune. But never tried a compiler or interpreter, as it was never needed for my Job.

The need

Recently for a small project I had to write a small parser. It is not a language parser though.  It was written for a parsing a logfile of an application. Even it was designed to detect wrong sequence in that application. Well forget about the application. After that project is complete I thought to write a small Interpreter or Compiler for a very small language. As a first thought It came to me that I should write a Compiler for BASIC(Beginners' All purpose Symbolic Instruction Code) but implementing a full blown BASIC compiler is a big task for me(I sincerely believe I am not that intelligent to write a full blown compiler single handedly). So in my so-called Compiler a very very small subset of BASIC language will be implemented, as it was meant for self training and example for who ever wants to study this subject practically.

My approach

I prefer practical way to learn. So i will try to lay down fragments of code in sequence. So that any one can follow and understand.
  1. We will be using C or C++ 
  2. We will start with a very basic tokenizer
  3. Modify the code to have a parser
  4. Code generator.
Why I choose C or C++ is, I write code more easily in these 2 languages. Any other language can be used. Even BASIC can be used to write a BASIC compiler.
But it needs through understanding of the language.

I deliberately avoided Gramars and all those Compiler jargon. If those things are needed then please pickup a Compiler writing book and read. If you have read such a book then you may find this article informative on implementation.

Keep in mind "This is not a tutorial for Compiler construction courses" or class assignment. Secondly Please Don't Expect it to be of any practical use. This is just for my personal pleasure and to share my pleasure with others.

In next instalment I will start with lexing/parsing code.

Thanks
DE VU3VFU

Saturday 6 August 2016

A 30 years Dream

Today I got my HAM license. My call sign is VU3VFU( Viktor Uniform number 3 Viktor Foxtrot Uniform).

It was 1986 june. My Matric Exam(10th Board exam) was over. So no study pressure no mathematics no algebra no geometry no trigonometry... Initially it was enjoying but after 2 weeks it was horribly boring. While I was roaming in the market I saw EFY(Electronics For You). Got tempted and bought it. Those days it was costing Rs.5/- yes Five Rupees. I found it interesting but somany topics are over my head ( You know What I mean Hi Hi Hi).
In that issue they have published about HAM radio. when I read it I was thrilled. Can I really keep a Transmitter at home??? intrigued me.

I read that article repeatedly and convinced yes it is possible to have transmitters at home. Next is gathering information. Those days there were no internet, no mobile phone nothing. So ultimate part is going to electronics department and asking them. But I never find any answer from them.

Fortunately there was a Marine Radio Communication training institute in my college (Ravenshaw college).I  approached the chief instructor Mr.Choudhury. He gave me a good and convincing answer. I collected monitoring station's address in Gopalpur,Sarkarpul, Chabis praganas,WB. Wrote mail but they never gave inspiring or detailed procedure. Next my research found "ABC of Amateur Radio". I read that from begin to end.

Then time flew by and I joined Engineering college(UCE Burla.) in Civil Engineering. My interest gone dormant. But some fine day my younger brother(now K14DDY) informed me there are few hams at Sambalpur. I tried to meet them but unfortunately i could not. Then Course work pressure, then after completion JOB hunt from during 1993... I could not look towards HAM radio.

Then comes 2011. I came back to Odisha and Got to know about VU3PLP( now VU2FRD) called him up and his assurance kindled new hope in me and gradually we formed an association ARSO(Amateur Radio Society Odisha). Arranged Exam and Now we have 18 more HAMs in odisha...

This is my story it may not inpire you or not interest you, but I felt I should share this 30years of wait.
Any ways please share your story and comments.

Thanks 
de VU3VFU.

Saturday 5 March 2016

My Experience with GP-5/SSB

Countycomm's GP-5/SSB is the prime radio for me now. Earlier I used RTL SDR and Kchibo.

Kchibo is not for HAM use. It is suitable for Broadcast(MW/SW/FM) listening. Where as RTL SDR is good for 5MHz to 1.7 GHz. I used it for BC,HAM band in 40m and 2m reception. 20m reception using modified driver under linux was not possible( I don't know Windows performance though).

After I got this GP-5/SSB receiver, my evening time pass is to listen to HAM QSOs on 20m mostly and sometimes on 40m too. This radio is a cute radio as you might have seen from my previous write-up or elsewhere. My friends here are envious about its performance and size.
With this GP-5 SSB I have received stations as far as Australia, Siberia, Srilanka, Oman and my latest reception of Netherlands (PD9Z). So also i have received local (VU) stations from Mangalore,Bangalore, Chennai, Vishaka Pattanam, Kolkata, Berhampore(Murshidabad), Patna, Nagpur, Kolhapur, Ahmedabad, Sambalpur, Bhubaneswar, Bramhapur and Delhi.

QRP and homebrew stations VU3JOJ from Murshidabad, VU3PLP from Bhubaneswar are my regular favourite.
QRO stations such as VU2DPI, VU2YK and VU2KD are received like broad cast station clarity.

To emphasize the sensitivity of this receiver, i can say I have received a portable mobile HF station(VK6HCF) from VK land.

Power consumption is higher ( As i observed). In the beginning  I used AA alkaline cells made by Panasonic India (Golden colour). Those cells are drained out in 3 to 4 days if I use for 2 hours in the evening and one hour in the morning. To eliminate the battery issue i started using 2100mAh NIMH cells. The same thing happened as I have to recharge the cells every 3 to 4 days. I consulted the manual. There it says "if NIMH cells are used then the set must be set for NIMH cells". I changed the setting to my surprise after even 7 days cells are showing full power and there is no issues.

Bottom line:
Cute small Radio for radio lovers.
 

Wednesday 6 January 2016

CountyComm GP-5/SSB receiver.

Yesterday I received a GP-5/SSB receiver from CountyComm with some other goodies as a prize for "Virtual Radio Challenge IV" at Swling.com. After a long time I am receiving a prize.. Hi Hi Hi...

This radio is not for those who listens music on FM bands. It is for the Radio Fans and Radio Enthusiasts. Besides normal AM and FM demodulation it has SSB capability too.

Tuning range 550KHz -1710KHz can be changed to 150KHz-1620KHz
SW tuning is 1711KHz to 29999KHz continuous. This is a bit problem as one has
to rotate the wheel ... But to ease these there is preset BC bands and HAM bands too. Simultaneously there is scanning feature and Manual Memory feature for station surfing. 
FM tuning 76MHz-108MHz or 87MHz-108MHz

FM audio quality is very good
AM audio quality is very good
SW audio is good but noise (though SW bands are noisy except night time)
SSB is good One has to change BFO shift for clarity and lesser noise.

Overall it is a Good to have radio.

Neural Network from Scratch Using C (Part-3)

  XOR Problem In part 2, AND gate and OR gate could be trained using a single perceptron. But XOR gate could not be as it is not linearly...