C를 위한 대화식 환경

feanor의 이미지

ccons는 C를 위한 대화식 환경입니다.
http://code.google.com/p/ccons/

LLVM과 Clang을 사용하기 때문에 아직은 직접 컴파일해보기가 어려울 수 있겠습니다. 아래는 사용예입니다.

>>> :help
The following commands are available:
  :help - displays this message
  :load <library path> - dynamically loads specified library
  :version - displays ccons version information
 
>>> :version
ccons version 0.1 by Alexei Svitkine
Interactive Console for the C Programming Language
http://code.google.com/p/ccons
 
>>> #include <stdio.h>
>>> #include <glob.h>
>>> glob_t result;
>>> glob("*.h", 0, NULL, &result);
=> (int) 0
>>> result.gl_pathc;
=> (__size_t) 13
>>> result.gl_pathv[0];
=> (char *) "ClangUtils.h"

댓글

hongminhee의 이미지

표현식은 세미콜론을 붙여야 평가되는 건가요? 근데 #include가 되는 걸 보니 매크로 같은 것도 가능하겠네요.

feanor의 이미지

1. 네, 세미콜론을 붙여야 평가됩니다. C니까요.
2. 매크로 잘 됩니다.

>>> #define SQUARE(x) ((x)*(x))
>>> SQUARE(5);
=> (int) 25
Scarecrow의 이미지

위키의 REPL 페이지를 보면
http://en.wikipedia.org/wiki/REPL

C의 REPL로
http://neugierig.org/software/c-repl/
이런것도 있더군요.

feanor의 이미지

예. 알고 있었는데 깜빡한 걸 소개해 주시니 감사합니다. 데비안에 c-repl 패키지로 있습니다. 다만 제가 써보려고 하니까 제대로 동작하지 않았습니다.

혹시 위 글에 적은 예제를 c-repl에서 어떻게 실행할 수 있는지 알고 계시면 답변 부탁드립니다.

Scarecrow의 이미지

동작은 그리 만족스럽지 못합니다.

저도 있는거만 알고 써본적은 없는데 이번기회에 한번 c-repl을 써봤지만...

printf("Hello, World.\n")
는 바로 출력하는데

printf("Hello, World.")
는 c-repl을 종료해야 찍힙니다.

imyejin의 이미지

stdout이 기본적으로 라인 버퍼니까 그건 당연한데요, stdout 에대 대고 fflush 를 불러주거나 printf("\n"); 을 한번 해주면 버퍼에 있는 게 찍혀 나오지 않나요? 그렇게 되어야 정상일 듯 싶은데 ...

임예진 팬클럽 ♡예진아씨♡ http://cafe.daum.net/imyejin

[예진아씨 피카사 웹앨범] 임예진 팬클럽 ♡예진아씨♡ http://cafe.daum.net/imyejin

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.