메뉴 건너뛰기

infra

[pharen] pharen 설치 및 실행

박영식2011.07.05 01:40조회 수 1385댓글 0

  • 1
    • 글자 크기

Pharen: Lisp -> PHP


pharen은 lisp 문법으로 되어 있는 스크립트를 php문법으로 표현해 주는 프로그램이다.


위 사이트에 자세한 설명이 있으며, 설치는 간단하다.

$ git clone git://github.com/Scriptor/pharen.git

git가 설치되어 있다면, 위와 같이 download 하면된다.

$ sudo ./install.sh

설치하면, /usr/bin 에 pharen 이 복사되므로 어디서든 실행가능하다.

그런데, 다운로드 디렉터리 bin 에 보면 실행권한이 없다. 그래서 /usr/bin/pharen 에도 없는지 permission denied

라 나온다. 적절히 실행권한을 주고, (뭐, 7xx 로 주면 실행되지 않을까??, 급한대로 777로 해서리..)

예제 코드를 만든다.

[hello.phn]
; hello.phn
(def id ($ get "id"))

(if (< (intval id) 0)
  (print "Invalid id, cannot be less than 0.")
  (print (. "Fetching page with id: " id)))

단순히 hello world 만 출력하는 코드는 php와 거의 차이가 없으므로 파라미터를 받는 코드로 해보자.

$ pharen hello.phn

위와 같이 compile 하면(tutorial에서 compile 이란 용어를 쓴다.), hello.php 가 나온다.

웹서버에서 실행하면, 그림과 같은 화면을 볼 수 있다.

122.png

박영식 (비회원)
  • 1
    • 글자 크기
[LOSAK] Lisp Operating System, Abstraction Kernel (by 박영식) [file type] doc, ppt, pdf to text (by 박영식)

댓글 달기

첨부 (1)
122.png
5.1KB / Download 50
위로