Skip to content

It's like Typescript, but converts Pascal a C. (Challenge)

License

Notifications You must be signed in to change notification settings

danirod-live/pascal2c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pascal2c is at the moment an Pascal AST interpreter currently in
development. The name is misleading because it may give the
impression that it converts Pascal code to C code, and this is the
intention, but at the moment I'll only work in the AST library
to decode and understand Pascal code, and maybe later I'll work in
a tool that spits the equivalent C code.

How to compile this
===================

Install CMake. Then:

		cmake -B build
		make -C build


What can I do with this?
========================

Currently nothing. Come back when the parser is able to generate
a tree for an entire Pascal source code file.


Work in progress
================

Current tasks (non-finite list):

- [x] Write a scanner that can convert an input into Pascal tokens
- [!] Write a parser that converts Pascal tokens into the expressions
- [ ] ??????

An interesting thing to test later is that the expression parser is
properly written by checking if I can convert back every expression into
the equivalent Pascal code.

Parts of the compiler grammar that are implemented:

- [x] Identifier
- [x] Variable
- [x] Unsigned number
- [x] Expression
- [x] Simple expression
- [x] Term
- [x] Factor
- [x] Unsigned constant
- [x] Parameter list
- [x] Unsigned integer
- [x] Constant
- [x] Simple type
- [x] Field list
- [x] Type
- [x] Statement
- [x] Block
- [x] Program


Bugs:

* The scanner should accept length metadata when printing variables, such as value:5:2.
  TODO: Where the f**k is this documented in FPC so that I can see how they implement this on their AST.

About

It's like Typescript, but converts Pascal a C. (Challenge)

Resources

License

Stars

Watchers

Forks

Languages