Ver Mensaje Individual
  #1  
Antiguo 25-09-2013
Avatar de mamcx
mamcx mamcx is offline
Moderador
 
Registrado: sep 2004
Ubicación: Medellín - Colombia
Posts: 3.941
Reputación: 27
mamcx Tiene un aura espectacularmamcx Tiene un aura espectacularmamcx Tiene un aura espectacular
Cool Un nuevo tipo de Pascal

Como escribi en http://clubdelphi.com/foros/showthread.php?t=80367 llevo un rato dandole vueltas a hacer un nuevo lenguaje.

Eso me ha llevado a conocer un monton de lenguajes alternativos, y de entre ellos, este es muy parecido a pascal:

http://nimrod-code.org/

(En el home se ve mas como un python, es mas bien un pythonpascal )

Ya en el tutorial:

http://nimrod-code.org/tut1.html

Código Delphi [-]
type
  TMyObject {.final, pure, acyclic.} = object  # comment continues: \
    # we have lots of space here to comment 'TMyObject'.
    # This line belongs to the comment as it's properly aligned.

var
  x, y: int
  # a comment can occur here too
  a, b, c: string

type
  PNode = ref TNode
  TNode = tuple[le, ri: PNode, data: int]
var
  n: PNode
new(n)
n.data = 9

type
  TPerson = object of TObject
    name*: string  # the * means that `name` is accessible from other modules
    age: int       # no * means that the field is hidden from other modules
  
  TStudent = object of TPerson # TStudent inherits from TPerson
    id: int                    # with an id field

Muy interesante me parecio su metaprogramacion (MACROS en C++):

Código Delphi [-]
const
  debug = True

template log(msg: string) =
  if debug: stdout.writeln(msg)

var
  x = 4
log("x has the value: " & $x)
__________________
El malabarista.
Responder Con Cita