We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

TCC

From Esolang
Jump to navigation Jump to search

"TCC" stands for "Table Changing Code". It was inspired by SQL and was invented by User:A.

Syntax

It has a simple syntax. All of its commands are not case-sensitive.

CREATE

This command is used for creating a table.

Syntax:

CREATE table_name

IN

This command is used for choosing columns of a table and print it.

Syntax:

IN table_name CHOOSE column_number

TCC will print the column.

INSERT

This command is used for inserting data into a table.

Syntax:

INSERT table_name VALUES (value1, value2, value3, ...)

DELETE

Delete a row.

Syntax:

DELETE table_name WHERE row_number

Grammar

An Extended Backus-Naur Form (ENBF) description shall elucidate the program structure:

program       := optSpaces
              ,  [ command , { spaces , command } ]
              ,  optSpaces
              ;

command       := create | in | insert | delete ;
create        := "CREATE" , spaces , tableName ;
in            := "IN"     , spaces , tableName , spaces
              ,  "CHOOSE" , spaces , index ;
insert        := "INSERT" , spaces , tableName , spaces
              ,  "VALUES" , spaces , cellValueList
              ;
delete        := "DELETE" , spaces , tableName , spaces
              ,  "WHERE"  , spaces , index
              ;

tableName     := letter , { letter | digit | "_" } ;
index         := digit , { digit } ;
cellValueList := "(" , optSpaces
              ,   [ cellValue , cellValueRest ]
              ,   optSpaces , ")"
              ;
cellValueRest := { optSpaces , "," , optSpaces , cellValue } ;
cellValue     := integer | string ;
string        := quote , { character - quote } , quote ;
quote         := '"' ;
integer       := [ "+" | "-" ] , digit , { digit } ;
digit         := "0" | "1" | "2" | "3" | "4"
              |  "5" | "6" | "7" | "8" | "9"
              ;
optSpaces     := { space } ;
spaces        := space , { space } ;
space         := " " | "\t " ;

Examples

Hello, World!

This program prints the message “Hello, World!” employing a single column:

CREATE hello_world
INSERT hello_world VALUES ("H")
INSERT hello_world VALUES ("e")
INSERT hello_world VALUES ("l")
INSERT hello_world VALUES ("l")
INSERT hello_world VALUES ("o")
INSERT hello_world VALUES (",")
INSERT hello_world VALUES (" ")
INSERT hello_world VALUES ("W")
INSERT hello_world VALUES ("o")
INSERT hello_world VALUES ("r")
INSERT hello_world VALUES ("l")
INSERT hello_world VALUES ("d")
INSERT hello_world VALUES ("!")
IN     hello_world CHOOSE 1

This second variant utilizes two columns — one embracing the moeity “Hello, ”, the other the part “World!” — in its pursuit to display “Hello, World!”:

CREATE hello_world
INSERT hello_world VALUES ("H", "W")
INSERT hello_world VALUES ("e", "o")
INSERT hello_world VALUES ("l", "r")
INSERT hello_world VALUES ("l", "l")
INSERT hello_world VALUES ("o", "d")
INSERT hello_world VALUES (",", "!")
INSERT hello_world VALUES (" ")
IN     hello_world CHOOSE 1
IN     hello_world CHOOSE 2

Interpreter

  • Common Lisp implementation of the TCC programming language.