* * *

Author Topic: PicPas, Pascal compiler for Microchip PIC  (Read 736 times)

Edson

  • Hero Member
  • *****
  • Posts: 695
PicPas, Pascal compiler for Microchip PIC
« on: April 21, 2017, 06:08:39 am »
PicPas 0.5.1 is my new compiler for Microchip small devices (16F PIC microcontrollers)  :D.

https://github.com/t-edson/PicPas

By the moment, there are only limited functionalities. Only the bit, byte and boolean types are supported, and a few operators are implemented.  :-[

A small IDE is included with the compiler.
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

avra

  • Hero Member
  • *****
  • Posts: 867
    • Additional info
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #1 on: April 21, 2017, 08:30:00 am »
PicPas 0.5.1 is my new compiler for Microchip small devices (16F PIC microcontrollers)  :D.
Congratulations!

As I see this is just a beginning... You have a lot of work in front of you.
ct2laz - Easily convert components and projects between Lazarus and CodeTyphon

tr_escape

  • Full Member
  • ***
  • Posts: 243
  • sector name toys
    • Github:
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #2 on: April 21, 2017, 09:42:07 am »
It is very nice project maybe you want to look at that project too:

https://github.com/jallib/jallib

I used once for a project but I think it is not full open source project.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 560
    • Burdjia
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #3 on: April 21, 2017, 10:59:15 am »
Cool project.

I'm working on my very own compiler for the Z80 microprocessor, but I didn't tell anything because it only extracts tokens telling what they are, no code generated yet.

I've briefly look at your code and I must to say that it was ingenious to use SynEdit parser.  I'll write it my own.
« Last Edit: April 21, 2017, 11:05:50 am by Ñuño_Martínez »

Edson

  • Hero Member
  • *****
  • Posts: 695
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #4 on: April 21, 2017, 06:01:18 pm »
Congratulations!
As I see this is just a beginning... You have a lot of work in front of you.

Thanks.
Yes. There is a lot of work in front, and there is a lot of word done: Several libraries, frameworks, design and docs. The design is very important for this kind of projects.

I will be publishing my advances.

It is very nice project maybe you want to look at that project too:
https://github.com/jallib/jallib
I have seen something about the JAL project. There were some things I didn't like of JAL. I will check again.

« Last Edit: April 21, 2017, 06:03:27 pm by Edson »
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

majid.ebru

  • Jr. Member
  • **
  • Posts: 98
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #5 on: April 21, 2017, 07:25:40 pm »
Congratulations ;D ;D

Edson

  • Hero Member
  • *****
  • Posts: 695
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #6 on: April 22, 2017, 03:20:12 am »
Congratulations ;D ;D

Thanks. It's really hard to make a functional compiler, especially for a limited architecture like this.

I'm working on my very own compiler for the Z80 microprocessor, but I didn't tell anything because it only extracts tokens telling what they are, no code generated yet.

Good. Z80 is one of my favourites CPU. Although I have worked a lot with the 6502 CPU, in the Commodore 64. I remember, I wrote a very simple, and low level compiler in BASIC, for this CPU. Some routines of this compiler were "compiled" by the same compiler.  %) Sadly, the code has gone with my audio-tapes.  :'( Maybe I can rewrite this, in FPC.

I've briefly look at your code and I must to say that it was ingenious to use SynEdit parser.  I'll write it my own.
Maybe, you can use the lexer of PicPas, and some of its libraries, like T-Xpres (https://github.com/t-edson/t-Xpres) and SynFacilSyn. The code generator is some very complex module, and T-Xpres helps a lot on this case.

This project, really reuse the code, because the same lexer is used for the editor higjlighter and for the completion tool, too.

Tell me if you need some help on your compiler.
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Cyrax

  • Sr. Member
  • ****
  • Posts: 490
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #7 on: April 22, 2017, 03:24:03 am »
Cool project.

I'm working on my very own compiler for the Z80 microprocessor, but I didn't tell anything because it only extracts tokens telling what they are, no code generated yet.

I've briefly look at your code and I must to say that it was ingenious to use SynEdit parser.  I'll write it my own.

There is experimental FPC branch for z80 here : http://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/z80/?sortby=date&view=log

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 560
    • Burdjia
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #8 on: April 22, 2017, 02:00:37 pm »
Good. Z80 is one of my favourites CPU. Although I have worked a lot with the 6502 CPU, in the Commodore 64. I remember, I wrote a very simple, and low level compiler in BASIC, for this CPU. Some routines of this compiler were "compiled" by the same compiler.  %) Sadly, the code has gone with my audio-tapes.  :'( Maybe I can rewrite this, in FPC.

Maybe, you can use the lexer of PicPas, and some of its libraries, like T-Xpres (https://github.com/t-edson/t-Xpres) and SynFacilSyn. The code generator is some very complex module, and T-Xpres helps a lot on this case.

This project, really reuse the code, because the same lexer is used for the editor higjlighter and for the completion tool, too.

Tell me if you need some help on your compiler.
Thanks for the advices.  I'll work on it.

A C64 compiler would be nice too...

There is experimental FPC branch for z80 here : http://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/z80/?sortby=date&view=log
:o

molly

  • Hero Member
  • *****
  • Posts: 1479
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #9 on: April 22, 2017, 02:14:03 pm »
Cyrax was a bit faster about the z80 branch :)

A C64 compiler would be nice too...
Plenty of them in the wild.
- Ruud's commodore site
- G-Pascal by nick gammon
- Others

Do realize that because of the available space (or lack thereof) most of those compilers made heavy use of macro's.
« Last Edit: April 22, 2017, 02:17:26 pm by molly »

Edson

  • Hero Member
  • *****
  • Posts: 695
Re: PicPas, Pascal compiler for Microchip PIC
« Reply #10 on: April 22, 2017, 09:26:53 pm »
It would be nice for me, to do compilers for Z80 or 6502 (especially this), but there are, currently, many compilers developed.  Maybe it would be some experimental.

What I see is, the only 8 bits devices, widely used now, are the microcontrollers. And the 8 bits PICs are very used in this part of the world. This is one motivation on doing my compiler.
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus