Implementing a programming language in Python
Articles
http://matt.might.net/articles/implementing-a-programming-language/
getValue: aString | |
"similar to sendMessage but this method also return the python value " | |
|stream errString retValue | | |
stream := SocketStream openConnectionToHostNamed: '127.0.0.1' port: 4000 . | |
stream sendCommand: 'RetValue: ',aString. | |
errString := stream nextLineLf . | |
[errString matchesRegex: '.*end of error.*'] whileFalse:[ | |
Transcript show: 'iterating with error:',errString ;cr. | |
(errString matchesRegex: '.*no error.*') ifFalse: [ |
;;; rlx.el --- RLX development tools for GNU Emacs | |
;; Copyright (C) 2006, 2007, 2008 David O'Toole | |
;; Author: David O'Toole <dto@gnu.org> | |
;; Keywords: multimedia, games | |
;; Version: 0.81 | |
;; This file is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by |
y := 10. | |
Transcript clear. | |
Transcript show: '****************************';cr; | |
show: '* BEGIN COMPUTATION *';cr; | |
show: '****************************';cr. | |
(1 to: 30 ) do: [ :time| | |
Transcript show:'On year ';show:(time asString );show: ' '. | |
Transcript show: 'you code ' ;show: ((y*(1.12**time)) rounded)asString ; | |
show:' lines of code per day.';cr]. |
m := Morph new. | |
m openInWorld. | |
m extent: 50@50. | |
m height: 100. | |
m width: 50. | |
m openInWindowLabeled: 'My First Morph'. | |
editor := TextMorph new. |
ui := UIManager default . | |
ui alert:'You are about to delete your HD'. | |
ui alert: 'You are about to delete your HD' title: 'Critical Alert'. | |
(ui chooseDirectory: 'Choose directory to save the file' )inspect. | |
ui chooseFrom: #(1 'hello' 3 'and' 4.0 'bye' #TheEnd) . | |
ui confirm: 'You want to delete your HD?'. | |
ui deny: 'WRONG PASSWORD'. | |
ui edit: 'I beg you to edit me please, do it, do it fast !!!'. |
registeredColorsList := ListModel new. | |
registeredColorsList | |
items: Color registeredColorNames; | |
backgroundColorBlock: [ :item | Color named: item ]; | |
title: 'Registered colors'. | |
registeredColorsList openWithSpec. |
http://matt.might.net/articles/implementing-a-programming-language/
class:=CPPBridge . | |
file:=(class name asString, '-hierarchy.st') asFileReference. | |
stream:=file writeStream. | |
class fileOutOn:stream. | |
class allSubclassesDo: [ :cls | | |
cls fileOutOn: stream. | |
]. | |
stream close. |
c := CPPBridge . | |
fdNumber := c openFile: '/Users/kilon/cpptest.bin' | |
flags: (c O_RDWR "| c O_CREAT | c O_TRUNC") | |
mode: (c FILEMODE). | |
"lseek := c lSeek_fd: fdNumber range:3999 value:0. | |
c write_fd:fdNumber value: '' size: 1." | |
mmapPointer := c mmap_adress: 0 | |
fileSize:4000 |
import bpy | |
import bgl | |
import blf | |
from morpheas import * | |
# this class is defining the action performed when the button is clicked | |
clase AButtonAction: | |
def onLeftClick(morph): | |
print("the button has been clicked") |