Skip to content
This repository has been archived by the owner on Sep 22, 2020. It is now read-only.
/ PCAT-compiler Public archive

A simple compiler for PCAT programming language

Notifications You must be signed in to change notification settings

parachvte/PCAT-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 

Repository files navigation

PCAT Compiler

PCAT - Pascal Cloned with an ATtitude

something about PCAT:

  1. PCAT uses Standard ASCII character set, and case sensitive.
  2. Comments are enclosed in pairs of (* and *), not nested.
  3. Support nested functions.
  4. Support interger, real, record values with implicit pointers, arrays and a few simple structured control constructs.

More details see The PCAT Programming Language Reference Manual.

Tools

  • g++ 4.6.3

    For ubuntu, run sudo aptitude install build-essential to install it.

  • Lex - GNU Flex: The Fast Lexical analyzer

    Flex home page

  • Yacc - GNU Bison

HOW TO

Just run make to build our program.

Part.1 Lexer

Main goal:

  • Recognize token in the PCAT program, including reserved words, operators, identifiers, comments.

  • for every token, list out its internal repressentation, value, line number & column number.

  • Besides, if there are some errors, print it out, with line number & column number.

  • For errors, try you best to ignore it and go on.

Part.2 Parser

  • Parsing the tokens recognized from Lexer (with Bison)

  • Make a Abstract Semantic Tree (AST)

  • Code style correct based on AST

  • Type checking based on AST

  • Code generation

About

A simple compiler for PCAT programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published