Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * The ALCOHOL Programming Language
- * alcohol.c
- *
- * Copyright 2014 Marc Sylvestre <marc.sylvestre@manhydra.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>,
- * or if prefer good old fashion postal mail, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- // Link: http://pastebin.com/DGHAXe5Y
- #include "alcohol.h"
- INTEGER masterValFive;
- INTEGER masterValTen;
- INTEGER masterValOne;
- INTEGER getFive
- BEGIN_ARGS
- GENERIC
- END_ARGS
- BEGIN_ROUTINE
- RET masterValFive;
- END_ROUTINE
- INTEGER getTen
- BEGIN_ARGS
- GENERIC
- END_ARGS
- BEGIN_ROUTINE
- RET masterValTen;
- END_ROUTINE
- INTEGER getOne
- BEGIN_ARGS
- GENERIC
- END_ARGS
- BEGIN_ROUTINE
- RET masterValOne;
- END_ROUTINE
- INTEGER getNum
- BEGIN_ARGS
- STRING numState
- END_ARGS
- BEGIN_ROUTINE
- TEST(
- (NOT strncmp
- BEGIN_ARGS
- numState, "Five", 4
- END_ARGS
- ))
- RET getFive NO_ARG
- ;
- END_TEST
- TEST((
- NOT strncmp
- BEGIN_ARGS
- numState, "Ten", 3
- END_ARGS
- ))
- RET getFive NO_ARG
- ;
- END_TEST
- TEST((
- NOT strncmp
- BEGIN_ARGS
- numState, "One", 3
- END_ARGS
- ))
- RET getOne NO_ARG
- ;
- END_TEST
- RET 1
- ;
- END_ROUTINE
- INTEGER plusFive
- BEGIN_ARGS
- INTEGER a
- END_ARGS
- BEGIN_ROUTINE
- RET a + 5;
- END_ROUTINE
- BEGIN_PROG
- INTEGER var
- ;
- SET(var,0)
- ;
- ITERATE(var IS_LT 100)
- OUTPUT
- BEGIN_ARGS
- "%d\n",
- plusFive
- BEGIN_ARGS
- var
- END_ARGS
- END_ARGS
- ;
- SET(
- var,
- plusFive
- BEGIN_ARGS
- var
- END_ARGS
- )
- ;
- TEST(var EQUALS 50)
- OUTPUTL
- BEGIN_ARGS
- "We're somewhere in the middle"
- END_ARGS
- ;
- END_TEST
- TEST_CASES(var)
- CASE(25)
- OUTPUTL
- BEGIN_ARGS
- "We're a quarter of the way there."
- END_ARGS
- ;
- END_CASE
- CASE(75)
- OUTPUTL
- BEGIN_ARGS
- "We're a three-quarter of the way there."
- END_ARGS
- ;
- END_CASE
- END_TEST_CASES
- END_ITERATE
- OUTPUT
- BEGIN_ARGS
- "%d\n",
- getNum
- BEGIN_ARGS
- "Five"
- END_ARGS
- END_ARGS
- ;
- END_PROG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement