Skip to content

petrubraha-prototypes/YP-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

129 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

YP compiler

A custom compiler that reads, parses, and executes source code written in a specialized C-like syntax, utilizing Flex for text recognition. Test-driven development principles were considered in this project.

contributors last update forks stars open issues license

Usage

  • for improved redability, we recommand VS Code and the "Better Comments" extension
  • commands to be passed in project root terminal:
  1. "./setup.sh" - checks for bison and flex installation and builds our compiler
  2. "./build.sh" - builds the custom compiler
  3. "./src/discard.sh" - delete the additional files
  4. "./run.out <file_path>" - compiles and runs the source code

Technologies

  1. C++
  2. Flex
  3. Yacc/Bison

Features

  • All variables/parameters/objects have:

    • explicit value(s)
    • implicit value(s) if there is no given definiton
      • e. g. 0, 0.0, '0', "", true
    • no container will ever be "undefined"
  • x-dimensional arrays, where x could be any natural value not NULL. the same is assured for the size of each dimension.

  • Each file from examples directory is responsable of one grammar rule.

  • See implementation details for more.

  • Default parameters for functions

Limitations

  • No type qualifiers
  • No pointers, refferences
  • No struct, union
  • No inheritence of classes