Skip to content

PDL Framework

Cooper edited this page May 2, 2023 · 4 revisions

This wiki page contains information about the syntax, keywords, types and comments in Python Data Library.

Keywords

class: The class keyword is used before the name parameter to create a new class object the name is then follwed by brackets and a semi-colon to declare the end of the class, syntax showed below.'

class food {
  // This is a class
};

priv: This keyword is used for declaring a variable exculsive to the .pdl file, therefore the parser will skip it when extracting data.

priv name = 'Cade'

new: The new keyword creates a new copy of an existing variable as as a string, you can use new to create handles for variables you cannot normally change.

class food {
  str name_handle = new name
};

Types

Tip: There is only one string the superior single-quoted string.

str: Declares a variable as string type.
int: Declares variable as integer type.
lst: Declares said variable as array.
bol: Declares the variable as boolean.
raw: Declares a variable as a raw string.
flt: Declares a variable as floating-point.

Example

class test {
  str car = 'new bugatti'
  int number = 10
  lst names = ['Leon', 'Ava', 'Muhammad']
  bol torf = true
  raw filepath = /'C:\Source\calc\add.cpp'/
  flt decimal = 0.023
};

Comments

Line Comment: To declare a line-comment type // before the comment to declare it as a comment the parser will skip everything pass the slahes to the end of the line.

// Line comments are easy
str pizza = 'Pepperoni' // With meatballs!

Block Comment: Block comments can be started with /* then all lines before the end character */ are defined as comments and are skipped by the parser.

/* Hello this is a block-comment */

Doc String: To declare a doc-string simply type ''' to start the string and again ''' to end it, though I simply dont recommend using these strings because the parser has issues skipping it.

'''
  Doc-string!!
'''

Constants

true: This constant is used after the equal sign to assign the variable as true.
false: use this after the equal sign to assign the variable as false.
null: This final constant is used after the equal sign to assign the variable as null or None.

Example

class test {
  bool FALSE = false
  bool TRUE = true
  bool NONE = null
};

PDL Example

The following is a .pdl library file with one class called test.

class test {
  str name = 'charlie'
  int number = 2
  // `raw` means the parser ignores back-slash's
  raw file_path = /'C:/source/calc/add.py'/
  list array = ['Pizza', 'Taco', 'Burger']
  bool torf = true
  str namehandle = new name
  
  '''
    Dope docstring
  '''
  // This is a comment
  /* This is a 
  block comment */
};

Extra

For the syntax-highlighting of the example ive been using whatever langauge supports most of pdl's syntax though all pdl script is vaild.

If you have any further questions please do not hesitate to create a new issue

Clone this wiki locally