I'm trying to use YACC with xcode, which is natively supported, and for that effect I found this sample which is working nicely. My idea is to build my own grammar, so I started experimenting with the project to see if it would support what I need. As such, I created the following interface:
.h
#import <Foundation/Foundation.h>
@interface HYPLangNodeNP : NSObject
@end
.m
#import "HYPLangNodeNP.h"
@implementation HYPLangNodeNP
@end
Yes, it's just an empty implementation. Then I made just two changes to the grammar:
1) Add the HYPLangNodeNP import
%{
#import "MessageBlocks.h"
#import "HYPLangNodeNP.h"
int yylex(void);
void yyerror(char *s);
%}
2) Add HYPLangNodeNP to the type %union
%union {
float value;
NSString *identifier;
HYPLangNodeNP *node;
}
The project fails to compile with Unknown type name 'HYPLangNodeNP'
. Does anybody know how to solve?
Edit:
I don't know the YACC version, but it's whatever version ships with Xcode 6.3. The following is the log I get:
CompileC /Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/Objects-normal/i386/ViewController.o Parser\ Test/ViewController.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler cd "/Users/RafaelSoares/Google Drive/Hype/ParserTest-master " export LANG=en_US.US-ASCII export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=8.3 -iquote /Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/Parser\ Test-generated-files.hmap -I/Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/Parser\ Test-own-target-headers.hmap -I/Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/Parser\ Test-all-target-headers.hmap -iquote /Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/Parser\ Test-project-headers.hmap -I/Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Products/Debug-iphonesimulator/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/DerivedSources/i386 -I/Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/DerivedSources -F/Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Products/Debug-iphonesimulator -include /Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/PrecompiledHeaders/Parser\ Test-Prefix-gydtbjgblnmtxcahwzhxkvmnznwf/Parser\ Test-Prefix.pch -MMD -MT dependencies -MF /Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/Objects-normal/i386/ViewController.d --serialize-diagnostics /Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/Objects-normal/i386/ViewController.dia -c /Users/RafaelSoares/Google\ Drive/Hype/ParserTest-master\ /Parser\ Test/ViewController.m -o /Users/RafaelSoares/Library/Developer/Xcode/DerivedData/Parser_Test-ahryrrrgjyqtbhenhxphagqdgppf/Build/Intermediates/Parser\ Test.build/Debug-iphonesimulator/Parser\ Test.build/Objects-normal/i386/ViewController.o
In file included from /Users/RafaelSoares/Google Drive/Hype/ParserTest-master /Parser Test/ViewController.m:5: /Users/RafaelSoares/Google Drive/Hype/ParserTest-master /parser.ym:14:5: error: unknown type name 'HYPLangNodeNP' HYPLangNodeNP * nodeNP; ^ /Users/RafaelSoares/Google Drive/Hype/ParserTest-master /parser.ym:15:5: error: unknown type name 'HYPLangNodeVP' HYPLangNodeVP * nodeVP; ^ /Users/RafaelSoares/Google Drive/Hype/ParserTest-master /parser.ym:16:5: error: unknown type name 'HYPLangNode' HYPLangNode * node; ^ /Users/RafaelSoares/Google Drive/Hype/ParserTest-master /parser.ym:17:5: error: unknown type name 'HYPLangSentence' HYPLangSentence * sentence; ^ /Users/RafaelSoares/Google Drive/Hype/ParserTest-master /Parser Test/ViewController.m:240:34: warning: unused variable 'child' [-Wunused-variable] NSMutableArray * child = [childsVP[i] getChilds]; ^ 1 warning and 4 errors generated.