Skip to content

Instantly share code, notes, and snippets.

@adann0
Last active April 8, 2021 06:27
Show Gist options
  • Save adann0/02bdcb2a8f987b5f77db56ecefdb46b5 to your computer and use it in GitHub Desktop.
Save adann0/02bdcb2a8f987b5f77db56ecefdb46b5 to your computer and use it in GitHub Desktop.
meta
*******************************
** META LANGUAGE CHEAT SHEET **
*******************************
** Initialisation **
Var B : Booléen
Var E : Entier
Var R : Réel
Var C : Chaîne
Var P : Pointeurs
** Affectation **
B <- vrai
E <- 10
R <- -3.14
C <- "hello"
P <- #FFFF
** Constante **
Var C : Chaîne
Constante C <- "Hello"
** Comparaison **
(E >= 10)
(E = R)
(E = 10)
** Enregistrement (Structure) **
MaVariable : Enregistrement
Champ1 : Entier
Champ2 : Booléen
MaVariable.Champ1 ;; retourne la valeur contenu dans la varriable
MaVariable.Champ1 <- 10
Domaine de Valeur : E x {vrai, faux}
** Tableau (Liste) **
Le premier indice d'un tableau dans le metalanguage est 1.
Un tableau contient une suite de donnée, toutes du même type (entier, structure, tableau, ...).
MonTableau : Tableau[1..n] d'Entier
MaMatrice : Tableau[1..n,1..m] d'Entier
MaMatrice[i,j] ;; retourne la valeur contenue dans la matrice à l'indice [i][j]
** Nouveau Type de Donnée **
Type Robot = Enregistrement
CoordX,CoordY : Réel
EnMouvement : Booléen
Var R2D2, C3PO : Robot
R2D2.EnMouvement <- faux
Type PopulationDeRobots = Tableau[1..n] de Robot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment