This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 12. Brincadeira do ímpar ou par: | |
# escreva um programa que leia dois nomes e | |
# dois valores inteiros, que correspondem ao | |
# que cada um colocou, e informe quem ganhou | |
# o “ímpar ou par”. | |
imprima "Quem é par? " | |
par = leia_texto | |
imprima "Quem é ímpar? " | |
impar = leia_texto | |
escreva "Coloque os números:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x := 5; | |
exiba "Qual a senha?"; | |
y := Leia; | |
enquanto nao(x = y) { | |
exiba "Qual a senha?"; | |
y := Leia; | |
}; | |
exiba "Acertou" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar Linguagem1; | |
documento: bloco* ; | |
bloco: 'h1' Texto | |
| 'p' Texto | |
| form | |
; | |
form: 'form' '{' elemento* '}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package whilelang | |
import org.antlr.v4.runtime.ParserRuleContext | |
import org.antlr.v4.runtime.tree._ | |
import whilelang.{ WhilelangParser => C } | |
import plp.enquanto.linguagem.Linguagem._ | |
trait Antlr2Scala { | |
protected val values = new ParseTreeProperty[Any] |
Arquivo de definição da sintaxe de Potigol usando o ACE
Teste em: https://ace.c9.io/tool/mode_creator.html
Cole o arquivo potigol.js
no lado esquerdo e o arquivo exemplo.poti
no lado direito.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.dropbox.com/s/nny7objxs401rnn/potigol097.zip?dl=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Crie um programa para construir uma página HTML usando a função: | |
def pagina(font: String, cor: String)(titulo: String, | |
pessoas: List[Pessoa], mensagem: String): String | |
Uma pessoa pode ser um Aluno (nome, matricula, curso, periodo) | |
ou | |
Professor (nome, matricula, disciplina, diretoria). | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable.Buffer | |
class Contato( | |
var nome: String, | |
var email: String, | |
var telefone: Map[String, String], | |
var cidade: String = "") { | |
} | |
class Agenda() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Funcionário usando classe | |
*/ | |
trait Pessoa { | |
def nome: String | |
} | |
class Funcionario(val nome: String, _salario: Double) extends Pessoa { | |
def salario = _salario |